Re: [RFC PATCH v2 1/5] regulator: Add devm helpers for get and enable

From: Jonathan Cameron
Date: Sun Oct 09 2022 - 08:24:09 EST


On Thu, 6 Oct 2022 19:17:39 +0300
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:

> On Thu, Oct 06, 2022 at 05:36:52PM +0300, Matti Vaittinen wrote:
> > A few regulator consumer drivers seem to be just getting a regulator,
> > enabling it and registering a devm-action to disable the regulator at
> > the driver detach and then forget about it.
> >
> > We can simplify this a bit by adding a devm-helper for this pattern.
> > Add devm_regulator_get_enable() and devm_regulator_get_enable_optional()
>
> ...
>
> > (cherry picked from commit b6058e052b842a19c8bb639798d8692cd0e7589f)
>
> Not sure:
> - why this is in the commit message
> - what it points to, since
> $ git show b6058e052b842a19c8bb639798d8692cd0e7589f
> fatal: bad object b6058e052b842a19c8bb639798d8692cd0e7589f

These are now upstream in Linus' tree and in my testing branch.
I'd not normally advocate working on top of that (because I rebase it), but
if it is useful for this series go ahead.

Jonathan

>
> > Already in Mark's regulator tree. Not to be merged. Included just for
> > the sake of the completeness. Will be dropped when series is rebased on
> > top of the 6.1-rc1
>
> Ah, I see, but does it mean the commit has been rebased or you used wrong SHA?
>
> ...
>
> > +static void regulator_action_disable(void *d)
> > +{
> > + struct regulator *r = (struct regulator *)d;
>
> Cast is not needed.
>
> > + regulator_disable(r);
> > +}
>