mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iio: accel: kxcjk-1013: disable autosuspend on remove
@ 2026-09-14 11:20 Guangshuo Li
  2026-09-14 12:49 ` Joshua Crofts
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Guangshuo Li @ 2026-09-14 11:20 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá,
	Andy Shevchenko, Uwe Kleine-König (The Capable Hub),
	Siratul Islam, Matti Vaittinen, Danilo Krummrich, Guangshuo Li,
	Srinivas Pandruvada, linux-iio, linux-kernel
  Cc: stable

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);
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] iio: accel: kxcjk-1013: disable autosuspend on remove
  2026-09-14 11:20 [PATCH] iio: accel: kxcjk-1013: disable autosuspend on remove 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
  2 siblings, 1 reply; 5+ messages in thread
From: Joshua Crofts @ 2026-09-14 12:49 UTC (permalink / raw)
  To: Guangshuo Li
  Cc: Jonathan Cameron, David Lechner, Nuno Sá,
	Andy Shevchenko, Uwe Kleine-König (The Capable Hub),
	Siratul Islam, Matti Vaittinen, Danilo Krummrich,
	Srinivas Pandruvada, linux-iio, linux-kernel, stable

On Mon, 14 Sep 2026 19:20:53 +0800
Guangshuo Li <lgs201920130244@gmail.com> wrote:

...

> Add the missing pm_runtime_dont_use_autosuspend() call to the remove
> path.
>
> This issue was found by manual code inspection.
>

I'm on the fence whether this sentence should go under the ---
 
...

> @@ -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);
>  

It would've been better if you sent the 4 patches as a series with a cover
letter as all of them are the same fix.

Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>

-- 
Kind regards,
Joshua Crofts

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] iio: accel: kxcjk-1013: disable autosuspend on remove
  2026-09-14 11:20 [PATCH] iio: accel: kxcjk-1013: disable autosuspend on remove Guangshuo Li
  2026-09-14 12:49 ` Joshua Crofts
@ 2026-09-14 15:42 ` srinivas pandruvada
  2026-09-17  5:04 ` Matti Vaittinen
  2 siblings, 0 replies; 5+ messages in thread
From: srinivas pandruvada @ 2026-09-14 15:42 UTC (permalink / raw)
  To: Guangshuo Li, Jonathan Cameron, David Lechner, Nuno Sá,
	Andy Shevchenko, Uwe Kleine-König (The Capable Hub),
	Siratul Islam, Matti Vaittinen, Danilo Krummrich, linux-iio,
	linux-kernel
  Cc: stable

I generally prefer the first letter after ":" is a capital letter.
That was the case in this driver then some other changes didn't follow
this convention.

If you happen to re-post, fix that.

On Mon, 2026-09-14 at 19:20 +0800, 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>

 Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.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);
>  

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] iio: accel: kxcjk-1013: disable autosuspend on remove
  2026-09-14 12:49 ` Joshua Crofts
@ 2026-09-17  3:05   ` Jonathan Cameron
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2026-09-17  3:05 UTC (permalink / raw)
  To: Joshua Crofts
  Cc: Guangshuo Li, David Lechner, Nuno Sá,
	Andy Shevchenko, Uwe Kleine-König (The Capable Hub),
	Siratul Islam, Matti Vaittinen, Danilo Krummrich,
	Srinivas Pandruvada, linux-iio, linux-kernel, stable

On Mon, 14 Sep 2026 14:49:20 +0200
Joshua Crofts <joshua.crofts1@gmail.com> wrote:

> On Mon, 14 Sep 2026 19:20:53 +0800
> Guangshuo Li <lgs201920130244@gmail.com> wrote:
> 
> ...
> 
> > Add the missing pm_runtime_dont_use_autosuspend() call to the remove
> > path.
> >
> > This issue was found by manual code inspection.
> >  
> 
> I'm on the fence whether this sentence should go under the ---
In this world of LLMs I'm going to stick up for human effort and
keep that in the commit message :)

Either would have been fine with me.

I'm not going to rush this one in, so applied to the testing branch of
iio.git

Thanks,

Jonathan

>  
> ...
> 
> > @@ -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);
> >    
> 
> It would've been better if you sent the 4 patches as a series with a cover
> letter as all of them are the same fix.
> 
> Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] iio: accel: kxcjk-1013: disable autosuspend on remove
  2026-09-14 11:20 [PATCH] iio: accel: kxcjk-1013: disable autosuspend on remove Guangshuo Li
  2026-09-14 12:49 ` Joshua Crofts
  2026-09-14 15:42 ` srinivas pandruvada
@ 2026-09-17  5:04 ` Matti Vaittinen
  2 siblings, 0 replies; 5+ messages in thread
From: Matti Vaittinen @ 2026-09-17  5:04 UTC (permalink / raw)
  To: Guangshuo Li, Jonathan Cameron, David Lechner, Nuno Sá,
	Andy Shevchenko, Uwe Kleine-König (The Capable Hub),
	Siratul Islam, Danilo Krummrich, Srinivas Pandruvada, linux-iio,
	linux-kernel
  Cc: stable

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! ~~

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-17  5:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-14 11:20 [PATCH] iio: accel: kxcjk-1013: disable autosuspend on remove 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 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®