Skip to content

Commit f7e6b99

Browse files
committed
Merge branches 'pm-domains' and 'pm-core'
Merge additional generic power domains handling update and an improvement of the PM callback definition macros for 6.1-rc1: - Add an error message to be printed when a power domain marked as "always on" is not actually on during initialization (Johan Hovold). - Extend macros used for defining power management callbacks to allow conditional exporting of noirq and late/early suspend/resume PM callbacks (Paul Cercueil). * pm-domains: PM: domains: log failures to register always-on domains * pm-core: PM: Improve EXPORT_*_DEV_PM_OPS macros
3 parents cf4e0f8 + 129b60c + 34e1ed1 commit f7e6b99

File tree

3 files changed

+38
-23
lines changed

3 files changed

+38
-23
lines changed

drivers/base/power/domain.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2085,8 +2085,10 @@ int pm_genpd_init(struct generic_pm_domain *genpd,
20852085

20862086
/* Always-on domains must be powered on at initialization. */
20872087
if ((genpd_is_always_on(genpd) || genpd_is_rpm_always_on(genpd)) &&
2088-
!genpd_status_on(genpd))
2088+
!genpd_status_on(genpd)) {
2089+
pr_err("always-on PM domain %s is not on\n", genpd->name);
20892090
return -EINVAL;
2091+
}
20902092

20912093
/* Multiple states but no governor doesn't make sense. */
20922094
if (!gov && genpd->state_count > 1)

include/linux/pm.h

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -375,19 +375,20 @@ const struct dev_pm_ops name = { \
375375
}
376376

377377
#ifdef CONFIG_PM
378-
#define _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \
379-
runtime_resume_fn, idle_fn, sec, ns) \
380-
_DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \
381-
runtime_resume_fn, idle_fn); \
382-
__EXPORT_SYMBOL(name, sec, ns)
378+
#define _EXPORT_DEV_PM_OPS(name, sec, ns) \
379+
const struct dev_pm_ops name; \
380+
__EXPORT_SYMBOL(name, sec, ns); \
381+
const struct dev_pm_ops name
383382
#else
384-
#define _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \
385-
runtime_resume_fn, idle_fn, sec, ns) \
386-
static __maybe_unused _DEFINE_DEV_PM_OPS(__static_##name, suspend_fn, \
387-
resume_fn, runtime_suspend_fn, \
388-
runtime_resume_fn, idle_fn)
383+
#define _EXPORT_DEV_PM_OPS(name, sec, ns) \
384+
static __maybe_unused const struct dev_pm_ops __static_##name
389385
#endif
390386

387+
#define EXPORT_DEV_PM_OPS(name) _EXPORT_DEV_PM_OPS(name, "", "")
388+
#define EXPORT_GPL_DEV_PM_OPS(name) _EXPORT_DEV_PM_OPS(name, "_gpl", "")
389+
#define EXPORT_NS_DEV_PM_OPS(name, ns) _EXPORT_DEV_PM_OPS(name, "", #ns)
390+
#define EXPORT_NS_GPL_DEV_PM_OPS(name, ns) _EXPORT_DEV_PM_OPS(name, "_gpl", #ns)
391+
391392
/*
392393
* Use this if you want to use the same suspend and resume callbacks for suspend
393394
* to RAM and hibernation.
@@ -399,13 +400,21 @@ static __maybe_unused _DEFINE_DEV_PM_OPS(__static_##name, suspend_fn, \
399400
_DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL)
400401

401402
#define EXPORT_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
402-
_EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "", "")
403+
EXPORT_DEV_PM_OPS(name) = { \
404+
SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
405+
}
403406
#define EXPORT_GPL_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
404-
_EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "_gpl", "")
407+
EXPORT_GPL_DEV_PM_OPS(name) = { \
408+
SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
409+
}
405410
#define EXPORT_NS_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn, ns) \
406-
_EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "", #ns)
411+
EXPORT_NS_DEV_PM_OPS(name, ns) = { \
412+
SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
413+
}
407414
#define EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn, ns) \
408-
_EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "_gpl", #ns)
415+
EXPORT_NS_GPL_DEV_PM_OPS(name, ns) = { \
416+
SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
417+
}
409418

410419
/* Deprecated. Use DEFINE_SIMPLE_DEV_PM_OPS() instead. */
411420
#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \

include/linux/pm_runtime.h

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,21 @@
4040
resume_fn, idle_fn)
4141

4242
#define EXPORT_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \
43-
_EXPORT_DEV_PM_OPS(name, pm_runtime_force_suspend, pm_runtime_force_resume, \
44-
suspend_fn, resume_fn, idle_fn, "", "")
43+
EXPORT_DEV_PM_OPS(name) = { \
44+
RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
45+
}
4546
#define EXPORT_GPL_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \
46-
_EXPORT_DEV_PM_OPS(name, pm_runtime_force_suspend, pm_runtime_force_resume, \
47-
suspend_fn, resume_fn, idle_fn, "_gpl", "")
47+
EXPORT_GPL_DEV_PM_OPS(name) = { \
48+
RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
49+
}
4850
#define EXPORT_NS_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn, ns) \
49-
_EXPORT_DEV_PM_OPS(name, pm_runtime_force_suspend, pm_runtime_force_resume, \
50-
suspend_fn, resume_fn, idle_fn, "", #ns)
51+
EXPORT_NS_DEV_PM_OPS(name, ns) = { \
52+
RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
53+
}
5154
#define EXPORT_NS_GPL_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn, ns) \
52-
_EXPORT_DEV_PM_OPS(name, pm_runtime_force_suspend, pm_runtime_force_resume, \
53-
suspend_fn, resume_fn, idle_fn, "_gpl", #ns)
55+
EXPORT_NS_GPL_DEV_PM_OPS(name, ns) = { \
56+
RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
57+
}
5458

5559
#ifdef CONFIG_PM
5660
extern struct workqueue_struct *pm_wq;

0 commit comments

Comments
 (0)