mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: "Guangshuo Li" <lgs201920130244@gmail.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Uwe Kleine-König (The Capable Hub)"
	<u.kleine-koenig@baylibre.com>, "Siratul Islam" <email@sirat.me>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Srinivas Pandruvada" <srinivas.pandruvada@linux.intel.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: Re: [PATCH] iio: accel: kxcjk-1013: disable autosuspend on remove
Date: Thu, 17 Sep 2026 08:04:12 +0300	[thread overview]
Message-ID: <43bdf1d5-bd82-496b-8408-871646fe59d4@gmail.com> (raw)
In-Reply-To: <20260914112053.1686061-1-lgs201920130244@gmail.com>

On 14/09/2026 14:20, Guangshuo Li wrote:
> kxcjk1013_probe() enables runtime PM autosuspend with
> pm_runtime_use_autosuspend(). The probe error path correctly undoes
> this setting with pm_runtime_dont_use_autosuspend(), but the normal
> remove path only disables runtime PM.
> 
> The runtime PM API requires pm_runtime_use_autosuspend() to be undone
> with pm_runtime_dont_use_autosuspend() at driver exit unless runtime PM
> was enabled with devm_pm_runtime_enable(). Leaving the autosuspend flag
> set therefore leaves the runtime PM state incompletely cleaned up after
> the driver is unbound.
> 
> Add the missing pm_runtime_dont_use_autosuspend() call to the remove
> path.
> 
> This issue was found by manual code inspection.
> 
> Fixes: 124e1b1d0924 ("iio: accel: kxcjk-1013: support runtime pm")
> Cc: stable@vger.kernel.org
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> ---
>   drivers/iio/accel/kxcjk-1013.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
> index 166fb786425f..c6b030f64be1 100644
> --- a/drivers/iio/accel/kxcjk-1013.c
> +++ b/drivers/iio/accel/kxcjk-1013.c
> @@ -1547,6 +1547,7 @@ static void kxcjk1013_remove(struct i2c_client *client)
>   
>   	iio_device_unregister(indio_dev);
>   
> +	pm_runtime_dont_use_autosuspend(&client->dev);
>   	pm_runtime_disable(&client->dev);
>   	pm_runtime_set_suspended(&client->dev);
>   

I am not sure if it matters, but it bugs me a bit to see that the 
clean-up path for PM here, and clean-up path at probe error, do still 
not have same steps. As far as I see the probe error path omits the 
pm_runtime_set_suspended(). Do you think this should/could be fixed?

Oh, and if it is fine as it is - I would really appreciate education as 
to why :)

Other than that:

Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>

(I know I am late with the tag as Jonathan applied this already - I 
suppose it's still Ok to say I am "Ok" with the fix :] )

Yours,
	-- Matti

-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~

      parent reply	other threads:[~2026-09-17  5:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14 11:20 Guangshuo Li
2026-09-14 12:49 ` Joshua Crofts
2026-09-17  3:05   ` Jonathan Cameron
2026-09-14 15:42 ` srinivas pandruvada
2026-09-17  5:04 ` Matti Vaittinen [this message]

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=43bdf1d5-bd82-496b-8408-871646fe59d4@gmail.com \
    --to=mazziesaccount@gmail.com \
    --cc=andy@kernel.org \
    --cc=dakr@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=email@sirat.me \
    --cc=jic23@kernel.org \
    --cc=lgs201920130244@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=stable@vger.kernel.org \
    --cc=u.kleine-koenig@baylibre.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

all inboxes | Powered by JetHome®