Skip to contentSkip to conversation

iio: accel: mma9551: disable autosuspend on remove

PATCH In review Guangshuo Li 3 participants 3 messages Sep 14 – Sep 17

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: accel: mma9551: disable autosuspend on remove

mma9551_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 6da93a6710a3 ("iio: accel: mma9551: Add runtime pm support")
---
 drivers/iio/accel/mma9551.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/accel/mma9551.c +1 -0
index 7e01427fd9c4..182f488edab1 100644
@@ -500,6 +500,7 @@ static void mma9551_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);
 
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 28 lines · On Mon, 14 Sep 2026 19:24:47 +0800 Guangshuo Li <[email protected]>…

mma9551_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 6da93a6710a3 ("iio: accel: mma9551: Add runtime pm support")
---
 drivers/iio/accel/mma9551.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/accel/mma9551.c +0 -0
index 7e01427fd9c4..182f488edab1 100644

drivers/iio/accel/mma9551.c static void mma9551_remove(struct i2c_client *client) · line 506

Quoted 7 lines
drivers/iio/accel/mma9551.c +1 -0
@@ -500,6 +500,7 @@ static void mma9551_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);
 
Signature · 2 lines
Kind regards,
Joshua Crofts
maintainer
#2 lore raw
Quoted 32 lines · On Mon, 14 Sep 2026 14:50:21 +0200 Joshua Crofts <[email protected]>…
Quoted 29 lines · On Mon, 14 Sep 2026 19:24:47 +0800 Guangshuo Li <[email protected]>…

mma9551_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 6da93a6710a3 ("iio: accel: mma9551: Add runtime pm support")
---
 drivers/iio/accel/mma9551.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/accel/mma9551.c +0 -0
index 7e01427fd9c4..182f488edab1 100644
@@ -500,6 +500,7 @@ static void mma9551_remove(struct i2c_client *client)
 
Quoted 8 lines

drivers/iio/accel/mma9551.c static void mma9551_remove(struct i2c_client *client) · line 506

Quoted 6 lines
drivers/iio/accel/mma9551.c +1 -0
 	iio_device_unregister(indio_dev);
 
+	pm_runtime_dont_use_autosuspend(&client->dev);
 	pm_runtime_disable(&client->dev);
 	pm_runtime_set_suspended(&client->dev);
 

Applied thanks. Most of these drivers (maybe all) would benefit from a sprinkling of devm_ magic if anyone has time to do it!

Jonathan

Quoted 1 line