Re: [PATCH v6 6/9] iio: accel: mma8452: Reuse existing dev pointer in mma8452_probe()

Esben Haabendal <[email protected]>
Newsgroups org.kernel.vger.linux-iio,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
"Andy Shevchenko" <[email protected]> writes:

> On Tue, Aug 25, 2026 at 10:27:44AM +0200, Esben Haabendal wrote:
>> In commit 32a5c04d4575 ("iio: accel: mma8452: Use dev_err_probe()") the
>> struct device * pointer was assigned to local variable dev, so we can just
>> as well reuse that throughout the function for sligthly more readable code.
>
> ...
>
>>  static int mma8452_runtime_suspend(struct device *dev)
>>  {
>> -	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
>> +	struct i2c_client *client = to_i2c_client(dev);
>> +	struct iio_dev *indio_dev = i2c_get_clientdata(client);
>
> This change is unrelated and should be as simple as
>
> 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
>
> OTOH, this might require the full device.h to be included...
> Either way, it's not for this patch.

It is dropped for next version.

>>  	struct mma8452_data *data = iio_priv(indio_dev);
>>  	int ret;
>
>>  	ret = mma8452_standby(data);
>>  	mutex_unlock(&data->lock);
>>  	if (ret < 0) {
>> -		dev_err(&data->client->dev, "powering off device failed\n");
>> +		dev_err(&client->dev, "powering off device failed\n");
>>  		return -EAGAIN;
>>  	}
>
> Why? Just use given 'dev' as is.

Next version :)

/Esben
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.