PM: Add EXPORT macros for exporting PM functions
Subsystems (3)
PATCH 1/1 PM: Add EXPORT macros for exporting PM functions
Add a set of macros for exporting functions only if CONFIG_PM is enabled.
The naming follows the style of the standard EXPORT_SYMBOL_*() macros that they replace.
Sometimes a module wants to export PM functions directly to other drivers, not a complete struct dev_pm_ops. A typical example is where a core library exports the generic (shared) implementation and calling code wraps one or more of these in custom code.
--- include/linux/pm.h | 8 ++++++++ 1 file changed, 8 insertions(+)
include/linux/pm.h +8 -0
@@ -379,9 +379,17 @@ const struct dev_pm_ops name = { \const struct dev_pm_ops name; \__EXPORT_SYMBOL (name, sec, ns); \ const struct dev_pm_ops name +#define EXPORT_PM_FN (name) EXPORT_SYMBOL(name) +#define EXPORT_PM_FN_GPL (name) EXPORT_SYMBOL_GPL(name) +#define EXPORT_PM_FN_NS (name, ns) EXPORT_SYMBOL_NS(name, ns) +#define EXPORT_PM_FN_NS_GPL (name, ns) EXPORT_SYMBOL_NS_GPL(name, ns)#else #define _EXPORT_DEV_PM_OPS (name, sec, ns) \ static __maybe_unused const struct dev_pm_ops __static_##name +#define EXPORT_PM_FN (name) +#define EXPORT_PM_FN_GPL (name) +#define EXPORT_PM_FN_NS (name, ns) +#define EXPORT_PM_FN_NS_GPL (name, ns)#endif #define EXPORT_DEV_PM_OPS (name) _EXPORT_DEV_PM_OPS(name, "", "")
Signature · 1 line
2.30.2
Rafael J. Wysocki
maintainerQuoted 22 lines · Richard Fitzgerald
Add a set of macros for exporting functions only if
CONFIG_PMis enabled.The naming follows the style of the standard EXPORT_SYMBOL_*() macros that they replace.
Sometimes a module wants to export PM functions directly to other drivers, not a complete struct
dev_pm_ops. A typical example is where a core library exports the generic (shared) implementation and calling code wraps one or more of these in custom code.Signed-off-by Richard Fitzgerald <[email protected]>--- include/linux/pm.h | 8 ++++++++ 1 file changed, 8 insertions(+)include/linux/pm.h +0
-0
include/linux/pm.h const struct dev_pm_ops name = { \ · line 385
Quoted 7 lines
include/linux/pm.h +4
-0@@ -379,9 +379,17 @@ const struct dev_pm_ops name = { \const struct dev_pm_ops name; \__EXPORT_SYMBOL (name, sec, ns); \ const struct dev_pm_ops name +#define EXPORT_PM_FN (name) EXPORT_SYMBOL(name) +#define EXPORT_PM_FN_GPL (name) EXPORT_SYMBOL_GPL(name) +#define EXPORT_PM_FN_NS (name, ns) EXPORT_SYMBOL_NS(name, ns) +#define EXPORT_PM_FN_NS_GPL (name, ns) EXPORT_SYMBOL_NS_GPL(name, ns)
Why are the non-GPL variants needed?
Quoted 13 lines
include/linux/pm.h +4
-1#else #define _EXPORT_DEV_PM_OPS (name, sec, ns) \ static __maybe_unused const struct dev_pm_ops __static_##name +#define EXPORT_PM_FN (name) +#define EXPORT_PM_FN_GPL (name) +#define EXPORT_PM_FN_NS (name, ns) +#define EXPORT_PM_FN_NS_GPL (name, ns)#endif #define EXPORT_DEV_PM_OPS (name) _EXPORT_DEV_PM_OPS(name, "", "") --2.30.2
Quoted 19 lines · Rafael J. Wysocki
Quoted 17 lines · Richard Fitzgerald
Add a set of macros for exporting functions only if
CONFIG_PMis enabled.The naming follows the style of the standard EXPORT_SYMBOL_*() macros that they replace.
Sometimes a module wants to export PM functions directly to other drivers, not a complete struct
dev_pm_ops. A typical example is where a core library exports the generic (shared) implementation and calling code wraps one or more of these in custom code.Signed-off-by Richard Fitzgerald <[email protected]>--- include/linux/pm.h | 8 ++++++++ 1 file changed, 8 insertions(+)
Quoted 15 lines
include/linux/pm.h const struct dev_pm_ops name = { \ · line 385
Quoted 12 lines
include/linux/pm.h +4
-0@@ -379,9 +379,17 @@ const struct dev_pm_ops name = { \const struct dev_pm_ops name; \__EXPORT_SYMBOL (name, sec, ns); \ const struct dev_pm_ops name +#define EXPORT_PM_FN (name) EXPORT_SYMBOL(name) +#define EXPORT_PM_FN_GPL (name) EXPORT_SYMBOL_GPL(name) +#define EXPORT_PM_FN_NS (name, ns) EXPORT_SYMBOL_NS(name, ns) +#define EXPORT_PM_FN_NS_GPL (name, ns) EXPORT_SYMBOL_NS_GPL(name, ns)Why are the non-GPL variants needed?
I did all four because there are all four variants of EXPORT_DEV_PM_OPS. Why are the non-GPL variants of EXPORT_DEV_PM_OPS needed?
I can remove the non-GPL variants of my macros.
Quoted 13 lines
Quoted 13 lines
include/linux/pm.h +4
-1#else #define _EXPORT_DEV_PM_OPS (name, sec, ns) \ static __maybe_unused const struct dev_pm_ops __static_##name +#define EXPORT_PM_FN (name) +#define EXPORT_PM_FN_GPL (name) +#define EXPORT_PM_FN_NS (name, ns) +#define EXPORT_PM_FN_NS_GPL (name, ns)#endif #define EXPORT_DEV_PM_OPS (name) _EXPORT_DEV_PM_OPS(name, "", "") --2.30.2
Rafael J. Wysocki
maintainerQuoted 37 lines · Richard Fitzgerald
Quoted 19 lines · Rafael J. Wysocki
Quoted 17 lines · Richard Fitzgerald
Add a set of macros for exporting functions only if
CONFIG_PMis enabled.The naming follows the style of the standard EXPORT_SYMBOL_*() macros that they replace.
Sometimes a module wants to export PM functions directly to other drivers, not a complete struct
dev_pm_ops. A typical example is where a core library exports the generic (shared) implementation and calling code wraps one or more of these in custom code.Signed-off-by Richard Fitzgerald <[email protected]>--- include/linux/pm.h | 8 ++++++++ 1 file changed, 8 insertions(+)Quoted 15 lines
include/linux/pm.h const struct dev_pm_ops name = { \ · line 385
Quoted 12 lines
include/linux/pm.h +4
-0@@ -379,9 +379,17 @@ const struct dev_pm_ops name = { \const struct dev_pm_ops name; \__EXPORT_SYMBOL (name, sec, ns); \ const struct dev_pm_ops name +#define EXPORT_PM_FN (name) EXPORT_SYMBOL(name) +#define EXPORT_PM_FN_GPL (name) EXPORT_SYMBOL_GPL(name) +#define EXPORT_PM_FN_NS (name, ns) EXPORT_SYMBOL_NS(name, ns) +#define EXPORT_PM_FN_NS_GPL (name, ns) EXPORT_SYMBOL_NS_GPL(name, ns)Why are the non-GPL variants needed?
Quoted 2 lines
I did all four because there are all four variants of
EXPORT_DEV_PM_OPS. Why are the non-GPL variants ofEXPORT_DEV_PM_OPSneeded?
They aren't or at least they should not be needed in the mainline.
Quoted 1 line
I can remove the non-GPL variants of my macros.
Yes, please!
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
include/linux/pm.h +4
-1#else #define _EXPORT_DEV_PM_OPS (name, sec, ns) \ static __maybe_unused const struct dev_pm_ops __static_##name +#define EXPORT_PM_FN (name) +#define EXPORT_PM_FN_GPL (name) +#define EXPORT_PM_FN_NS (name, ns) +#define EXPORT_PM_FN_NS_GPL (name, ns)#endif #define EXPORT_DEV_PM_OPS (name) _EXPORT_DEV_PM_OPS(name, "", "") --2.30.2