[PATCH 03/15] iio: adc: axp288_adc: do not use internal iio_dev lock

Sa, Nuno Nuno.Sa at analog.com
Tue Sep 20 06:18:26 PDT 2022



> -----Original Message-----
> From: Andy Shevchenko <andy.shevchenko at gmail.com>
> Sent: Tuesday, September 20, 2022 3:13 PM
> To: Sa, Nuno <Nuno.Sa at analog.com>
> Cc: linux-arm-kernel at lists.infradead.org; linux-rockchip at lists.infradead.org;
> linux-amlogic at lists.infradead.org; linux-imx at nxp.com; linux-
> iio at vger.kernel.org; Chunyan Zhang <zhang.lyra at gmail.com>; Hennerich,
> Michael <Michael.Hennerich at analog.com>; Martin Blumenstingl
> <martin.blumenstingl at googlemail.com>; Sascha Hauer
> <s.hauer at pengutronix.de>; Cixi Geng <cixi.geng1 at unisoc.com>; Kevin
> Hilman <khilman at baylibre.com>; Vladimir Zapolskiy <vz at mleia.com>;
> Pengutronix Kernel Team <kernel at pengutronix.de>; Alexandru Ardelean
> <aardelean at deviqon.com>; Fabio Estevam <festevam at gmail.com>; Andriy
> Tryshnivskyy <andriy.tryshnivskyy at opensynergy.com>; Haibo Chen
> <haibo.chen at nxp.com>; Shawn Guo <shawnguo at kernel.org>; Hans de
> Goede <hdegoede at redhat.com>; Miquel Raynal
> <miquel.raynal at bootlin.com>; Jerome Brunet <jbrunet at baylibre.com>;
> Heiko Stuebner <heiko at sntech.de>; Florian Boor
> <florian.boor at kernelconcepts.de>; Regus, Ciprian
> <Ciprian.Regus at analog.com>; Lars-Peter Clausen <lars at metafoo.de>;
> Jonathan Cameron <jic23 at kernel.org>; Neil Armstrong
> <narmstrong at baylibre.com>; Baolin Wang
> <baolin.wang at linux.alibaba.com>; Jyoti Bhayana <jbhayana at google.com>;
> Chen-Yu Tsai <wens at csie.org>; Orson Zhai <orsonzhai at gmail.com>
> Subject: Re: [PATCH 03/15] iio: adc: axp288_adc: do not use internal iio_dev
> lock
> 
> [External]
> 
> On Tue, Sep 20, 2022 at 2:28 PM Nuno Sá <nuno.sa at analog.com> wrote:
> >
> > The iio_device lock is only meant for internal use. Hence define a
> > device local lock to protect against concurrent accesses.
> 
> ...
> 
> >         info = iio_priv(indio_dev);
> > +       mutex_init(&info->lock);
> >         info->irq = platform_get_irq(pdev, 0);
> >         if (info->irq < 0)
> >                 return info->irq;
> 
> Consider initializing it as late as possible, like after IRQ retrieval
> in this context (maybe even deeper, but no context available). Ditto
> for the rest of the series.

Any special reason for it (maybe related to lockdep :wondering: ) ? Just
curious as I never noticed such a pattern when initializing mutexes.

- Nuno Sá


More information about the linux-arm-kernel mailing list