lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 21 Feb 2017 00:30:03 -0800
From:   Dmitry Torokhov <dmitry.torokhov@...il.com>
To:     Mark Brown <broonie@...nel.org>
Cc:     Liam Girdwood <lgirdwood@...il.com>,
        Guenter Roeck <linux@...ck-us.net>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] regulator: devres: introduce managed enable and
 disable operations

On Mon, Feb 20, 2017 at 11:02:58AM -0800, Mark Brown wrote:
> On Mon, Feb 13, 2017 at 10:51:52AM -0800, Dmitry Torokhov wrote:
> 
> > I think it is helps if you think about devm_regulator_enable and regular
> > regulator_enable as managed and unmanaged *actions*, not resources. So
> 
> That's how I see them but it's still not really helping my concern, in
> general if you do a thing with devm_ you don't want to also be
> interacting with the same resource in the same way with a non-managed
> call.

It really depends on how you structure your API. For input, for example,
I only provide devm_input_alloc_device() and I made the rest of the
functions handle both managed and unmanaged input devices and they
internally sort it all out between themselves.

But that is what I meant here about managed action. You are not
interacting with managed regulator here, you have managed enable. There
is absolutely nothing preventing you from calling
devm_regulator_enable() on a regulator that was obtained with
regulator_get() (i.e. non-managed).

> 
> > managed action of enabling regulator will be undone on remove() and you
> > have to manually undo unmanaged regulator_disable() on resume(). It is
> > not worse than having unbalanced regulator_enable/disable between
> > probe()/suspend()/resume()/remove().
> 
> I find it that bit harder to think about - tracking balancing of the
> same thing is a lot easier than tracking balancing of two different not
> quite equivalent things.

Hmm... so what do we do (because I think this devm API is quite useful
for cleaning up probe and remove in many drivers)? Do you want it to
operate on a separate counter which we can check against underflow
separately from classic regulator_enable() and regulator_disable()?
Not sure if this will buy us much though and it will make bulk code
uglier...

Thanks.

-- 
Dmitry

Powered by blists - more mailing lists