From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: "Stephen Boyd" <sboyd@kernel.org>,
"Mark Brown" <broonie@kernel.org>,
"Matti Vaittinen" <mazziesaccount@gmail.com>,
"Matti Vaittinen" <matti.vaittinen@fi.rohmeurope.com>,
dri-devel <dri-devel@lists.freedesktop.org>,
"Johan Hovold" <johan+linaro@kernel.org>,
"Neil Armstrong" <narmstrong@baylibre.com>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Kevin Hilman" <khilman@baylibre.com>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
"Daniel Vetter" <daniel@ffwll.ch>,
linux-amlogic <linux-amlogic@lists.infradead.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Linux Documentation List" <linux-doc@vger.kernel.org>,
"Jonathan Cameron" <jic23@kernel.org>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Liam Girdwood" <lgirdwood@gmail.com>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Miaoqian Lin" <linmq006@gmail.com>,
"linux-arm Mailing List" <linux-arm-kernel@lists.infradead.org>,
"Alexandru Tachici" <alexandru.tachici@analog.com>,
"Jerome Brunet" <jbrunet@baylibre.com>,
"Andrzej Hajda" <andrzej.hajda@intel.com>,
"Jonathan Corbet" <corbet@lwn.net>,
"Guenter Roeck" <linux@roeck-us.net>,
"Jonas Karlman" <jonas@kwiboo.se>,
"Lorenzo Bianconi" <lorenzo@kernel.org>,
"Michael Turq uette" <mturquette@baylibre.com>,
"Jernej Skrabec" <jernej.skrabec@gmail.com>,
"Martin Blumenstingl" <martin.blumenstingl@googlemail.com>,
"Jean Delvare" <jdelvare@suse.com>,
"Alexandru Ardelean" <aardelean@deviqon.com>,
linux-hwmon@vger.kernel.org,
linux-clk <linux-clk@vger.kernel.org>,
"Nuno Sá" <nuno.sa@analog.com>,
"Robert Foss" <robert.foss@linaro.org>,
"Aswath Govindraju" <a-govindraju@ti.com>,
"David Airlie" <airlied@linux.ie>,
linux-iio <linux-iio@vger.kernel.org>
Subject: Re: (subset) [PATCH v2 0/7] Devm helpers for regulator get and enable
Date: Tue, 16 Aug 2022 11:42:20 +0300 [thread overview]
Message-ID: <CAHp75VefRphjAhSmrUVC8aaAhrwMD+9Jr=OROFU-0JuNhuFYDw@mail.gmail.com> (raw)
In-Reply-To: <Yvq33T+XCduoqv7Z@pendragon.ideasonboard.com>
On Tue, Aug 16, 2022 at 8:37 AM Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> On Mon, Aug 15, 2022 at 01:58:55PM -0700, Stephen Boyd wrote:
> > Quoting Laurent Pinchart (2022-08-15 11:52:36)
> > > On Mon, Aug 15, 2022 at 05:33:06PM +0100, Mark Brown wrote:
...
> > > we'll run into trouble. Supplying active high input signals
> > > to a device that is not powered can lead to latch-up, which tends to
> > > only manifest after a statistically significant number of occurrences of
> > > the condition, and can slowly damage the hardware over time. This is a
> > > real concern as it will typically not be caught during early
> > > development. I think we would still be better off with requiring drivers
> > > to manually handle powering off the device until we provide a mechanism
> > > that can do so safely in an automated way.
> >
> > Can you describe the error scenario further? I think it's driver author
> > error that would lead to getting and enabling the regulator after
> > getting and enabling a clk that drives out a clock signal on some pins
> > that aren't powered yet. I'm not sure that's all that much easier to do
> > with these sorts of devm APIs, but if it is then I'm concerned.
>
> You will very quickly see drivers doing this (either directly or
> indirectly):
>
> probe()
> {
> devm_clk_get_enabled();
> devm_regulator_get_enable();
> }
And how is it devm specific? If the author puts the same without devm
the ordering would be wrong, correct? devm allows us to focus on
ordering in a *single* place, which is a win. You seem to be proposing
to make a high burden on a driver's author to focus on ordering in the
*three* places. I disagree with that. Yet the driver author has to
understand many issues with any tool they use. So the root cause of
your whining is rather on the edge of documentation and education.
(Yes, I have heard about issues with object lifetime in v4l2
subdevices regarding to devm, but it seems irrelevant to devm
mechanism itself.)
> Without a devres-based get+enable API drivers can get the resources they
> need in any order, possibly moving some of those resource acquisition
> operations to different functions, and then have a clear block of code
> that enables the resources in the right order. These devres helpers give
> a false sense of security to driver authors and they will end up
> introducing problems, the same way that devm_kzalloc() makes it
> outrageously easy to crash the kernel by disconnecting a device that is
> in use.
--
With Best Regards,
Andy Shevchenko
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2022-08-16 8:43 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-12 10:08 [PATCH v2 0/7] Devm helpers for regulator get and enable Matti Vaittinen
2022-08-12 10:11 ` [PATCH v2 5/7] gpu: drm: simplify drivers using devm_regulator_*get_enable*() Matti Vaittinen
2022-08-15 15:44 ` (subset) [PATCH v2 0/7] Devm helpers for regulator get and enable Mark Brown
2022-08-15 15:54 ` Laurent Pinchart
2022-08-15 16:33 ` Mark Brown
2022-08-15 18:52 ` Laurent Pinchart
2022-08-15 20:58 ` Stephen Boyd
2022-08-15 21:17 ` Laurent Pinchart
2022-08-15 22:55 ` Mark Brown
2022-08-16 4:56 ` Matti Vaittinen
2022-08-16 10:36 ` Mark Brown
2022-08-16 11:06 ` Vaittinen, Matti
2022-08-16 11:31 ` Mark Brown
2022-08-16 8:42 ` Andy Shevchenko [this message]
2022-08-15 22:07 ` Mark Brown
2022-08-30 19:42 ` Stephen Boyd
2022-08-16 8:23 ` Andy Shevchenko
2022-08-18 11:33 ` Matti Vaittinen
2022-08-18 11:54 ` Mark Brown
2022-08-18 12:04 ` Vaittinen, Matti
2022-08-18 14:01 ` Mark Brown
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='CAHp75VefRphjAhSmrUVC8aaAhrwMD+9Jr=OROFU-0JuNhuFYDw@mail.gmail.com' \
--to=andy.shevchenko@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=a-govindraju@ti.com \
--cc=aardelean@deviqon.com \
--cc=airlied@linux.ie \
--cc=alexandru.tachici@analog.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=andrzej.hajda@intel.com \
--cc=broonie@kernel.org \
--cc=corbet@lwn.net \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=jbrunet@baylibre.com \
--cc=jdelvare@suse.com \
--cc=jernej.skrabec@gmail.com \
--cc=jic23@kernel.org \
--cc=johan+linaro@kernel.org \
--cc=jonas@kwiboo.se \
--cc=khilman@baylibre.com \
--cc=lars@metafoo.de \
--cc=laurent.pinchart@ideasonboard.com \
--cc=lgirdwood@gmail.com \
--cc=linmq006@gmail.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=lorenzo@kernel.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=matti.vaittinen@fi.rohmeurope.com \
--cc=mazziesaccount@gmail.com \
--cc=mturquette@baylibre.com \
--cc=narmstrong@baylibre.com \
--cc=nuno.sa@analog.com \
--cc=robert.foss@linaro.org \
--cc=sboyd@kernel.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;
as well as URLs for NNTP newsgroup(s).