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: <b635b91e-1dcc-71ba-95d1-1f87a20dbaf2@metafoo.de>
Date:   Thu, 2 Mar 2023 05:20:38 -0800
From:   Lars-Peter Clausen <lars@...afoo.de>
To:     Mike Looijmans <mike.looijmans@...ic.nl>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     devicetree@...r.kernel.org, linux-iio@...r.kernel.org,
        Caleb Connolly <caleb.connolly@...aro.org>,
        ChiYuan Huang <cy_huang@...htek.com>,
        ChiaEn Wu <chiaen_wu@...htek.com>,
        Cosmin Tanislav <demonsingur@...il.com>,
        Ibrahim Tilki <Ibrahim.Tilki@...log.com>,
        Jonathan Cameron <jic23@...nel.org>,
        Ramona Bolboaca <ramona.bolboaca@...log.com>,
        William Breathitt Gray <william.gray@...aro.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/2] iio: adc: Add TI ADS1100 and ADS1000

On 3/2/23 05:16, Lars-Peter Clausen wrote:
> On 3/1/23 23:49, Mike Looijmans wrote:
>>
>>
>>> ...
>>> ...
>>>
>>>> +static int ads1100_runtime_suspend(struct device *dev)
>>>> +{
>>>> +    struct iio_dev *indio_dev = 
>>>> i2c_get_clientdata(to_i2c_client(dev));
>>>> +    struct ads1100_data *data = iio_priv(indio_dev);
>>>> +
>>>> +    ads1100_set_config_bits(data, ADS1100_CFG_SC, 
>>>> ADS1100_SINGLESHOT);
>>>> +    regulator_disable(data->reg_vdd);
>>> Wrong devm / non-devm ordering.
>>
>> Don't understand your remark, can you explain further please?
>>
>> devm / non-devm ordering would be related to the "probe" function. As 
>> far as I can tell, I'm not allocating resources after the devm calls. 
>> And the "remove" is empty.
>
> Strictly speaking we need to unregister the IIO device before 
> disabling the regulator, otherwise there is a small window where the 
> IIO device still exists, but doesn't work anymore. This is a very 
> theoretical scenario though.
>
> You are lucky :) There is a new function 
> `devm_regulator_get_enable()`[1], which will manage the 
> regulator_disable() for you. Using that will also reduce the 
> boilerplate in `probe()` a bit
>
> - Lars
>
> [1] https://lwn.net/Articles/904383/
>
Sorry, just saw that Andy's comment was on the suspend() function, not 
remove(). In that case there is of course no need for any devm things. 
But still a good idea to use `devm_regulator_get_enable()` in probe for 
the boiler plate.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ