Skip to content

Commit 0223299

Browse files
jic23Jarkko Sakkinen
authored andcommitted
PM: core: Add NS varients of EXPORT[_GPL]_SIMPLE_DEV_PM_OPS and runtime pm equiv
As more drivers start to use namespaces, we need to have varients of these useful macros that allow the export to be in a particular namespace. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 608197f commit 0223299

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

include/linux/pm.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -368,13 +368,13 @@ const struct dev_pm_ops name = { \
368368

369369
#ifdef CONFIG_PM
370370
#define _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \
371-
runtime_resume_fn, idle_fn, sec) \
371+
runtime_resume_fn, idle_fn, sec, ns) \
372372
_DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \
373373
runtime_resume_fn, idle_fn); \
374-
_EXPORT_SYMBOL(name, sec)
374+
__EXPORT_SYMBOL(name, sec, ns)
375375
#else
376376
#define _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \
377-
runtime_resume_fn, idle_fn, sec) \
377+
runtime_resume_fn, idle_fn, sec, ns) \
378378
static __maybe_unused _DEFINE_DEV_PM_OPS(__static_##name, suspend_fn, \
379379
resume_fn, runtime_suspend_fn, \
380380
runtime_resume_fn, idle_fn)
@@ -391,9 +391,13 @@ static __maybe_unused _DEFINE_DEV_PM_OPS(__static_##name, suspend_fn, \
391391
_DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL)
392392

393393
#define EXPORT_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
394-
_EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "")
394+
_EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "", "")
395395
#define EXPORT_GPL_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
396-
_EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "_gpl")
396+
_EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "_gpl", "")
397+
#define EXPORT_NS_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn, ns) \
398+
_EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "", #ns)
399+
#define EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn, ns) \
400+
_EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "_gpl", #ns)
397401

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

include/linux/pm_runtime.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,16 @@
4141

4242
#define EXPORT_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \
4343
_EXPORT_DEV_PM_OPS(name, pm_runtime_force_suspend, pm_runtime_force_resume, \
44-
suspend_fn, resume_fn, idle_fn, "")
44+
suspend_fn, resume_fn, idle_fn, "", "")
4545
#define EXPORT_GPL_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \
4646
_EXPORT_DEV_PM_OPS(name, pm_runtime_force_suspend, pm_runtime_force_resume, \
47-
suspend_fn, resume_fn, idle_fn, "_gpl")
47+
suspend_fn, resume_fn, idle_fn, "_gpl", "")
48+
#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+
#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)
4854

4955
#ifdef CONFIG_PM
5056
extern struct workqueue_struct *pm_wq;

0 commit comments

Comments
 (0)