Message ID | 20230213132048.2612961-1-rf@opensource.cirrus.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2344210wrn; Mon, 13 Feb 2023 05:26:36 -0800 (PST) X-Google-Smtp-Source: AK7set+TPDVz0xYRObRCcE0yr0AbbmaXuvOSk0B8+9gLqbZyLi0TCWky8Sdw70wK6Tdeo+H8MC5z X-Received: by 2002:a17:90b:390a:b0:233:df57:4fa3 with SMTP id ob10-20020a17090b390a00b00233df574fa3mr6122878pjb.43.1676294795777; Mon, 13 Feb 2023 05:26:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676294795; cv=none; d=google.com; s=arc-20160816; b=Q0Nm0KScK5XFN1693ORAYws3ojhNBvfhTkOAVrp3HaTjhzgVEwsegtrKmGzIZ+3gKe OP+NsMVHLdTEKtqJlUgx72P3oHjw9dVGL2HPRed5NdwkichNiSLc04hK7/7Ge1m8ugCc VlXsblRAKb/NradOqiQFDcoRuB4icrNFfqViKDbEbvGz3gjo49Hh9p4WdJYfX6U4wA/a 7X7ZhVJ1fisykJIGweSIf28OS8QNJXWZEGd9RhEEPJcAXtCH6S7kbRnrsESuWGUFozDZ /6Gpw845hbKwH4YtdOGzDHKPHJ/kEpBjCXJIRIgRGPz5EBL8VPTA/+9FptfSDscdZweK 9Mwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=a6KdMqV9U9YOz/15FX45aqFZVTUd19HQuUArG7NzmiU=; b=k6dxkQYpoCzHZ10LbiGC44YJb9SBdc1AuwcHjWQXti9hSST9emvlE/idbFCOfmRtTI VBXfjJrJa4j5DPbTB4HiO0lLv7L48KRJqMbPvs8nSRasrf6/xMcEqL078foU4Pncke/I VRQC6FXK/5we6hoX4G8uqcEo9TI5g7pfO322xSN1CqIf8ZwdkOJTOsw0T5tpJscBhL8S FTtNfdk9Y3B4YwO+wC/Zz9HzaEeQp38aKmstAw5T3uB6fUAaLipaENPXT9XHBzQ1g7rk di60C/8lAsfDCJdyXkJ71v30KnvyRF5uAUztQRw2h8yGmKRviqQRH4VjAEe6zTfyLNWr 44BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=doGuSc7j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m14-20020a656a0e000000b004d2bff10bc3si13016147pgu.426.2023.02.13.05.26.21; Mon, 13 Feb 2023 05:26:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=doGuSc7j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229861AbjBMNVD (ORCPT <rfc822;tebrre53rla2o@gmail.com> + 99 others); Mon, 13 Feb 2023 08:21:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229505AbjBMNVB (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 13 Feb 2023 08:21:01 -0500 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 255CDBDFB; Mon, 13 Feb 2023 05:21:00 -0800 (PST) Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 31D4gR8p017058; Mon, 13 Feb 2023 07:20:50 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=a6KdMqV9U9YOz/15FX45aqFZVTUd19HQuUArG7NzmiU=; b=doGuSc7j4YPE6LAoDaliI69UgUjezremHk3GihC7AQkkCwfrlcinCWZbBewQBIkakSd1 lDPjmpsWxzkYx1iI2TcsKTsyiUrhSvdhDmShMJR9Mctt//OSlSleraKubH15dFY6UAjW ZFFurMYqlWpHGSahw+h8ju8Bmlmxq6x5GTIcq1VXu79GRxiwRk+alYjWCwzFJ+Sn2P9y OjVQdFPeuq8LFa0MSnzbCdKqdJj8ZoCpierCGT2O3NJOgpBTMqD90relGhLbXh0nNiAs aoV2x9oHu90SKl8i65tAdDCMQBhvb43dvCgkrMPqAs6CGI+RlWR05Pma9+XMIQ3K1ltr wg== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3np8att8gp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Feb 2023 07:20:50 -0600 Received: from ediex02.ad.cirrus.com (198.61.84.81) by ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.21; Mon, 13 Feb 2023 07:20:48 -0600 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by anon-ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server id 15.2.1118.21 via Frontend Transport; Mon, 13 Feb 2023 07:20:48 -0600 Received: from edi-sw-dsktp-006.ad.cirrus.com (edi-sw-dsktp-006.ad.cirrus.com [198.90.251.127]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id DBBF5B0E; Mon, 13 Feb 2023 13:20:48 +0000 (UTC) From: Richard Fitzgerald <rf@opensource.cirrus.com> To: <rafael@kernel.org>, <pavel@ucw.cz>, <len.brown@intel.com> CC: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <patches@opensource.cirrus.com>, Richard Fitzgerald <rf@opensource.cirrus.com> Subject: [PATCH] PM: Add EXPORT macros for exporting PM functions Date: Mon, 13 Feb 2023 13:20:48 +0000 Message-ID: <20230213132048.2612961-1-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: BejLWHeqiJjpbC1ikArkz3pqc5hxYECt X-Proofpoint-ORIG-GUID: BejLWHeqiJjpbC1ikArkz3pqc5hxYECt X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757722491661408398?= X-GMAIL-MSGID: =?utf-8?q?1757722491661408398?= |
Series |
PM: Add EXPORT macros for exporting PM functions
|
|
Commit Message
Richard Fitzgerald
Feb. 13, 2023, 1:20 p.m. UTC
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(+)
Comments
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? > #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 >
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 >>
On Mon, Feb 13, 2023 at 4:50 PM Richard Fitzgerald <rf@opensource.cirrus.com> wrote: > > 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? They aren't or at least they should not be needed in the mainline. > I can remove the non-GPL variants of my macros. Yes, please! > >> #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 > >>
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) #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, "", "")