Re: [PATCH] iio: temperature: ltc2983: avoid string comparison for leak detector
From: Andy Shevchenko
Date: Wed Sep 30 2026 - 06:00:27 EST
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?
...
> - 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?
--
With Best Regards,
Andy Shevchenko