@@ -374,24 +374,39 @@ const struct dev_pm_ops name = { \
374
374
RUNTIME_PM_OPS(runtime_suspend_fn, runtime_resume_fn, idle_fn) \
375
375
}
376
376
377
- #ifdef CONFIG_PM
378
- #define _EXPORT_DEV_PM_OPS (name , license , ns ) \
377
+ #define _EXPORT_PM_OPS (name , license , ns ) \
379
378
const struct dev_pm_ops name; \
380
379
__EXPORT_SYMBOL(name, license, ns); \
381
380
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 ) \
386
383
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)
387
391
#define EXPORT_PM_FN_GPL (name )
388
392
#define EXPORT_PM_FN_NS_GPL (name , ns )
389
393
#endif
390
394
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)
395
410
396
411
/*
397
412
* 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 = { \
404
419
_DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL)
405
420
406
421
#define EXPORT_SIMPLE_DEV_PM_OPS (name , suspend_fn , resume_fn ) \
407
- EXPORT_DEV_PM_OPS (name) = { \
422
+ EXPORT_DEV_SLEEP_PM_OPS (name) = { \
408
423
SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
409
424
}
410
425
#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) = { \
412
427
SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
413
428
}
414
429
#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) = { \
416
431
SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
417
432
}
418
433
#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) = { \
420
435
SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
421
436
}
422
437
0 commit comments