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

From: Andrey Skvortsov

Date: Fri Jun 05 2026 - 05:12:12 EST


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@xxxxxxxxx>
---

Changes in v4:
- update commit message to address Andy's comment
about functions, callbacks and runtime PM names

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 8c8b4f9a8ff63..6fd35ea5daabb 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)
{
@@ -2023,13 +2016,12 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,

/* chip init is done, turning on runtime power management */
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