From patchwork Mon Sep 18 08:09:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raag Jadav X-Patchwork-Id: 141684 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp3118543vqi; Mon, 18 Sep 2023 21:07:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF1CCcGDN7WbpqnxgskbzanZVTa6iru26FwqJc0pnooX/kHfBO4Rm14P3XQ8Mir42NSVb0d X-Received: by 2002:a05:6870:df47:b0:1d6:ef37:9416 with SMTP id ur7-20020a056870df4700b001d6ef379416mr5166229oab.22.1695096478026; Mon, 18 Sep 2023 21:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695096477; cv=none; d=google.com; s=arc-20160816; b=Dg3IARx9CuR8gFDLcWZ/JUu+OZEVxVN8mtgIbGAXCmWeF3UWzTUs6ayquQDMkphRzT 0AlvKl97kHFzuKP55JJJSBKkBkjl1CmdTqII1IWnbc3TEsR3h+f3GF2zmpJdOIo1V9HP Uujep4BiUFT2Uu6z8g5u8OuO5KYTOeCQP+UJbj+z6vobx3ObHs49n6LLzI5vdwRTsvcF uwBbgEmLZj7zL6oq45UQmaT9xhpxrqYIIM5JInxRSdlZeDiVkfk5ftzKsAVXxaJMaLst Tr2S0/hLg90MRwjr3UQ3BnVSfWvsSkERUMhgrhmnQ6zW9ZCRBBRp4KOTfuZkKYZce11N UWOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=FvnzrIIzjNma4uWJhM8xpBEHI/gl4jQeipxNRP+Tbw0=; fh=1QsehnRRXzgQVMnszcmG8t4pVcJCGn85JlNaIfZPQ9Q=; b=XA/h9YAXYKQsaX1qCnKaX1d1U8AvX/MgTwAfN/scw0FhHyt8EEN6DTYq2PbSTnmTQH zraPjXpRk/OtHPBfQ8fqne54xy0X+ZcJXJMB8UCPMDnXVHu7fmNgjdEfwwSz+a6Eaxw6 tmL9pdDdNL+7gvuhzeZUp1Ga5Jh4KQAI4+29l/i8N1SwzPCGDcCnvM9b+NLwyAX+6Ls4 XHH7L+bDbNvLgvlYYuUuC0lxdiw+6xJJsz8+E7hhJstLUPPMLjLbmJ050Wq65LbjtntB vcrKm7afdd5GbdC/kPtiuPMrmEidDD9srGBwaCAyfFZxDk5Rr6DdCDW8RqmcH+17BPjw gOWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AeJUesqP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id e7-20020a17090ac20700b0027465340295si9205186pjt.60.2023.09.18.21.07.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 21:07:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AeJUesqP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 6A68880758F6; Mon, 18 Sep 2023 01:11:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240626AbjIRIK5 (ORCPT + 27 others); Mon, 18 Sep 2023 04:10:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240550AbjIRIKd (ORCPT ); Mon, 18 Sep 2023 04:10:33 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F8AA99; Mon, 18 Sep 2023 01:10:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695024628; x=1726560628; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=nzvv6eDUMuWEVi9A5kctA5+LBLiff1ltxVOjQscs/XM=; b=AeJUesqPUvyew1vBIkkIburP6BnZUNqWtQFngTPU12rBaCQyhdGsQZjd 6ZS6uj+96NUnKUaSfTPsZ6OqAAx+6CD8+82zF0+iHosYtNN8j8o/HrNBG Ayk1XUo4BB2QKOPY5TXKV1AVduDIaa4dohh5p09G0K3UKoBMNXJwQtg9x ye5Nd2ktF1UGyVkrz3IC26aMi1z/cJNlFU8IlMtcYmlOMj5jK8wsyMYpy k5qSYuuD00TqLg2XmzzUzVo/Fe5kI4x6C1V/90+jino6Lj2NOLBcFulNS gubJpHdSKQAttlYg/zWCV4xDHxqYEPXJqOPi0o8u9AIzU1e5/zRYNrowF g==; X-IronPort-AV: E=McAfee;i="6600,9927,10836"; a="410550864" X-IronPort-AV: E=Sophos;i="6.02,156,1688454000"; d="scan'208";a="410550864" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Sep 2023 01:10:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10836"; a="695442273" X-IronPort-AV: E=Sophos;i="6.02,156,1688454000"; d="scan'208";a="695442273" Received: from inlubt0316.iind.intel.com ([10.191.20.213]) by orsmga003.jf.intel.com with ESMTP; 18 Sep 2023 01:10:19 -0700 From: Raag Jadav To: rafael@kernel.org, len.brown@intel.com, pavel@ucw.cz, Jonathan.Cameron@huawei.com, paul@crapouillou.net, andriy.shevchenko@linux.intel.com, lars@metafoo.de, rmfrfs@gmail.com, jean-baptiste.maneyrol@tdk.com, lee@kernel.org, laurentiu.palcu@oss.nxp.com, l.stach@pengutronix.de, james.schulman@cirrus.com, david.rhodes@cirrus.com, rf@opensource.cirrus.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, dri-devel@lists.freedesktop.org, patches@opensource.cirrus.com, mallikarjunappa.sangannavar@intel.com, bala.senthil@intel.com, Raag Jadav Subject: [PATCH for-next v2 01/10] PM: Introduce export macros for _SIMPLE_ variants of _PM_OPS() Date: Mon, 18 Sep 2023 13:39:42 +0530 Message-Id: <20230918080951.3615-2-raag.jadav@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230918080951.3615-1-raag.jadav@intel.com> References: <20230918080951.3615-1-raag.jadav@intel.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 18 Sep 2023 01:11:40 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777437484305535143 X-GMAIL-MSGID: 1777437484305535143 Introduce a new set of export macros for _SIMPLE_ variants of _PM_OPS(), which export dev_pm_ops symbol only in case CONFIG_PM_SLEEP=y and discard it otherwise. Fixes: 34e1ed189fab ("PM: Improve EXPORT_*_DEV_PM_OPS macros") Signed-off-by: Raag Jadav --- include/linux/pm.h | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/include/linux/pm.h b/include/linux/pm.h index 1400c37b29c7..6e7ab6950ad1 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h @@ -374,24 +374,39 @@ const struct dev_pm_ops name = { \ RUNTIME_PM_OPS(runtime_suspend_fn, runtime_resume_fn, idle_fn) \ } -#ifdef CONFIG_PM -#define _EXPORT_DEV_PM_OPS(name, license, ns) \ +#define _EXPORT_PM_OPS(name, license, ns) \ const struct dev_pm_ops name; \ __EXPORT_SYMBOL(name, license, ns); \ const struct dev_pm_ops name -#define EXPORT_PM_FN_GPL(name) EXPORT_SYMBOL_GPL(name) -#define EXPORT_PM_FN_NS_GPL(name, ns) EXPORT_SYMBOL_NS_GPL(name, ns) -#else -#define _EXPORT_DEV_PM_OPS(name, license, ns) \ + +#define _PM_OPS(name, license, ns) \ static __maybe_unused const struct dev_pm_ops __static_##name + +#ifdef CONFIG_PM +#define _EXPORT_RUNTIME_PM_OPS(name, license, ns) _EXPORT_PM_OPS(name, license, ns) +#define EXPORT_PM_FN_GPL(name) EXPORT_SYMBOL_GPL(name) +#define EXPORT_PM_FN_NS_GPL(name, ns) EXPORT_SYMBOL_NS_GPL(name, ns) +#else +#define _EXPORT_RUNTIME_PM_OPS(name, license, ns) _PM_OPS(name, license, ns) #define EXPORT_PM_FN_GPL(name) #define EXPORT_PM_FN_NS_GPL(name, ns) #endif -#define EXPORT_DEV_PM_OPS(name) _EXPORT_DEV_PM_OPS(name, "", "") -#define EXPORT_GPL_DEV_PM_OPS(name) _EXPORT_DEV_PM_OPS(name, "GPL", "") -#define EXPORT_NS_DEV_PM_OPS(name, ns) _EXPORT_DEV_PM_OPS(name, "", #ns) -#define EXPORT_NS_GPL_DEV_PM_OPS(name, ns) _EXPORT_DEV_PM_OPS(name, "GPL", #ns) +#ifdef CONFIG_PM_SLEEP +#define _EXPORT_SIMPLE_PM_OPS(name, license, ns) _EXPORT_PM_OPS(name, license, ns) +#else +#define _EXPORT_SIMPLE_PM_OPS(name, license, ns) _PM_OPS(name, license, ns) +#endif + +#define EXPORT_DEV_PM_OPS(name) _EXPORT_RUNTIME_PM_OPS(name, "", "") +#define EXPORT_GPL_DEV_PM_OPS(name) _EXPORT_RUNTIME_PM_OPS(name, "GPL", "") +#define EXPORT_NS_DEV_PM_OPS(name, ns) _EXPORT_RUNTIME_PM_OPS(name, "", #ns) +#define EXPORT_NS_GPL_DEV_PM_OPS(name, ns) _EXPORT_RUNTIME_PM_OPS(name, "GPL", #ns) + +#define EXPORT_SIMPLE_PM_OPS(name) _EXPORT_SIMPLE_PM_OPS(name, "", "") +#define EXPORT_GPL_SIMPLE_PM_OPS(name) _EXPORT_SIMPLE_PM_OPS(name, "GPL", "") +#define EXPORT_NS_SIMPLE_PM_OPS(name, ns) _EXPORT_SIMPLE_PM_OPS(name, "", #ns) +#define EXPORT_NS_GPL_SIMPLE_PM_OPS(name, ns) _EXPORT_SIMPLE_PM_OPS(name, "GPL", #ns) /* * 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 = { \ _DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL) #define EXPORT_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ - EXPORT_DEV_PM_OPS(name) = { \ + EXPORT_SIMPLE_PM_OPS(name) = { \ SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \ } #define EXPORT_GPL_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ - EXPORT_GPL_DEV_PM_OPS(name) = { \ + EXPORT_GPL_SIMPLE_PM_OPS(name) = { \ SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \ } #define EXPORT_NS_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn, ns) \ - EXPORT_NS_DEV_PM_OPS(name, ns) = { \ + EXPORT_NS_SIMPLE_PM_OPS(name, ns) = { \ SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \ } #define EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn, ns) \ - EXPORT_NS_GPL_DEV_PM_OPS(name, ns) = { \ + EXPORT_NS_GPL_SIMPLE_PM_OPS(name, ns) = { \ SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \ }