Message ID | 20231030120734.2831419-2-andriy.shevchenko@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp2158627vqb; Mon, 30 Oct 2023 05:07:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEWQiw8L0RkTfJ+kixZ+ZKQUijzu2SpWmd7xTme/+flYm+BAs2yNhBlzhQtneTwZqVB7TCu X-Received: by 2002:a17:903:434d:b0:1cc:3f6b:a4b6 with SMTP id lo13-20020a170903434d00b001cc3f6ba4b6mr2514305plb.56.1698667678334; Mon, 30 Oct 2023 05:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698667678; cv=none; d=google.com; s=arc-20160816; b=e5zNilooAO3gPEMmYlW+xgzj6cI3pyRHmqeAXCllfB25J950nw3sK0DXmyRLJnnGkL 9Kfo3V4rb2PdhOoTUZ9yz6HJuS77LMJO5AvW1RZ9M+wsXiwk2b/51l379xT00haIUT1/ xrEaB17nxEVwvKJ4fyIKOrcl9zkqypNTTN3R/pZ0dGEE33ag+sQYjEa7RdFhINDdQREe T8wSIEmvqSmoUNdA9K2d2ruEx/4pS90G2+vCkVcIa9A6NRHt8IO6gp7Ko147H+1Oi9z1 hjoGES2shIa5knHx2RCW3i/VnPObAiY3rPJ3RaD74IM3tUGuQmNTioCm+v40LW9f6B8i zCWA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LIRKe5xItR/zsa7iKZYROHo4H5Bp16YAhTZFGNRswT4=; fh=c3++oU7I8TqZscETCslxBC3RPbuVvOiGbgAteWHBfzU=; b=koAWy/u0EqGmPy4qPB8DrzpY8nTEqERqKWE1JuaPYtmpZRAH0SEyadx2Ymo6rkTpul ZYU2vmtMNhnuK7tXc3WQn6OICdhH0lc1mXOFcqERdcWkJEIa23Cbdyu4thTldgyEH5vA CQV47AQwy2HSWL5JLsmE30NJfksU1xCHaT4aUigLSHI/ufa8CFIxKkt3jGsB+5NCUs74 FoKJdnFKAvtBeIDh3p/OzwfXHI+m7+l2824muK0ZadP8JNgamHrqVwzSoLWDzJcBBAx5 jkd/ek/RUAPFUDVdL5Rp6l6qCxlDQXNY5+UnTT6TuJtR+dSqmEfXJjHHqW1pcQtnNf+U xPpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I9aSlgEL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id r11-20020a170902c60b00b001c5cf1c30cfsi4934250plr.435.2023.10.30.05.07.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 05:07:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I9aSlgEL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id D8F19804C21F; Mon, 30 Oct 2023 05:07:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233208AbjJ3MHr (ORCPT <rfc822;zxc52fgh@gmail.com> + 31 others); Mon, 30 Oct 2023 08:07:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233135AbjJ3MHn (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 30 Oct 2023 08:07:43 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38252DA; Mon, 30 Oct 2023 05:07:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698667661; x=1730203661; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GcOoEJ3Jn7yP9ifSoXn9/N56Gs1jsU1LSJfT/anOq+g=; b=I9aSlgEL8BSMzh/zCJfSN/qk+FQsN2II8dpbenzXFKoqf5PvWAqMevjS 5qVB6yt9wvS3onmSMw006VJhKarsLl/RZ547CqrQpeiaRYnPcP90pPtHc 5evLopUZHvOueR3AsClS2tqRTMnDDeL9NMgqMygFllONstQAo5NRXx2Xa gRiSkAz3QyUKUQ+RiSab/8Kih3oph3fmca7Pom6nN7cwNFX6E3zL2qbDV YeQZ0bh9zXE6cNYmvcKU5QWDPYs8sW7Ox3u0EeLE7eMHqiajQxcpJkDDm LIEHwfb3g6EbVXvglg8CagAtfkFfATBEI3P6dAN7dwOGlD8qmayrWztom w==; X-IronPort-AV: E=McAfee;i="6600,9927,10878"; a="373107335" X-IronPort-AV: E=Sophos;i="6.03,263,1694761200"; d="scan'208";a="373107335" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2023 05:07:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10878"; a="753771400" X-IronPort-AV: E=Sophos;i="6.03,263,1694761200"; d="scan'208";a="753771400" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 30 Oct 2023 05:07:37 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id D94A02BF; Mon, 30 Oct 2023 14:07:35 +0200 (EET) From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Mika Westerberg <mika.westerberg@linux.intel.com>, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko <andy@kernel.org>, Linus Walleij <linus.walleij@linaro.org>, Paul Cercueil <paul@crapouillou.net>, Jonathan Cameron <Jonathan.Cameron@Huawei.com> Subject: [PATCH v3 01/17] pinctrl: intel: Provide Intel pin control wide PM ops structure Date: Mon, 30 Oct 2023 14:07:18 +0200 Message-Id: <20231030120734.2831419-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20231030120734.2831419-1-andriy.shevchenko@linux.intel.com> References: <20231030120734.2831419-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,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 lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 30 Oct 2023 05:07:54 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781182159806209401 X-GMAIL-MSGID: 1781182159806209401 |
Series |
pinctrl: intel: Use NOIRQ PM helper
|
|
Commit Message
Andy Shevchenko
Oct. 30, 2023, 12:07 p.m. UTC
With the help of EXPORT_NS_GPL_DEV_PM_OPS() and
NOIRQ_SYSTEM_SLEEP_PM_OPS() we may convert PM ops functions to become
static. This also takes into account the PM configuration options such
as CONFIG_PM and CONFIG_PM_SLEEP. Hence the first step is to provide
a generic PM ops structure that can be used by drivers directly.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/intel/pinctrl-intel.c | 8 +++++---
drivers/pinctrl/intel/pinctrl-intel.h | 4 ++--
2 files changed, 7 insertions(+), 5 deletions(-)
Comments
On Mon, 30 Oct 2023 14:07:18 +0200 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > With the help of EXPORT_NS_GPL_DEV_PM_OPS() and > NOIRQ_SYSTEM_SLEEP_PM_OPS() we may convert PM ops functions to become > static. This also takes into account the PM configuration options such > as CONFIG_PM and CONFIG_PM_SLEEP. Hence the first step is to provide > a generic PM ops structure that can be used by drivers directly. It's a good thing to do, but if rolling a v3, should mention that the export moves into the namespace. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Other than that, LGTM Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > --- > drivers/pinctrl/intel/pinctrl-intel.c | 8 +++++--- > drivers/pinctrl/intel/pinctrl-intel.h | 4 ++-- > 2 files changed, 7 insertions(+), 5 deletions(-) > > diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c > index b19527a8728e..9fbdc7bfa65c 100644 > --- a/drivers/pinctrl/intel/pinctrl-intel.c > +++ b/drivers/pinctrl/intel/pinctrl-intel.c > @@ -899,7 +899,7 @@ static int intel_gpio_to_pin(struct intel_pinctrl *pctrl, unsigned int offset, > * > * Return: a GPIO offset, or negative error code if translation can't be done. > */ > -static __maybe_unused int intel_pin_to_gpio(struct intel_pinctrl *pctrl, int pin) > +static int intel_pin_to_gpio(struct intel_pinctrl *pctrl, int pin) > { > const struct intel_community *community; > const struct intel_padgroup *padgrp; > @@ -1682,7 +1682,6 @@ const struct intel_pinctrl_soc_data *intel_pinctrl_get_soc_data(struct platform_ > } > EXPORT_SYMBOL_NS_GPL(intel_pinctrl_get_soc_data, PINCTRL_INTEL); > > -#ifdef CONFIG_PM_SLEEP > static bool __intel_gpio_is_direct_irq(u32 value) > { > return (value & PADCFG0_GPIROUTIOXAPIC) && (value & PADCFG0_GPIOTXDIS) && > @@ -1883,7 +1882,10 @@ int intel_pinctrl_resume_noirq(struct device *dev) > return 0; > } > EXPORT_SYMBOL_GPL(intel_pinctrl_resume_noirq); > -#endif > + > +EXPORT_NS_GPL_DEV_PM_OPS(intel_pinctrl_pm_ops, PINCTRL_INTEL) = { > + NOIRQ_SYSTEM_SLEEP_PM_OPS(intel_pinctrl_suspend_noirq, intel_pinctrl_resume_noirq) > +}; > > MODULE_AUTHOR("Mathias Nyman <mathias.nyman@linux.intel.com>"); > MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>"); > diff --git a/drivers/pinctrl/intel/pinctrl-intel.h b/drivers/pinctrl/intel/pinctrl-intel.h > index 2bb553598e8b..d3f511f97ed9 100644 > --- a/drivers/pinctrl/intel/pinctrl-intel.h > +++ b/drivers/pinctrl/intel/pinctrl-intel.h > @@ -255,10 +255,8 @@ struct intel_pinctrl { > int intel_pinctrl_probe_by_hid(struct platform_device *pdev); > int intel_pinctrl_probe_by_uid(struct platform_device *pdev); > > -#ifdef CONFIG_PM_SLEEP > int intel_pinctrl_suspend_noirq(struct device *dev); > int intel_pinctrl_resume_noirq(struct device *dev); > -#endif > > #define INTEL_PINCTRL_PM_OPS(_name) \ > const struct dev_pm_ops _name = { \ > @@ -266,6 +264,8 @@ const struct dev_pm_ops _name = { \ > intel_pinctrl_resume_noirq) \ > } > > +extern const struct dev_pm_ops intel_pinctrl_pm_ops; > + > struct intel_community *intel_get_community(struct intel_pinctrl *pctrl, unsigned int pin); > > int intel_get_groups_count(struct pinctrl_dev *pctldev);
On Mon, 30 Oct 2023 19:41:12 +0000 Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote: > On Mon, 30 Oct 2023 14:07:18 +0200 > Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > > > With the help of EXPORT_NS_GPL_DEV_PM_OPS() and > > NOIRQ_SYSTEM_SLEEP_PM_OPS() we may convert PM ops functions to become > > static. This also takes into account the PM configuration options such > > as CONFIG_PM and CONFIG_PM_SLEEP. Hence the first step is to provide > > a generic PM ops structure that can be used by drivers directly. > > It's a good thing to do, but if rolling a v3, should mention that the export > moves into the namespace. > > > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > Other than that, > LGTM > > Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > Actually looking at usecase, why isn't the absence of an EXPORT in the !CONFIG_PM_SLEEP path not a problem for bisection of this series given you haven't yet protected the users? Jonathan > > --- > > drivers/pinctrl/intel/pinctrl-intel.c | 8 +++++--- > > drivers/pinctrl/intel/pinctrl-intel.h | 4 ++-- > > 2 files changed, 7 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c > > index b19527a8728e..9fbdc7bfa65c 100644 > > --- a/drivers/pinctrl/intel/pinctrl-intel.c > > +++ b/drivers/pinctrl/intel/pinctrl-intel.c > > @@ -899,7 +899,7 @@ static int intel_gpio_to_pin(struct intel_pinctrl *pctrl, unsigned int offset, > > * > > * Return: a GPIO offset, or negative error code if translation can't be done. > > */ > > -static __maybe_unused int intel_pin_to_gpio(struct intel_pinctrl *pctrl, int pin) > > +static int intel_pin_to_gpio(struct intel_pinctrl *pctrl, int pin) > > { > > const struct intel_community *community; > > const struct intel_padgroup *padgrp; > > @@ -1682,7 +1682,6 @@ const struct intel_pinctrl_soc_data *intel_pinctrl_get_soc_data(struct platform_ > > } > > EXPORT_SYMBOL_NS_GPL(intel_pinctrl_get_soc_data, PINCTRL_INTEL); > > > > -#ifdef CONFIG_PM_SLEEP > > static bool __intel_gpio_is_direct_irq(u32 value) > > { > > return (value & PADCFG0_GPIROUTIOXAPIC) && (value & PADCFG0_GPIOTXDIS) && > > @@ -1883,7 +1882,10 @@ int intel_pinctrl_resume_noirq(struct device *dev) > > return 0; > > } > > EXPORT_SYMBOL_GPL(intel_pinctrl_resume_noirq); > > -#endif > > + > > +EXPORT_NS_GPL_DEV_PM_OPS(intel_pinctrl_pm_ops, PINCTRL_INTEL) = { > > + NOIRQ_SYSTEM_SLEEP_PM_OPS(intel_pinctrl_suspend_noirq, intel_pinctrl_resume_noirq) > > +}; > > > > MODULE_AUTHOR("Mathias Nyman <mathias.nyman@linux.intel.com>"); > > MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>"); > > diff --git a/drivers/pinctrl/intel/pinctrl-intel.h b/drivers/pinctrl/intel/pinctrl-intel.h > > index 2bb553598e8b..d3f511f97ed9 100644 > > --- a/drivers/pinctrl/intel/pinctrl-intel.h > > +++ b/drivers/pinctrl/intel/pinctrl-intel.h > > @@ -255,10 +255,8 @@ struct intel_pinctrl { > > int intel_pinctrl_probe_by_hid(struct platform_device *pdev); > > int intel_pinctrl_probe_by_uid(struct platform_device *pdev); > > > > -#ifdef CONFIG_PM_SLEEP > > int intel_pinctrl_suspend_noirq(struct device *dev); > > int intel_pinctrl_resume_noirq(struct device *dev); > > -#endif > > > > #define INTEL_PINCTRL_PM_OPS(_name) \ > > const struct dev_pm_ops _name = { \ > > @@ -266,6 +264,8 @@ const struct dev_pm_ops _name = { \ > > intel_pinctrl_resume_noirq) \ > > } > > > > +extern const struct dev_pm_ops intel_pinctrl_pm_ops; > > + > > struct intel_community *intel_get_community(struct intel_pinctrl *pctrl, unsigned int pin); > > > > int intel_get_groups_count(struct pinctrl_dev *pctldev); >
On Mon, Oct 30, 2023 at 07:43:50PM +0000, Jonathan Cameron wrote: > On Mon, 30 Oct 2023 19:41:12 +0000 > Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote: ... > Actually looking at usecase, why isn't the absence of an EXPORT in > the !CONFIG_PM_SLEEP path not a problem for bisection of this series given > you haven't yet protected the users? I'm not sure I got the issue you are trying to point out. Between first and last patches the main driver exports two things: the PM ops functions, which are _always_ been exported and PM ops structure, which is exported only when CONFIG_PM_SLEEP=y. Every converted user has pm_sleep_ptr() guard added so it shouldn't be a problem. What exactly did I miss?
diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c index b19527a8728e..9fbdc7bfa65c 100644 --- a/drivers/pinctrl/intel/pinctrl-intel.c +++ b/drivers/pinctrl/intel/pinctrl-intel.c @@ -899,7 +899,7 @@ static int intel_gpio_to_pin(struct intel_pinctrl *pctrl, unsigned int offset, * * Return: a GPIO offset, or negative error code if translation can't be done. */ -static __maybe_unused int intel_pin_to_gpio(struct intel_pinctrl *pctrl, int pin) +static int intel_pin_to_gpio(struct intel_pinctrl *pctrl, int pin) { const struct intel_community *community; const struct intel_padgroup *padgrp; @@ -1682,7 +1682,6 @@ const struct intel_pinctrl_soc_data *intel_pinctrl_get_soc_data(struct platform_ } EXPORT_SYMBOL_NS_GPL(intel_pinctrl_get_soc_data, PINCTRL_INTEL); -#ifdef CONFIG_PM_SLEEP static bool __intel_gpio_is_direct_irq(u32 value) { return (value & PADCFG0_GPIROUTIOXAPIC) && (value & PADCFG0_GPIOTXDIS) && @@ -1883,7 +1882,10 @@ int intel_pinctrl_resume_noirq(struct device *dev) return 0; } EXPORT_SYMBOL_GPL(intel_pinctrl_resume_noirq); -#endif + +EXPORT_NS_GPL_DEV_PM_OPS(intel_pinctrl_pm_ops, PINCTRL_INTEL) = { + NOIRQ_SYSTEM_SLEEP_PM_OPS(intel_pinctrl_suspend_noirq, intel_pinctrl_resume_noirq) +}; MODULE_AUTHOR("Mathias Nyman <mathias.nyman@linux.intel.com>"); MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>"); diff --git a/drivers/pinctrl/intel/pinctrl-intel.h b/drivers/pinctrl/intel/pinctrl-intel.h index 2bb553598e8b..d3f511f97ed9 100644 --- a/drivers/pinctrl/intel/pinctrl-intel.h +++ b/drivers/pinctrl/intel/pinctrl-intel.h @@ -255,10 +255,8 @@ struct intel_pinctrl { int intel_pinctrl_probe_by_hid(struct platform_device *pdev); int intel_pinctrl_probe_by_uid(struct platform_device *pdev); -#ifdef CONFIG_PM_SLEEP int intel_pinctrl_suspend_noirq(struct device *dev); int intel_pinctrl_resume_noirq(struct device *dev); -#endif #define INTEL_PINCTRL_PM_OPS(_name) \ const struct dev_pm_ops _name = { \ @@ -266,6 +264,8 @@ const struct dev_pm_ops _name = { \ intel_pinctrl_resume_noirq) \ } +extern const struct dev_pm_ops intel_pinctrl_pm_ops; + struct intel_community *intel_get_community(struct intel_pinctrl *pctrl, unsigned int pin); int intel_get_groups_count(struct pinctrl_dev *pctldev);