Commit 05f084d2 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge branches 'pm-core' and 'pm-runtime'

Merge runtime PM framework updates and a core power management code fix
for 6.18-rc1:

 - Make pm_runtime_put*() family of functions return 1 when the
   given device is already suspended which is consistent with the
   documentation (Brian Norris)

 - Add basic kunit tests for runtime PM API contracts and update return
   values in kerneldoc coments for the runtime PM API (Brian Norris,
   Dan Carpenter)

 - Add auto-cleanup macros for runtime PM "resume and get" and "get
   without resume" operations, use one of them in the PCI core and
   drop the existing "free" macro introduced for similar purpose, but
   somewhat cumbersome to use (Rafael Wysocki)

 - Make the core power management code avoid waiting on device links
   marked as SYNC_STATE_ONLY which is consistent with the handling of
   those device links elsewhere (Pin-yen Lin)

* pm-core:
  PM: sleep: Do not wait on SYNC_STATE_ONLY device links

* pm-runtime:
  PM: runtime: Fix error checking for kunit_device_register()
  PM: runtime: Introduce one more usage counter guard
  PM: runtime: Drop DEFINE_FREE() for pm_runtime_put()
  PCI/sysfs: Use runtime PM guard macro for auto-cleanup
  PM: runtime: Add auto-cleanup macros for "resume and get" operations
  PM: runtime: Update kerneldoc return codes
  PM: runtime: Make put{,_sync}() return 1 when already suspended
  PM: runtime: Add basic kunit tests for API contracts
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -167,6 +167,12 @@ config PM_QOS_KUNIT_TEST
	depends on KUNIT=y
	default KUNIT_ALL_TESTS

config PM_RUNTIME_KUNIT_TEST
	tristate "KUnit Tests for runtime PM" if !KUNIT_ALL_TESTS
	depends on KUNIT
	depends on PM
	default KUNIT_ALL_TESTS

config HMEM_REPORTING
	bool
	default n
+1 −0
Original line number Diff line number Diff line
@@ -248,6 +248,7 @@ void device_links_driver_cleanup(struct device *dev);
void device_links_no_driver(struct device *dev);
bool device_links_busy(struct device *dev);
void device_links_unbind_consumers(struct device *dev);
bool device_link_flag_is_sync_state_only(u32 flags);
void fw_devlink_drivers_done(void);
void fw_devlink_probing_done(void);

+1 −1
Original line number Diff line number Diff line
@@ -287,7 +287,7 @@ static bool device_is_ancestor(struct device *dev, struct device *target)
#define DL_MARKER_FLAGS		(DL_FLAG_INFERRED | \
				 DL_FLAG_CYCLE | \
				 DL_FLAG_MANAGED)
static inline bool device_link_flag_is_sync_state_only(u32 flags)
bool device_link_flag_is_sync_state_only(u32 flags)
{
	return (flags & ~DL_MARKER_FLAGS) == DL_FLAG_SYNC_STATE_ONLY;
}
+1 −0
Original line number Diff line number Diff line
@@ -4,5 +4,6 @@ obj-$(CONFIG_PM_SLEEP) += main.o wakeup.o wakeup_stats.o
obj-$(CONFIG_PM_TRACE_RTC)	+= trace.o
obj-$(CONFIG_HAVE_CLK)	+= clock_ops.o
obj-$(CONFIG_PM_QOS_KUNIT_TEST) += qos-test.o
obj-$(CONFIG_PM_RUNTIME_KUNIT_TEST) += runtime-test.o

ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG
+4 −2
Original line number Diff line number Diff line
@@ -278,7 +278,8 @@ static void dpm_wait_for_suppliers(struct device *dev, bool async)
	 * walking.
	 */
	dev_for_each_link_to_supplier(link, dev)
		if (READ_ONCE(link->status) != DL_STATE_DORMANT)
		if (READ_ONCE(link->status) != DL_STATE_DORMANT &&
		    !device_link_flag_is_sync_state_only(link->flags))
			dpm_wait(link->supplier, async);

	device_links_read_unlock(idx);
@@ -335,7 +336,8 @@ static void dpm_wait_for_consumers(struct device *dev, bool async)
	 * unregistration).
	 */
	dev_for_each_link_to_consumer(link, dev)
		if (READ_ONCE(link->status) != DL_STATE_DORMANT)
		if (READ_ONCE(link->status) != DL_STATE_DORMANT &&
		    !device_link_flag_is_sync_state_only(link->flags))
			dpm_wait(link->consumer, async);

	device_links_read_unlock(idx);
Loading