Hi Jonathan,
If you can wait a day or two - I would like to submit my own version of
EXPORT_NS_GPL_DEV_PM_OPS, which should be more versatile than your
version.
Cheers,
-Paul
Le dim., août 7 2022 at 20:20:34 +0100, Jonathan Cameron
<jic23@xxxxxxxxxx> a écrit :
From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
A driver wishing to export a struct dev_pm_ops with both suspend and
runtime ops provided could use _EXPORT_DEV_PM_OPS() directly but
that macro is not intended for use in drivers and requires non
intuitive aspect such as passing "_gpl" as one parameter and the
namespace as a string. As such just provide a macro to cover
the GPL and NS case in a fashion that is in line with similar macros.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
Cc: Paul Cercueil <paul@xxxxxxxxxxxxxxx>
Cc: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
---
include/linux/pm.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 871c9c49ec9d..18856e0d23ac 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -407,6 +407,11 @@ static __maybe_unused
_DEFINE_DEV_PM_OPS(__static_##name, suspend_fn, \
#define EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn,
ns) \
_EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL,
"_gpl", #ns)
+#define EXPORT_NS_GPL_DEV_PM_OPS(name, suspend_fn, resume_fn,
runtime_suspend_fn, \
+ runtime_resume_fn, idle_fn, ns) \
+ _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn,
\
+ runtime_resume_fn, idle_fn, "_gpl", #ns)
+
/* Deprecated. Use DEFINE_SIMPLE_DEV_PM_OPS() instead. */
#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
const struct dev_pm_ops __maybe_unused name = { \
--
2.37.1