[PATCH v3 2/3] iio: imu: inv_mpu6050: use devres-enabled version of pm_runtime_enable

Andrey Skvortsov
2026-04-26T11:24:48Z

Usage of devm_pm_runtime_enable allows to remove driver-specific
action, that does the same as default action.

Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
---

Changes in v3:
- remove extra blank lines in "use devres-enabled version of pm_runtime_enable"

drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index 49fdf33adec99..fc786aaeac5e5 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -1874,13 +1874,6 @@ static void inv_mpu_core_disable_regulator_action(void *_data)
inv_mpu_core_disable_regulator_vddio(st);
}

-static void inv_mpu_pm_disable(void *data)
-{
- struct device *dev = data;
-
- pm_runtime_disable(dev);
-}
-
int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,
int (*inv_mpu_bus_setup)(struct iio_dev *), int chip_type)
{
@@ -2019,13 +2012,12 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,
return dev_err_probe(dev, result,
"Failed to setup regulator cleanup action\n");
pm_runtime_get_noresume(dev);
- pm_runtime_enable(dev);
+ result = devm_pm_runtime_enable(dev);
+ if (result)
+ return result;
pm_runtime_set_autosuspend_delay(dev, INV_MPU6050_SUSPEND_DELAY_MS);
pm_runtime_use_autosuspend(dev);
pm_runtime_put(dev);
- result = devm_add_action_or_reset(dev, inv_mpu_pm_disable, dev);
- if (result)
- return result;

switch (chip_type) {
case INV_MPU6000:
--
2.53.0