From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Sahin, Okan" <Okan.Sahin@analog.com>
Cc: "Nuno Sá" <noname.nuno@gmail.com>,
"Mark Brown" <broonie@kernel.org>, "Lee Jones" <lee@kernel.org>,
"Rob Herring" <robh+dt@kernel.org>,
"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
"Liam Girdwood" <lgirdwood@gmail.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Cosmin Tanislav" <demonsingur@gmail.com>,
"Stephen Boyd" <sboyd@kernel.org>,
"Caleb Connolly" <caleb.connolly@linaro.org>,
"Lad Prabhakar" <prabhakar.mahadev-lad.rj@bp.renesas.com>,
"Bolboaca, Ramona" <Ramona.Bolboaca@analog.com>,
"ChiYuan Huang" <cy_huang@richtek.com>,
"Tilki, Ibrahim" <Ibrahim.Tilki@analog.com>,
"William Breathitt Gray" <william.gray@linaro.org>,
"Arnd Bergmann" <arnd@arndb.de>,
"ChiaEn Wu" <chiaen_wu@richtek.com>,
"Haibo Chen" <haibo.chen@nxp.com>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Subject: Re: [PATCH v6 5/5] mfd: max77541: Add ADI MAX77541/MAX77540 PMIC Support
Date: Wed, 29 Mar 2023 17:11:02 +0300 [thread overview]
Message-ID: <ZCRG9uilzFjkAtsJ@smile.fi.intel.com> (raw)
In-Reply-To: <ZCRGa76BqswH7Bez@smile.fi.intel.com>
On Wed, Mar 29, 2023 at 05:08:44PM +0300, Andy Shevchenko wrote:
> On Tue, Mar 28, 2023 at 04:01:21PM +0000, Sahin, Okan wrote:
> > >On Tue, Mar 28, 2023 at 04:51:18PM +0200, Nuno Sá wrote:
> > >> On Tue, 2023-03-28 at 17:35 +0300, Andy Shevchenko wrote:
> > >> > On Tue, Mar 28, 2023 at 04:18:30PM +0200, Nuno Sá wrote:
> > >> > > On Tue, 2023-03-28 at 14:46 +0100, Mark Brown wrote:
> > >> > > > On Tue, Mar 28, 2023 at 03:26:44PM +0200, Nuno Sá wrote:
> > >> > > >
> > >> > > > > IIRC, regmap_read() is not really reentrant and it is used in
> > >> > > > > the IIO driver on the sysfs interface. So, yeah, I think you
> > >> > > > > need the regmap lock and better just leave the config as is.
> > >> > > > > Yes, the lock is
> > >> > > > > opt-
> > >> > > > > out
> > >> > > > > so let's not disable it :)
> > >> > > >
> > >> > > > All the regmap operations are fully thread safe.
> > >> > >
> > >> > > Even if 'config->disable_locking' is set? I think that is what's
> > >> > > being discussed in here...
> > >> >
> > >> > In case the driver has its own lock to serialize IO how on earth the
> > >> > regmap lock is needed. That's what I asked the author of the driver.
> > >> > He told the code
> > >>
> > >> Well, if the driver has it's own locking, then sure we do not need
> > >> regmap's lock...
> > >>
> > >> > doesn't require the regmap lock, and I tend to believe the author.
> > >> > So, why to
> > >> > keep it?
> > >>
> > >> However, if you look at the adc driver, I can see plain regmap_read()
> > >> calls without any "outside" locking.
> > >
> > >Then author of the code should know what they are doing. Right?
>
> > Actually, I do not want to disable regmap lock that's why I did not update it.
>
> If you have something like
>
> func1()
> regmap_read(reg1)
> regmap_read/write(reg2)
>
> func2()
> regmap_read/write(regX) // X may or may not be 1 or 2
>
> and func1() and func2() can be run in parallel then the code is racy.
I have to add that it's racy depending on the hardware of course.
In some cases it may be not a problem, in some it can. _Strictly_
speaking it's racy.
> Do you have such in your code?
Please, double check that. It's recommended to explain your locking schema
somewhere in the code top comment so anybody who reads it later and tries
to modify will know what to expect.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2023-03-29 14:13 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-07 11:28 [PATCH v6 0/5] Add MAX77541/MAX77540 PMIC Support Okan Sahin
2023-03-07 11:28 ` [PATCH v6 1/5] dt-bindings: regulator: max77541: Add ADI MAX77541/MAX77540 Regulator Okan Sahin
2023-03-07 11:28 ` [PATCH v6 2/5] regulator: max77541: Add ADI MAX77541/MAX77540 Regulator Support Okan Sahin
2023-03-07 12:19 ` Andy Shevchenko
2023-04-04 14:05 ` Sahin, Okan
2023-03-07 11:28 ` [PATCH v6 3/5] iio: adc: max77541: Add ADI MAX77541 ADC Support Okan Sahin
2023-03-07 11:28 ` [PATCH v6 4/5] dt-bindings: mfd: max77541: Add ADI MAX77541/MAX77540 Okan Sahin
2023-03-07 11:28 ` [PATCH v6 5/5] mfd: max77541: Add ADI MAX77541/MAX77540 PMIC Support Okan Sahin
2023-03-15 17:52 ` Lee Jones
2023-03-15 17:52 ` Lee Jones
2023-03-28 8:26 ` Sahin, Okan
2023-03-28 12:51 ` Andy Shevchenko
2023-03-28 13:26 ` Nuno Sá
2023-03-28 13:46 ` Mark Brown
2023-03-28 14:18 ` Nuno Sá
2023-03-28 14:35 ` Andy Shevchenko
2023-03-28 14:44 ` Lars-Peter Clausen
2023-03-28 14:51 ` Nuno Sá
2023-03-28 15:47 ` Andy Shevchenko
2023-03-28 16:01 ` Sahin, Okan
2023-03-29 14:08 ` Andy Shevchenko
2023-03-29 14:11 ` Andy Shevchenko [this message]
2023-03-30 7:43 ` Nuno Sá
2023-03-29 7:01 ` Nuno Sá
2023-03-29 14:06 ` Andy Shevchenko
2023-03-28 15:24 ` Mark Brown
2023-03-29 14:36 ` Lee Jones
2023-03-29 14:43 ` Andy Shevchenko
2023-03-29 14:56 ` Lee Jones
2023-03-29 15:06 ` Lee Jones
2023-03-30 8:04 ` Krzysztof Kozlowski
2023-03-30 8:07 ` Krzysztof Kozlowski
2023-04-03 11:40 ` Sahin, Okan
2023-04-03 14:09 ` Lee Jones
2023-04-05 8:36 ` Andy Shevchenko
2023-04-05 13:39 ` Lee Jones
2023-04-09 16:48 ` Sahin, Okan
2023-04-12 10:04 ` Lee Jones
2023-04-12 10:44 ` Sahin, Okan
2023-03-30 8:05 ` Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZCRG9uilzFjkAtsJ@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=Ibrahim.Tilki@analog.com \
--cc=Okan.Sahin@analog.com \
--cc=Ramona.Bolboaca@analog.com \
--cc=arnd@arndb.de \
--cc=broonie@kernel.org \
--cc=caleb.connolly@linaro.org \
--cc=chiaen_wu@richtek.com \
--cc=cy_huang@richtek.com \
--cc=demonsingur@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=haibo.chen@nxp.com \
--cc=jic23@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lars@metafoo.de \
--cc=lee@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=noname.nuno@gmail.com \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=robh+dt@kernel.org \
--cc=sboyd@kernel.org \
--cc=william.gray@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox