FAILED: patch "[PATCH] iio: imu: inv_icm42600: Simplify pm_runtime setup" failed to apply to 6.12-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x 0792c1984a45ccd7a296d6b8cb78088bc99a212e
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025101601-manicure-opposite-4330@gregkh' --subject-prefix 'PATCH 6.12.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 0792c1984a45ccd7a296d6b8cb78088bc99a212e Mon Sep 17 00:00:00 2001
From: Sean Nyekjaer <[email protected]>
Date: Mon, 1 Sep 2025 09:49:13 +0200
Subject: [PATCH] iio: imu: inv_icm42600: Simplify pm_runtime setup
Rework the power management in inv_icm42600_core_probe() to use devm_pm_runtime_set_active_enabled(), which simplifies the runtime PM setup by handling activation and enabling in one step. Remove the separate inv_icm42600_disable_pm callback, as it's no longer needed with the devm-managed approach.
Using devm_pm_runtime_enable() also fixes the missing disable of autosuspend.
Update inv_icm42600_disable_vddio_reg() to only disable the regulator if the device is not suspended i.e. powered-down, preventing unbalanced disables.
Also remove redundant error msg on regulator_disable(), the regulator framework already emits an error message when regulator_disable() fails.
This simplifies the PM setup and avoids manipulating the usage counter unnecessarily.
drivers/iio/imu/inv_icm42600/inv_icm42600_core.c +7 -17
@@ -711,20 +711,12 @@ static void inv_icm42600_disable_vdd_reg(void *_data)static void inv_icm42600_disable_vddio_reg (void *_data) {struct inv_icm42600_state *st = _data; -const struct device *dev =regmap_get_device (st->map); -int ret; +struct device *dev =regmap_get_device (st->map); - ret =regulator_disable (st->vddio_supply); -if (ret) -dev_err (dev,"failed to disable vddio error %d\n" , ret); -} +if (pm_runtime_status_suspended (dev)) +return ; -static void inv_icm42600_disable_pm (void *_data) -{ -struct device *dev = _data; - -pm_runtime_put_sync (dev); -pm_runtime_disable (dev); +regulator_disable (st->vddio_supply); } int inv_icm42600_core_probe(struct regmap *regmap, int chip,
@@ -824,16 +816,14 @@ int inv_icm42600_core_probe(struct regmap *regmap, int chip,return ret;/* setup runtime power management */ - ret =pm_runtime_set_active (dev); + ret =devm_pm_runtime_set_active_enabled (dev);if (ret)return ret; -pm_runtime_get_noresume (dev); -pm_runtime_enable (dev); +pm_runtime_set_autosuspend_delay (dev,INV_ICM42600_SUSPEND_DELAY_MS );pm_runtime_use_autosuspend (dev); -pm_runtime_put (dev); -return devm_add_action_or_reset (dev, inv_icm42600_disable_pm, dev); +return ret; }EXPORT_SYMBOL_NS_GPL (inv_icm42600_core_probe,"IIO_ICM42600" );
Sasha Levin
maintainerPATCH 1/2 PM: runtime: Add new devm functions
From: Bence Csókás <[email protected]>
[ Upstream commit 73db799bf5efc5a04654bb3ff6c9bf63a0dfa473 ]
Add devm_pm_runtime_set_active_enabled() anddevm_pm_runtime_get_noresume() for simplifying
common cases in drivers.
Stable-dep-of: 0792c1984a45 ("iio: imu: inv_icm42600: Simplify pm_runtime setup")
--- drivers/base/power/runtime.c | 44 ++++++++++++++++++++++++++++++++++++ include/linux/pm_runtime.h | 4 ++++ 2 files changed, 48 insertions(+)
drivers/base/power/runtime.c +44 -0
@@ -1554,6 +1554,32 @@ void pm_runtime_enable(struct device *dev) }EXPORT_SYMBOL_GPL (pm_runtime_enable); +static void pm_runtime_set_suspended_action (void *data) +{ +pm_runtime_set_suspended (data); +} + +/** +* devm_pm_runtime_set_active_enabled - set_active version of devm_pm_runtime_enable. +* +* @dev: Device to handle. +*/ +int devm_pm_runtime_set_active_enabled (struct device *dev) +{ +int err; + + err =pm_runtime_set_active (dev); +if (err) +return err; + + err =devm_add_action_or_reset (dev, pm_runtime_set_suspended_action, dev); +if (err) +return err; + +return devm_pm_runtime_enable (dev); +} +EXPORT_SYMBOL_GPL (devm_pm_runtime_set_active_enabled); +static void pm_runtime_disable_action (void *data) {pm_runtime_dont_use_autosuspend (data);
@@ -1576,6 +1602,24 @@ int devm_pm_runtime_enable(struct device *dev) }EXPORT_SYMBOL_GPL (devm_pm_runtime_enable); +static void pm_runtime_put_noidle_action (void *data) +{ +pm_runtime_put_noidle (data); +} + +/** +* devm_pm_runtime_get_noresume - devres-enabled version of pm_runtime_get_noresume. +* +* @dev: Device to handle. +*/ +int devm_pm_runtime_get_noresume (struct device *dev) +{ +pm_runtime_get_noresume (dev); + +return devm_add_action_or_reset (dev, pm_runtime_put_noidle_action, dev); +} +EXPORT_SYMBOL_GPL (devm_pm_runtime_get_noresume); +/** * pm_runtime_forbid - Block runtime PM of a device. * @dev: Device to handle.
include/linux/pm_runtime.h +4 -0
@@ -94,7 +94,9 @@ extern void pm_runtime_new_link(struct device *dev);extern void pm_runtime_drop_link (struct device_link *link);extern void pm_runtime_release_supplier (struct device_link *link); +int devm_pm_runtime_set_active_enabled (struct device *dev);extern int devm_pm_runtime_enable (struct device *dev); +int devm_pm_runtime_get_noresume (struct device *dev);/** * pm_suspend_ignore_children - Set runtime PM behavior regarding children.
@@ -278,7 +280,9 @@ static inline void __pm_runtime_disable(struct device *dev, bool c) {}static inline void pm_runtime_allow (struct device *dev) {}static inline void pm_runtime_forbid (struct device *dev) {} +static inline int devm_pm_runtime_set_active_enabled (struct device *dev) {return 0 ; }static inline int devm_pm_runtime_enable (struct device *dev) {return 0 ; } +static inline int devm_pm_runtime_get_noresume (struct device *dev) {return 0 ; }static inline void pm_suspend_ignore_children (struct device *dev,bool enable) {}static inline void pm_runtime_get_noresume (struct device *dev) {}
Signature · 1 line
2.51.0
Sasha Levin
maintainerPATCH 2/2 iio: imu: inv_icm42600: Simplify pm_runtime setup
From: Sean Nyekjaer <[email protected]>
[ Upstream commit 0792c1984a45ccd7a296d6b8cb78088bc99a212e ]
Rework the power management in inv_icm42600_core_probe() to use devm_pm_runtime_set_active_enabled(), which simplifies the runtime PM setup by handling activation and enabling in one step. Remove the separate inv_icm42600_disable_pm callback, as it's no longer needed with the devm-managed approach.
Using devm_pm_runtime_enable() also fixes the missing disable of autosuspend.
Update inv_icm42600_disable_vddio_reg() to only disable the regulator if the device is not suspended i.e. powered-down, preventing unbalanced disables.
Also remove redundant error msg on regulator_disable(), the regulator framework already emits an error message when regulator_disable() fails.
This simplifies the PM setup and avoids manipulating the usage counter unnecessarily.
--- .../iio/imu/inv_icm42600/inv_icm42600_core.c | 24 ++++++------------- 1 file changed, 7 insertions(+), 17 deletions(-)
drivers/iio/imu/inv_icm42600/inv_icm42600_core.c +7 -17
@@ -667,20 +667,12 @@ static void inv_icm42600_disable_vdd_reg(void *_data)static void inv_icm42600_disable_vddio_reg (void *_data) {struct inv_icm42600_state *st = _data; -const struct device *dev =regmap_get_device (st->map); -int ret; - - ret =regulator_disable (st->vddio_supply); -if (ret) -dev_err (dev,"failed to disable vddio error %d\n" , ret); -} +struct device *dev =regmap_get_device (st->map); -static void inv_icm42600_disable_pm (void *_data) -{ -struct device *dev = _data; +if (pm_runtime_status_suspended (dev)) +return ; -pm_runtime_put_sync (dev); -pm_runtime_disable (dev); +regulator_disable (st->vddio_supply); } int inv_icm42600_core_probe(struct regmap *regmap, int chip, int irq,
@@ -777,16 +769,14 @@ int inv_icm42600_core_probe(struct regmap *regmap, int chip, int irq,return ret;/* setup runtime power management */ - ret =pm_runtime_set_active (dev); + ret =devm_pm_runtime_set_active_enabled (dev);if (ret)return ret; -pm_runtime_get_noresume (dev); -pm_runtime_enable (dev); +pm_runtime_set_autosuspend_delay (dev,INV_ICM42600_SUSPEND_DELAY_MS );pm_runtime_use_autosuspend (dev); -pm_runtime_put (dev); -return devm_add_action_or_reset (dev, inv_icm42600_disable_pm, dev); +return ret; }EXPORT_SYMBOL_NS_GPL (inv_icm42600_core_probe,IIO_ICM42600 );
Signature · 1 line
2.51.0