Re: [PATCH v4 3/4] iio: adc: qcom-pm8xxx-xoadc: constify pointers in read operations

From: Andy Shevchenko

Date: Mon Apr 27 2026 - 03:58:25 EST


On Sat, Apr 25, 2026 at 08:39:20PM +0000, Antony Kurniawan Soemardi wrote:
> These functions do not modify the indio_dev & adc structure, so they
> should be marked const to allow the compiler to catch any accidental
> modifications and to document the read only nature of these functions.

...

> - struct pm8xxx_xoadc *adc = iio_priv(indio_dev);
> + const struct iio_dev *indio_dev = d;
> + const struct pm8xxx_xoadc *adc = iio_priv(indio_dev);
>
> complete(&adc->complete);

Pointer to a constant object assumes no modification to that, isn't it? Please,
compile your code first.


--
With Best Regards,
Andy Shevchenko