mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Nuno Sá" <nuno.sa@analog.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: cdcp206@gmail.com, Nathan Chancellor <nathan@kernel.org>,
	Jonathan Cameron <jic23@kernel.org>,
	David Lechner <dlechner@baylibre.com>,
	Andy Shevchenko <andy@kernel.org>,
	Liviu Stan <liviu.stan@analog.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel test robot <lkp@intel.com>
Subject: Re: [PATCH] iio: temperature: ltc2983: avoid string comparison for leak detector
Date: Wed, 30 Sep 2026 13:13:01 +0100	[thread overview]
Message-ID: <arz6WU9HoRVDQCv0@nsa> (raw)
In-Reply-To: <arzb0JQxkJAsLsEa@ashevche-desk.local>

On Wed, Sep 30, 2026 at 12:52:16PM +0300, Andy Shevchenko wrote:
> On Tue, Sep 29, 2026 at 12:38:22PM -0500, Carlos Casadiego via B4 Relay wrote:
> 
> +Cc: Nathan
> 
> > GCC can determine at compile time that propname cannot match
> > "adi,custom-leak-detector" when __ltc2983_custom_sensor_new() is
> > inlined for some callers, triggering a -Wstring-compare warning.
> > 
> > Pass an explicit flag for leak detectors instead of deriving the sensor
> > type from the firmware property name. This preserves the existing
> > conversion behavior and avoids the constant string comparison.
> 
> ...
> 
> >  __ltc2983_custom_sensor_new(struct ltc2983_data *st, const struct fwnode_handle *fn,
> >  			    const char *propname, const bool is_steinhart,
> > -			    const u32 resolution, const bool has_signed)
> > +			    const u32 resolution, const bool has_signed,
> > +			    const bool is_leak_detector)
> 
> Can we get rid of those strange const qualifiers for booleans. What are they for?

Obviously nothing. They came from a time where I thought they added some readability
value :).

> 
> ...
> 
> > -			if ((index % 2) != 0 && !strcmp(propname, "adi,custom-leak-detector"))
> > +			if ((index % 2) != 0 && is_leak_detector)
> >  				temp = temp * 1000000 + 273150000;
> 
> Hmm... I consider that the compiler warning is just a noise which we should
> ignore or disable. It's doubtfully useful as if it may prove the always false
> or always true cases, it doesn't mean there won't be other cases in the future.
> Do we have any discussion on that warning before?
> 

While I agree with the above, I'm not against the change of having the
boolean against the string comparison (and the warning would be just a
side effect and not the main motivation for the change).

- Nuno Sá

> -- 
> With Best Regards,
> Andy Shevchenko
> 
> 

  reply	other threads:[~2026-09-30 12:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29 17:38 Carlos Casadiego via B4 Relay
2026-09-30  9:52 ` Andy Shevchenko
2026-09-30 12:13   ` Nuno Sá [this message]
2026-09-30 15:03   ` Nathan Chancellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=arz6WU9HoRVDQCv0@nsa \
    --to=nuno.sa@analog.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=cdcp206@gmail.com \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liviu.stan@analog.com \
    --cc=lkp@intel.com \
    --cc=nathan@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®