[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87bc192e-45ae-9480-5e84-8fe0adfc12e7@metafoo.de>
Date: Thu, 2 Mar 2023 05:16:54 -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/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/
Powered by blists - more mailing lists