From: Jonathan Cameron <jic23@kernel.org>
To: linux-iio@vger.kernel.org,
"Rafael J . Wysocki" <rafael@kernel.org>,
linux-pm@vger.kernel.org
Cc: Paul Cercueil <paul@crapouillou.net>,
Sean Nyekjaer <sean@geanix.com>,
Rui Miguel Silva <rui.silva@linaro.org>,
Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>,
Linus Walleij <linus.walleij@linaro.org>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>
Subject: [PATCH 1/5] PM: core: Add EXPORT_NS_GPL_DEV_PM_OPS to avoid drivers rolling own.
Date: Sun, 7 Aug 2022 20:20:34 +0100 [thread overview]
Message-ID: <20220807192038.1039771-2-jic23@kernel.org> (raw)
In-Reply-To: <20220807192038.1039771-1-jic23@kernel.org>
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
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@huawei.com>
Cc: Paul Cercueil <paul@crapouillou.net>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
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
next prev parent reply other threads:[~2022-08-07 19:10 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-07 19:20 [PATCH 0/5] PM: Introduce EXPORT_NS_GPL_DEV_PM_OPS() and use cases in IIO Jonathan Cameron
2022-08-07 19:20 ` Jonathan Cameron [this message]
2022-08-08 11:22 ` [PATCH 1/5] PM: core: Add EXPORT_NS_GPL_DEV_PM_OPS to avoid drivers rolling own Paul Cercueil
2022-08-13 16:14 ` Jonathan Cameron
2022-08-07 19:20 ` [PATCH 2/5] iio: accel: fxls8962af: Use new EXPORT_NS_GPL_DEV_PM_OPS() Jonathan Cameron
2022-08-08 11:37 ` Sean Nyekjaer
2022-08-07 19:20 ` [PATCH 3/5] iio: gyro: fxas210002c: Move exports to IIO_FXAS210002C namespace Jonathan Cameron
2022-08-08 11:00 ` Rui Miguel Silva
2022-08-07 19:20 ` [PATCH 4/5] iio: imu: inv_icm42600: Move exports to IIO_ICM42600 namespace Jonathan Cameron
2022-08-07 19:20 ` [PATCH 5/5] iio: imu: inv_mpu: Move exports to IIO_MPU6050 namespace Jonathan Cameron
2022-08-22 8:59 ` Linus Walleij
2022-08-08 9:36 ` [PATCH 0/5] PM: Introduce EXPORT_NS_GPL_DEV_PM_OPS() and use cases in IIO Andy Shevchenko
2022-08-22 9:04 ` Linus Walleij
2022-08-22 18:59 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220807192038.1039771-2-jic23@kernel.org \
--to=jic23@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=jean-baptiste.maneyrol@tdk.com \
--cc=linus.walleij@linaro.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=paul@crapouillou.net \
--cc=rafael.j.wysocki@intel.com \
--cc=rafael@kernel.org \
--cc=rui.silva@linaro.org \
--cc=sean@geanix.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).