[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130910170438.GS29403@sirena.org.uk>
Date: Tue, 10 Sep 2013 18:04:38 +0100
From: Mark Brown <broonie@...nel.org>
To: Stephen Warren <swarren@...dotorg.org>
Cc: Guenter Roeck <linux@...ck-us.net>, Wei Ni <wni@...dia.com>,
"khali@...ux-fr.org" <khali@...ux-fr.org>,
"lm-sensors@...sensors.org" <lm-sensors@...sensors.org>,
"linux-tegra@...r.kernel.org" <linux-tegra@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 1/2] hwmon: (lm90) Add power control
On Tue, Sep 10, 2013 at 09:07:43AM -0600, Stephen Warren wrote:
> On 09/10/2013 04:09 AM, Mark Brown wrote:
> > No. There are a couple of issues here. One is that we don't want
> > to litter all drivers with conditional code to check if they
> > actually got the regulator and so on, that's just pointless make
> > work on the part of consumers.
> So that's exactly the difference between (a) and (b) above.
Right, but the idea is that we just only ignore a failure to get a
supply if we can usefully run without that supply being present and
there's more code there than simply ignoring the error - if the driver
can genuinely just ignore all errors and otherwise not do anything
different then requesting the regulator in the first place is clearly a
waste of time and enabling it would be a waste of power.
A driver should only be carrying code for a missing regulator if it can
usefully work without it, like the cases where devices can use an
internal reference if one is not available.
> > The other is that just ignoring errors is generally terrible
> > practice which we don't want to encourage - ignoring the specific
> > case where nothing is provided and the system has control of that
> > is one thing but just ignoring any error is another.
> Yes, obviously the code somewhere needs to distinguish between
> missing-so-use-a-dummy, and specified-but-in-a-broken-way. Doesn't
> regulator_get_optional() already distinguish those two cases? Perhaps
> that's the enhancement to regulator_get_optional() that you were
> requesting.
Both calls are identical in terms of handling genuine errors. If the
driver is just trying to ignore errors it will be more work to use
_optional() since it has to cope with the regulator not being present in
a system.
Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists