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  linux-cve-announce  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]
Message-ID: <e8900490-1eec-83d8-b190-6d6983d81c4a@gmail.com>
Date:   Wed, 10 Aug 2022 15:19:05 +0300
From:   Matti Vaittinen <mazziesaccount@...il.com>
To:     Mark Brown <broonie@...nel.org>
Cc:     matti.vaittinen@...rohmeurope.com,
        Liam Girdwood <lgirdwood@...il.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 2/7] regulator: Add devm helpers for get and enable

Hi deee Ho Mark,

Long time no chat. Glad that you had the time to check this series :)

On 8/10/22 14:56, Mark Brown wrote:
> On Wed, Aug 10, 2022 at 02:29:55PM +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()
> 
> I'm really not keen on the idea of a devm managed enable, it's too prone
> to bugs when someone gets round to implementing runtime PM.

I see. And I agree the devm-based regulator disable can cause problems 
when combined with manual disable/enable.

In order to tackle the issue the suggested API does not return handle to 
the regulators - it really just provides the "get'n enable, then forget" 
solution. The consumers who use the suggested API to "devm get'n enable" 
will have had time manually controlling the regulator afterwards as they 
will not get the handle. I would almost claim that the pattern we 
nowadays see (devm_get, enable, add_action_or_reset(disable())) is more 
error prone as users seem to in many case be storing the regulator 
handle w/o any comment about the automated disable at detach.

-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~

Discuss - Estimate - Plan - Report and finally accomplish this:
void do_work(int time) __attribute__ ((const));

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ