Re: [PATCH v3] iio: adc: qcom-spmi-adc5-gen3: fix lock annotations on mutex helpers
From: Jonathan Cameron
Date: Sun Oct 25 2026 - 18:00:13 EST
On Sun, 25 Oct 2026 13:10:26 -0700
Bart Van Assche <bvanassche@xxxxxxx> wrote:
> On 10/25/26 12:15 PM, Rupesh Majhi wrote:
> > Found by building with CONTEXT_ANALYSIS_qcom-spmi-adc5-gen3.o=y
>
> Please include the CONTEXT_ANALYSIS_qcom-spmi-adc5-gen3.o=y change in
> your patch.
>
I asked that we didn't do this because intent is to follow with
remaining fixes to be able to enable this IIO tree wide.
I'd rather avoid the churn of piecewise makefile updates if
we are going to be there soon.
Rupesh, if you think that is coming soon then please just make
next version of this the first patch in that series.
If not I don't mind merging this sooner with the makefile change
to ensure this gets used in the meantime.
Thanks,
Jonathan
> > diff --git a/drivers/iio/adc/qcom-spmi-adc5-gen3.c b/drivers/iio/adc/qcom-spmi-adc5-gen3.c
> > index c68c6c5f6aca..6a3cabedf4e8 100644
> > --- a/drivers/iio/adc/qcom-spmi-adc5-gen3.c
> > +++ b/drivers/iio/adc/qcom-spmi-adc5-gen3.c
> > @@ -663,7 +663,7 @@ static int adc5_gen3_add_aux_tm_device(struct adc5_chip *adc)
> > }
> >
> > void adc5_gen3_mutex_lock(struct device *dev)
> > - __acquires(&adc->lock)
> > + __context_unsafe(/* returns with adc->lock held */)
> > {
> > struct iio_dev *indio_dev = dev_get_drvdata(dev->parent);
> > struct adc5_chip *adc = iio_priv(indio_dev);
> > @@ -673,7 +673,7 @@ void adc5_gen3_mutex_lock(struct device *dev)
> > EXPORT_SYMBOL_NS_GPL(adc5_gen3_mutex_lock, "QCOM_SPMI_ADC5_GEN3");
> >
> > void adc5_gen3_mutex_unlock(struct device *dev)
> > - __releases(&adc->lock)
> > + __context_unsafe(/* releases adc->lock */)
> > {
> > struct iio_dev *indio_dev = dev_get_drvdata(dev->parent);
> > struct adc5_chip *adc = iio_priv(indio_dev);
> >
> > base-commit: c9dbe2a47f635465c9985b7af74d2ae310e98125
>
> Please consider replacing the above with the patch below:
>
> diff --git a/drivers/iio/adc/qcom-spmi-adc5-gen3.c
> b/drivers/iio/adc/qcom-spmi-adc5-gen3.c
> index c68c6c5f6aca..09013c6e44a0 100644
> --- a/drivers/iio/adc/qcom-spmi-adc5-gen3.c
> +++ b/drivers/iio/adc/qcom-spmi-adc5-gen3.c
> @@ -663,7 +663,7 @@ static int adc5_gen3_add_aux_tm_device(struct
> adc5_chip *adc)
> }
>
> void adc5_gen3_mutex_lock(struct device *dev)
> - __acquires(&adc->lock)
> + __acquires(&((struct adc5_chip
> *)iio_priv(dev_get_drvdata(dev->parent)))->lock)
> {
> struct iio_dev *indio_dev = dev_get_drvdata(dev->parent);
> struct adc5_chip *adc = iio_priv(indio_dev);
> @@ -673,7 +673,7 @@ void adc5_gen3_mutex_lock(struct device *dev)
> EXPORT_SYMBOL_NS_GPL(adc5_gen3_mutex_lock, "QCOM_SPMI_ADC5_GEN3");
>
> void adc5_gen3_mutex_unlock(struct device *dev)
> - __releases(&adc->lock)
> + __releases(&((struct adc5_chip
> *)iio_priv(dev_get_drvdata(dev->parent)))->lock)
> {
> struct iio_dev *indio_dev = dev_get_drvdata(dev->parent);
> struct adc5_chip *adc = iio_priv(indio_dev);
>
> Thanks,
>
> Bart.