More power management updates for 6.19-rc1

Fix a runtime PM unit test added during the 6.18 development cycle and
 change the pm_runtime_barrier() return type to void (Brian Norris).
 -----BEGIN PGP SIGNATURE-----
 
 iQFGBAABCAAwFiEEcM8Aw/RY0dgsiRUR7l+9nS/U47UFAmk4BQ8SHHJqd0Byand5
 c29ja2kubmV0AAoJEO5fvZ0v1OO1sSwIAIBNY60EiGNHIVg4dyCbK/sVai66yJ1h
 Sj4cxfbQxCXBC6qWu8R2NBzDbXAgdsixLwaQcNn2ekhLwh1UzqFe2DWPSAsiIvoV
 FxE6fCJO5KzeTY2pIjiXfFdFsFsPwQkbqO2nwXBfoDz8HZolLnZGmRGWIqxAJ4LM
 kw9oefOhnD4VLd2Ce9pgbovZF/X+znKH5+9CgY+bD98NCcwlmOouz3vCXMYwJzn2
 F+/YJdNaLjtH4bGsojlknvOtnu3ZyM2bD4TzzJjOAe2gv+7yIA/Cv1rlnu0XffhB
 AQ8l3JBF4erIJ9lwmsRZpebchWYnq8VVbj1Fe+xh9CQdnIfnom2ZVik=
 =J7Q0
 -----END PGP SIGNATURE-----

Merge tag 'pm-6.19-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull more power management updates from Rafael Wysocki:
 "Fix a runtime PM unit test added during the 6.18 development cycle and
  change the pm_runtime_barrier() return type to void (Brian Norris)"

* tag 'pm-6.19-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  coccinelle: Drop pm_runtime_barrier() error code checks
  PM: runtime: Make pm_runtime_barrier() return void
  PM: runtime: Stop checking pm_runtime_barrier() return code
pull/1354/merge
Linus Torvalds 2025-12-10 06:29:40 +09:00
commit 9f20d9bad5
5 changed files with 8 additions and 25 deletions

View File

@ -443,13 +443,11 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h:
necessary to execute the subsystem-level resume callback for the device necessary to execute the subsystem-level resume callback for the device
to satisfy that request, otherwise 0 is returned to satisfy that request, otherwise 0 is returned
`int pm_runtime_barrier(struct device *dev);` `void pm_runtime_barrier(struct device *dev);`
- check if there's a resume request pending for the device and resume it - check if there's a resume request pending for the device and resume it
(synchronously) in that case, cancel any other pending runtime PM requests (synchronously) in that case, cancel any other pending runtime PM requests
regarding it and wait for all runtime PM operations on it in progress to regarding it and wait for all runtime PM operations on it in progress to
complete; returns 1 if there was a resume request pending and it was complete
necessary to execute the subsystem-level resume callback for the device to
satisfy that request, otherwise 0 is returned
`void pm_suspend_ignore_children(struct device *dev, bool enable);` `void pm_suspend_ignore_children(struct device *dev, bool enable);`
- set/unset the power.ignore_children flag of the device - set/unset the power.ignore_children flag of the device

View File

@ -37,10 +37,6 @@ static void pm_runtime_already_suspended_test(struct kunit *test)
pm_runtime_enable(dev); pm_runtime_enable(dev);
KUNIT_EXPECT_TRUE(test, pm_runtime_suspended(dev)); KUNIT_EXPECT_TRUE(test, pm_runtime_suspended(dev));
pm_runtime_get_noresume(dev);
KUNIT_EXPECT_EQ(test, 0, pm_runtime_barrier(dev)); /* no wakeup needed */
pm_runtime_put(dev);
pm_runtime_get_noresume(dev); pm_runtime_get_noresume(dev);
KUNIT_EXPECT_EQ(test, 1, pm_runtime_put_sync(dev)); KUNIT_EXPECT_EQ(test, 1, pm_runtime_put_sync(dev));
@ -174,7 +170,7 @@ static void pm_runtime_error_test(struct kunit *test)
KUNIT_EXPECT_TRUE(test, pm_runtime_suspended(dev)); KUNIT_EXPECT_TRUE(test, pm_runtime_suspended(dev));
KUNIT_EXPECT_EQ(test, 0, pm_runtime_get(dev)); KUNIT_EXPECT_EQ(test, 0, pm_runtime_get(dev));
KUNIT_EXPECT_EQ(test, 1, pm_runtime_barrier(dev)); /* resume was pending */ pm_runtime_barrier(dev);
pm_runtime_put(dev); pm_runtime_put(dev);
pm_runtime_suspend(dev); /* flush the put(), to suspend */ pm_runtime_suspend(dev); /* flush the put(), to suspend */
KUNIT_EXPECT_TRUE(test, pm_runtime_suspended(dev)); KUNIT_EXPECT_TRUE(test, pm_runtime_suspended(dev));
@ -225,7 +221,7 @@ static void pm_runtime_probe_active_test(struct kunit *test)
KUNIT_EXPECT_TRUE(test, pm_runtime_active(dev)); KUNIT_EXPECT_TRUE(test, pm_runtime_active(dev));
/* Nothing to flush. We stay active. */ /* Nothing to flush. We stay active. */
KUNIT_EXPECT_EQ(test, 0, pm_runtime_barrier(dev)); pm_runtime_barrier(dev);
KUNIT_EXPECT_TRUE(test, pm_runtime_active(dev)); KUNIT_EXPECT_TRUE(test, pm_runtime_active(dev));
/* Ask for idle? Now we suspend. */ /* Ask for idle? Now we suspend. */

View File

@ -1467,30 +1467,20 @@ static void __pm_runtime_barrier(struct device *dev)
* Next, make sure that all pending requests for the device have been flushed * Next, make sure that all pending requests for the device have been flushed
* from pm_wq and wait for all runtime PM operations involving the device in * from pm_wq and wait for all runtime PM operations involving the device in
* progress to complete. * progress to complete.
*
* Return value:
* 1, if there was a resume request pending and the device had to be woken up,
* 0, otherwise
*/ */
int pm_runtime_barrier(struct device *dev) void pm_runtime_barrier(struct device *dev)
{ {
int retval = 0;
pm_runtime_get_noresume(dev); pm_runtime_get_noresume(dev);
spin_lock_irq(&dev->power.lock); spin_lock_irq(&dev->power.lock);
if (dev->power.request_pending if (dev->power.request_pending
&& dev->power.request == RPM_REQ_RESUME) { && dev->power.request == RPM_REQ_RESUME)
rpm_resume(dev, 0); rpm_resume(dev, 0);
retval = 1;
}
__pm_runtime_barrier(dev); __pm_runtime_barrier(dev);
spin_unlock_irq(&dev->power.lock); spin_unlock_irq(&dev->power.lock);
pm_runtime_put_noidle(dev); pm_runtime_put_noidle(dev);
return retval;
} }
EXPORT_SYMBOL_GPL(pm_runtime_barrier); EXPORT_SYMBOL_GPL(pm_runtime_barrier);

View File

@ -76,7 +76,7 @@ extern int pm_runtime_get_if_active(struct device *dev);
extern int pm_runtime_get_if_in_use(struct device *dev); extern int pm_runtime_get_if_in_use(struct device *dev);
extern int pm_schedule_suspend(struct device *dev, unsigned int delay); extern int pm_schedule_suspend(struct device *dev, unsigned int delay);
extern int __pm_runtime_set_status(struct device *dev, unsigned int status); extern int __pm_runtime_set_status(struct device *dev, unsigned int status);
extern int pm_runtime_barrier(struct device *dev); extern void pm_runtime_barrier(struct device *dev);
extern bool pm_runtime_block_if_disabled(struct device *dev); extern bool pm_runtime_block_if_disabled(struct device *dev);
extern void pm_runtime_unblock(struct device *dev); extern void pm_runtime_unblock(struct device *dev);
extern void pm_runtime_enable(struct device *dev); extern void pm_runtime_enable(struct device *dev);
@ -284,7 +284,7 @@ static inline int pm_runtime_get_if_active(struct device *dev)
} }
static inline int __pm_runtime_set_status(struct device *dev, static inline int __pm_runtime_set_status(struct device *dev,
unsigned int status) { return 0; } unsigned int status) { return 0; }
static inline int pm_runtime_barrier(struct device *dev) { return 0; } static inline void pm_runtime_barrier(struct device *dev) {}
static inline bool pm_runtime_block_if_disabled(struct device *dev) { return true; } static inline bool pm_runtime_block_if_disabled(struct device *dev) { return true; }
static inline void pm_runtime_unblock(struct device *dev) {} static inline void pm_runtime_unblock(struct device *dev) {}
static inline void pm_runtime_enable(struct device *dev) {} static inline void pm_runtime_enable(struct device *dev) {}

View File

@ -37,7 +37,6 @@ ret@p = \(pm_runtime_idle\|
pm_runtime_put_sync_autosuspend\| pm_runtime_put_sync_autosuspend\|
pm_runtime_set_active\| pm_runtime_set_active\|
pm_schedule_suspend\| pm_schedule_suspend\|
pm_runtime_barrier\|
pm_generic_runtime_suspend\| pm_generic_runtime_suspend\|
pm_generic_runtime_resume\)(...); pm_generic_runtime_resume\)(...);
... ...