Skip to content

Commit 3f4b325

Browse files
pcercueirafaeljw
authored andcommitted
PM: core: Remove DEFINE_UNIVERSAL_DEV_PM_OPS() macro
The deprecated UNIVERSAL_DEV_PM_OPS() macro uses the provided callbacks for both runtime PM and system sleep, which is very likely to be a mistake, as a system sleep can be triggered while a given device is already PM-suspended, which would cause the suspend callback to be called twice. The amount of users of UNIVERSAL_DEV_PM_OPS() is also tiny (16 occurences) compared to the number of places where SET_SYSTEM_SLEEP_PM_OPS() is used with pm_runtime_force_suspend() and pm_runtime_force_resume(), which makes me think that none of these cases are actually valid. As the new macro DEFINE_UNIVERSAL_DEV_PM_OPS() which was introduced to replace UNIVERSAL_DEV_PM_OPS() is currently unused, remove it before someone starts to use it in yet another invalid case. Signed-off-by: Paul Cercueil <[email protected]> Acked-by: Jonathan Cameron <[email protected]> Reviewed-by: Ulf Hansson <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent b35b6d4 commit 3f4b325

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

include/linux/pm.h

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,12 @@ static const struct dev_pm_ops name = { \
366366
SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
367367
}
368368

369+
/* Deprecated. Use DEFINE_SIMPLE_DEV_PM_OPS() instead. */
370+
#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
371+
const struct dev_pm_ops __maybe_unused name = { \
372+
SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
373+
}
374+
369375
/*
370376
* Use this for defining a set of PM operations to be used in all situations
371377
* (system suspend, hibernation or runtime PM).
@@ -378,20 +384,9 @@ static const struct dev_pm_ops name = { \
378384
* suspend and "early" resume callback pointers, .suspend_late() and
379385
* .resume_early(), to the same routines as .runtime_suspend() and
380386
* .runtime_resume(), respectively (and analogously for hibernation).
387+
*
388+
* Deprecated. You most likely don't want this macro.
381389
*/
382-
#define DEFINE_UNIVERSAL_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \
383-
static const struct dev_pm_ops name = { \
384-
SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
385-
RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
386-
}
387-
388-
/* Deprecated. Use DEFINE_SIMPLE_DEV_PM_OPS() instead. */
389-
#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
390-
const struct dev_pm_ops __maybe_unused name = { \
391-
SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
392-
}
393-
394-
/* Deprecated. Use DEFINE_UNIVERSAL_DEV_PM_OPS() instead. */
395390
#define UNIVERSAL_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \
396391
const struct dev_pm_ops __maybe_unused name = { \
397392
SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \

0 commit comments

Comments
 (0)