[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170205160737.zx3zxaniacjvlrf7@sirena.org.uk>
Date: Sun, 5 Feb 2017 17:07:37 +0100
From: Mark Brown <broonie@...nel.org>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc: Liam Girdwood <lgirdwood@...il.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/4] regulator: core: make bulk API support optional
supplies
On Sat, Feb 04, 2017 at 10:13:18AM -0800, Dmitry Torokhov wrote:
> On Sat, Feb 04, 2017 at 11:56:14AM +0100, Mark Brown wrote:
> > some of the regulators are optional. You *can* peer into the structure
> > and special case things but it then makes further uses of the bulk API
> > on the same block of regulators not work which isn't good.
> They should work with the version of the patch I sent. There you can use
> regulator_bulk_enable() and regulator_bulk_disable() and others and they
> will skip over optional missing regulators.
So that bit's addressed but not the wider thing where more special case
code is going to be needed - it's unlikely to simply be a case of just
not operating on the optional regulator or regulators. This is at least
as much of an issue, the way that this says that it's a normal thing to
just have some regulators that might be optional with no special
handling is a normal and standard thing.
> Consider the conversion patch below as an example. We are able to remove
> forest of "if (IS_ERR(...))", checking and special handling of
> -EPROBE_DEFER, and jumping to labels to disable regulators with 2 API
> calls and much smaller checks to figure out the configuration we are
> running with.
The tlv320aic32x4 driver isn't a particularly well written driver in
this regard in the first place - I don't recall the details but I
strongly suspect that the driver is an example of abuse of the optional
API and that of the supplies possibly only ldoin is actually optional.
I would expect that this should look *much* more like sgtl5000, or
possibly handled more like arizona-ldo1. I agree that there's lots of
room for cleanups and fixes here, frankly I don't quite remember why I
accepted the patch.
I'd be a lot happier if I were seeing examples where this helped a lot
and the original code looked good, I've not really been seeing those
though. A lot of the examples of use of optional regulators that I see
(including both those in drivers/input FWIW) don't look like they are
for supplies that should be optional.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists