[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <57f725c8-beda-483e-b933-989c0eac5653@ixit.cz>
Date: Tue, 1 Apr 2025 18:36:27 +0200
From: David Heidelberg <david@...t.cz>
To: Jonathan Cameron <jic23@...nel.org>,
David Heidelberg via B4 Relay <devnull+david.ixit.cz@...nel.org>
Cc: Lars-Peter Clausen <lars@...afoo.de>,
Svyatoslav Ryhel <clamor95@...il.com>,
Robert Eckelmann <longnoserob@...il.com>, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 09/13] iio: light: al3010: Move
devm_add_action_or_reset back to _probe
On 30/03/2025 19:34, Jonathan Cameron wrote:
> On Wed, 19 Mar 2025 21:59:48 +0100
> David Heidelberg via B4 Relay <devnull+david.ixit.cz@...nel.org> wrote:
>
>> From: David Heidelberg <david@...t.cz>
>>
>> In a preparation to the regmap transition.
> I'm not following the reasoning for this patch.
>
> The setup action being unwound is done in _init()
> and if we happen to get an error on the write immediately after
> where it currently is, we no longer power down the device.
Good point, thank you.
In next series I kept the devm_add_action in place and moved it for
al3000a and a3320a to the right place.
David>
>
>
>>
>> Improve error handling using dev_err_probe().
>>
>> Signed-off-by: David Heidelberg <david@...t.cz>
>> ---
>> drivers/iio/light/al3010.c | 10 ++++------
>> 1 file changed, 4 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/iio/light/al3010.c b/drivers/iio/light/al3010.c
>> index 8c004a9239aef246a8c6f6c3f4acd6b760ee8249..8098c92c9572befe92d00ef0785ded5e1a08d587 100644
>> --- a/drivers/iio/light/al3010.c
>> +++ b/drivers/iio/light/al3010.c
>> @@ -89,12 +89,6 @@ static int al3010_init(struct al3010_data *data)
>> if (ret < 0)
>> return ret;
>>
>> - ret = devm_add_action_or_reset(&data->client->dev,
>> - al3010_set_pwr_off,
>> - data);
>> - if (ret < 0)
>> - return ret;
>> -
>> ret = i2c_smbus_write_byte_data(data->client, AL3010_REG_CONFIG,
>> FIELD_PREP(AL3010_GAIN_MASK,
>> AL3XXX_RANGE_3));
>> @@ -195,6 +189,10 @@ static int al3010_probe(struct i2c_client *client)
>> return ret;
>> }
>>
>> + ret = devm_add_action_or_reset(dev, al3010_set_pwr_off, data);
>> + if (ret)
>> + return dev_err_probe(dev, ret, "failed to add action\n");
>> +
>> return devm_iio_device_register(dev, indio_dev);
>> }
>>
>>
>
--
David Heidelberg
Powered by blists - more mailing lists