Linux IIO development
 help / color / mirror / Atom feed
From: Esben Haabendal <esben@geanix.com>
To: "Andy Shevchenko" <andriy.shevchenko@intel.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Martin Kepplinger" <martink@posteo.de>,
	"Sean Nyekjaer" <sean@geanix.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Martin Kepplinger" <martin.kepplinger@theobroma-systems.com>,
	"Christoph Muellner" <christoph.muellner@theobroma-systems.com>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"Joshua Crofts" <joshua.crofts1@gmail.com>
Subject: Re: [PATCH v6 6/9] iio: accel: mma8452: Reuse existing dev pointer in mma8452_probe()
Date: Fri, 28 Aug 2026 08:20:25 +0200	[thread overview]
Message-ID: <87bjamzryu.fsf@geanix.com> (raw)
In-Reply-To: <ao6Vbm59IX1cl7tj@ashevche-desk.local> (Andy Shevchenko's message of "Wed, 26 Aug 2026 10:27:42 +0300")

"Andy Shevchenko" <andriy.shevchenko@intel.com> 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

  parent reply	other threads:[~2026-08-28  6:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25  8:27 [PATCH v6 0/9] io: accel: mma8452: Allow open drain interrupt pin configuration Esben Haabendal
2026-08-25  8:27 ` [PATCH v6 1/9] dt-bindings: iio: accel: mma8452: Add drive-open-drain Esben Haabendal
2026-08-25  8:27 ` [PATCH v6 2/9] iio: accel: mma8452: Optimize struct mma8452_data member orders Esben Haabendal
2026-08-25  8:27 ` [PATCH v6 3/9] iio: accel: mma8452: Only apply trigger type when not set by firmware Esben Haabendal
2026-08-25  8:27 ` [PATCH v6 4/9] iio: accel: mma8452: Support interrupt sharing Esben Haabendal
2026-08-25  8:27 ` [PATCH v6 5/9] iio: accel: mma8452: Allow open drain interrupt pin configuration Esben Haabendal
2026-08-25  8:27 ` [PATCH v6 6/9] iio: accel: mma8452: Reuse existing dev pointer in mma8452_probe() Esben Haabendal
     [not found]   ` <1lSq7y7LYcNpJGnkxSN5o1d9skFu9meHSq1iRHldMT9IJT8osgJ8U-ZkfcufpJRVR-2vXYISbJUQhkFo5QIHcg==@protonmail.internalid>
     [not found]     ` <ao6Vbm59IX1cl7tj@ashevche-desk.local>
2026-08-28  6:20       ` Esben Haabendal [this message]
2026-08-25  8:27 ` [PATCH v6 7/9] iio: accel: mma8452: Drop unneeded lock acquire on read Esben Haabendal
2026-08-25 10:17   ` Joshua Crofts
2026-08-25 13:35     ` Esben Haabendal
2026-08-25 13:44       ` Joshua Crofts
2026-08-25 14:06         ` Esben Haabendal
2026-08-28  6:29     ` Esben Haabendal
2026-08-25  8:27 ` [PATCH v6 8/9] iio: accel: mma8452: Fix use-after-free bug in error error path Esben Haabendal
2026-08-25  8:27 ` [PATCH v6 9/9] iio: accel: mma8452: Use proper error code when missing device model Esben Haabendal
2026-08-25 10:23   ` Joshua Crofts
2026-08-25 11:00     ` Esben Haabendal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bjamzryu.fsf@geanix.com \
    --to=esben@geanix.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=christoph.muellner@theobroma-systems.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=joshua.crofts1@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.kepplinger@theobroma-systems.com \
    --cc=martink@posteo.de \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    --cc=sean@geanix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox