From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: <pavel@ucw.cz>, <len.brown@intel.com>, <linux-pm@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <patches@opensource.cirrus.com>
Subject: Re: [PATCH] PM: Add EXPORT macros for exporting PM functions
Date: Mon, 13 Feb 2023 15:50:01 +0000 [thread overview]
Message-ID: <1294e968-d03e-ee4a-e1c1-d9293b813c63@opensource.cirrus.com> (raw)
In-Reply-To: <CAJZ5v0hE7u_rTEn1KRFhE55Y3MHS_Le4rAbFPmR+0r+Eg=3K9Q@mail.gmail.com>
On 13/02/2023 15:43, Rafael J. Wysocki wrote:
> On Mon, Feb 13, 2023 at 2:20 PM Richard Fitzgerald
> <rf@opensource.cirrus.com> wrote:
>>
>> 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.
>>
>> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
>> ---
>> include/linux/pm.h | 8 ++++++++
>> 1 file changed, 8 insertions(+)
>>
>> diff --git a/include/linux/pm.h b/include/linux/pm.h
>> index 93cd34f00822..21618f7087f8 100644
>> --- a/include/linux/pm.h
>> +++ b/include/linux/pm.h
>> @@ -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.
>> #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
>>
next prev parent reply other threads:[~2023-02-13 15:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-13 13:20 [PATCH] PM: Add EXPORT macros for exporting PM functions Richard Fitzgerald
2023-02-13 15:43 ` Rafael J. Wysocki
2023-02-13 15:50 ` Richard Fitzgerald [this message]
2023-02-13 15:57 ` Rafael J. Wysocki
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=1294e968-d03e-ee4a-e1c1-d9293b813c63@opensource.cirrus.com \
--to=rf@opensource.cirrus.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=pavel@ucw.cz \
--cc=rafael@kernel.org \
/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