@@ -374,24 +374,39 @@ const struct dev_pm_ops name = { \
374374 RUNTIME_PM_OPS(runtime_suspend_fn, runtime_resume_fn, idle_fn) \
375375}
376376
377- #ifdef CONFIG_PM
378- #define _EXPORT_DEV_PM_OPS (name , license , ns ) \
377+ #define _EXPORT_PM_OPS (name , license , ns ) \
379378 const struct dev_pm_ops name; \
380379 __EXPORT_SYMBOL(name, license, ns); \
381380 const struct dev_pm_ops name
382- #define EXPORT_PM_FN_GPL (name ) EXPORT_SYMBOL_GPL(name)
383- #define EXPORT_PM_FN_NS_GPL (name , ns ) EXPORT_SYMBOL_NS_GPL(name, ns)
384- #else
385- #define _EXPORT_DEV_PM_OPS (name , license , ns ) \
381+
382+ #define _DISCARD_PM_OPS (name , license , ns ) \
386383 static __maybe_unused const struct dev_pm_ops __static_##name
384+
385+ #ifdef CONFIG_PM
386+ #define _EXPORT_DEV_PM_OPS (name , license , ns ) _EXPORT_PM_OPS(name, license, ns)
387+ #define EXPORT_PM_FN_GPL (name ) EXPORT_SYMBOL_GPL(name)
388+ #define EXPORT_PM_FN_NS_GPL (name , ns ) EXPORT_SYMBOL_NS_GPL(name, ns)
389+ #else
390+ #define _EXPORT_DEV_PM_OPS (name , license , ns ) _DISCARD_PM_OPS(name, license, ns)
387391#define EXPORT_PM_FN_GPL (name )
388392#define EXPORT_PM_FN_NS_GPL (name , ns )
389393#endif
390394
391- #define EXPORT_DEV_PM_OPS (name ) _EXPORT_DEV_PM_OPS(name, "", "")
392- #define EXPORT_GPL_DEV_PM_OPS (name ) _EXPORT_DEV_PM_OPS(name, "GPL", "")
393- #define EXPORT_NS_DEV_PM_OPS (name , ns ) _EXPORT_DEV_PM_OPS(name, "", #ns)
394- #define EXPORT_NS_GPL_DEV_PM_OPS (name , ns ) _EXPORT_DEV_PM_OPS(name, "GPL", #ns)
395+ #ifdef CONFIG_PM_SLEEP
396+ #define _EXPORT_DEV_SLEEP_PM_OPS (name , license , ns ) _EXPORT_PM_OPS(name, license, ns)
397+ #else
398+ #define _EXPORT_DEV_SLEEP_PM_OPS (name , license , ns ) _DISCARD_PM_OPS(name, license, ns)
399+ #endif
400+
401+ #define EXPORT_DEV_PM_OPS (name ) _EXPORT_DEV_PM_OPS(name, "", "")
402+ #define EXPORT_GPL_DEV_PM_OPS (name ) _EXPORT_DEV_PM_OPS(name, "GPL", "")
403+ #define EXPORT_NS_DEV_PM_OPS (name , ns ) _EXPORT_DEV_PM_OPS(name, "", #ns)
404+ #define EXPORT_NS_GPL_DEV_PM_OPS (name , ns ) _EXPORT_DEV_PM_OPS(name, "GPL", #ns)
405+
406+ #define EXPORT_DEV_SLEEP_PM_OPS (name ) _EXPORT_DEV_SLEEP_PM_OPS(name, "", "")
407+ #define EXPORT_GPL_DEV_SLEEP_PM_OPS (name ) _EXPORT_DEV_SLEEP_PM_OPS(name, "GPL", "")
408+ #define EXPORT_NS_DEV_SLEEP_PM_OPS (name , ns ) _EXPORT_DEV_SLEEP_PM_OPS(name, "", #ns)
409+ #define EXPORT_NS_GPL_DEV_SLEEP_PM_OPS (name , ns ) _EXPORT_DEV_SLEEP_PM_OPS(name, "GPL", #ns)
395410
396411/*
397412 * Use this if you want to use the same suspend and resume callbacks for suspend
@@ -404,19 +419,19 @@ const struct dev_pm_ops name = { \
404419 _DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL)
405420
406421#define EXPORT_SIMPLE_DEV_PM_OPS (name , suspend_fn , resume_fn ) \
407- EXPORT_DEV_PM_OPS (name) = { \
422+ EXPORT_DEV_SLEEP_PM_OPS (name) = { \
408423 SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
409424 }
410425#define EXPORT_GPL_SIMPLE_DEV_PM_OPS (name , suspend_fn , resume_fn ) \
411- EXPORT_GPL_DEV_PM_OPS (name) = { \
426+ EXPORT_GPL_DEV_SLEEP_PM_OPS (name) = { \
412427 SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
413428 }
414429#define EXPORT_NS_SIMPLE_DEV_PM_OPS (name , suspend_fn , resume_fn , ns ) \
415- EXPORT_NS_DEV_PM_OPS (name, ns) = { \
430+ EXPORT_NS_DEV_SLEEP_PM_OPS (name, ns) = { \
416431 SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
417432 }
418433#define EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS (name , suspend_fn , resume_fn , ns ) \
419- EXPORT_NS_GPL_DEV_PM_OPS (name, ns) = { \
434+ EXPORT_NS_GPL_DEV_SLEEP_PM_OPS (name, ns) = { \
420435 SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
421436 }
422437
0 commit comments