Re: [PATCH v2] iio: adc: ti-ads8688: use read_avail for available attributes

From: Andy Shevchenko

Date: Thu Mar 26 2026 - 05:07:12 EST


On Wed, Mar 25, 2026 at 11:09:42AM +0000, Gabriel Rondon wrote:
> Convert the in_voltage_scale_available and in_voltage_offset_available
> attributes from legacy IIO_DEVICE_ATTR with custom show functions to the

IIO_DEVICE_ATTR()

> IIO framework's read_avail callback. This uses the framework's built-in

.read_avail()

> support for _available attributes, removing the need for manual sysfs
> formatting.
>
> Precompute the available scale values at probe time since they depend on
> the reference voltage which does not change after initialization.

...

> Changes in v2:
> - Use -BIT() macro instead of -(1 << ...) to avoid potential UB and
> improve readability (Andy Shevchenko)

Not really (and LKP showed that), I suggested to use GENMASK().

--
With Best Regards,
Andy Shevchenko