Message ID | 20230711072053.2837327-1-geert+renesas@glider.be |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp302662vqm; Tue, 11 Jul 2023 00:32:37 -0700 (PDT) X-Google-Smtp-Source: APBJJlFOp8DZaOFLF1rgoiS5gxabMKSUzolgV+Eu9UItLjNLzYSewp7t6S2SAfWRX7Uf4TR1K5m3 X-Received: by 2002:a17:906:1c17:b0:991:b554:e64b with SMTP id k23-20020a1709061c1700b00991b554e64bmr14052068ejg.54.1689060757157; Tue, 11 Jul 2023 00:32:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689060757; cv=none; d=google.com; s=arc-20160816; b=mU4KauujoQ/bQ+5mH+yUxHSBvIwm9B5zdDPBxdcGwYFcf74iurJ0tXMcKPHGN6WwRM 6dAdVk8qlI5bPrL/NGMSFum/07c9PBEXz82pYYmaNX4U5PtJ6pj8965/XCAqjz9nAYBp tyTGFemgZzdrcAg3W83Ma7KTzxcx2YOnW8pN2kBSchyPfQ5ZY3fW+VWDMSnYVxC1qgfM x4CaNlCGeY7jGlYhzoOFsUJE1bLo2XCOXfm1vNLoiILFDUZ+1i9shQu8dzEONrn9J2au 4nUivqgXX+OvHRswcAYBLn5NALqEQwYSxg0OsW5bLZlFdD+633rwd2CUMW/nVI9urKE8 J30A== 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; bh=Y+yHmeUytEzqZ2KymrlQDrTdzMob89vDJWQJYNBpI+0=; fh=Z9llmHm+Poik12B+hXgKzD40dSPqnKo2FbH+gJ8APt0=; b=wNhwJFQgoB3sXWpMsgO/7Wmo8r3OdeOXgvseieZr1xYE25vhxRtF4ndYU1O5FHm25E s86FdqZXlKXUjA0VCiFCMR/iHmtnPBNKpaOhnFQvGv5E+8jd3qYWXuvS9HsmHwo/rctU qnsQF2jVZYvaAfWJ4IEQQ85Yl69Y+Cp7zVzhCNkuJEfydvwKr4Ljzb2+ICChXNM4bxFu Ku0gEjPTnSw3cObhdFoXLQ5ApZ5OhtIGhxb5w1oXG0yLamkL8IL0lvgEma2TyPgwP7kJ o3fdclNWSLAaEnp7srhed3Nya9/eOf5xuFn6Rajv0nkDSc8m2VH87zH87BPPqmMSd1O5 zFXw== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m9-20020a1709066d0900b0099396546ffasi1394720ejr.783.2023.07.11.00.32.12; Tue, 11 Jul 2023 00:32:37 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230311AbjGKHVB (ORCPT <rfc822;gnulinuxfreebsd@gmail.com> + 99 others); Tue, 11 Jul 2023 03:21:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229583AbjGKHVA (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 11 Jul 2023 03:21:00 -0400 Received: from albert.telenet-ops.be (albert.telenet-ops.be [IPv6:2a02:1800:110:4::f00:1a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D4BFCE for <linux-kernel@vger.kernel.org>; Tue, 11 Jul 2023 00:20:57 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed40:f087:2614:ec9d:569f]) by albert.telenet-ops.be with bizsmtp id KjLt2A00K1w4dBK06jLuuy; Tue, 11 Jul 2023 09:20:54 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from <geert@linux-m68k.org>) id 1qJ7fz-0015rg-00; Tue, 11 Jul 2023 09:20:53 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from <geert@linux-m68k.org>) id 1qJ7g5-00Bu7W-Pz; Tue, 11 Jul 2023 09:20:53 +0200 From: Geert Uytterhoeven <geert+renesas@glider.be> To: Linus Walleij <linus.walleij@linaro.org>, Bartosz Golaszewski <brgl@bgdev.pl>, Andy Shevchenko <andy@kernel.org>, Shenwei Wang <shenwei.wang@nxp.com> Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] gpio: mxc: Improve PM configuration Date: Tue, 11 Jul 2023 09:20:53 +0200 Message-Id: <20230711072053.2837327-1-geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no 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: INBOX X-GMAIL-THRID: 1771108572502483496 X-GMAIL-MSGID: 1771108572502483496 |
Series |
gpio: mxc: Improve PM configuration
|
|
Commit Message
Geert Uytterhoeven
July 11, 2023, 7:20 a.m. UTC
If CONFIG_PM=n (e.g. m68k/allmodconfig):
drivers/gpio/gpio-mxc.c:612:12: error: ‘mxc_gpio_runtime_resume’ defined but not used [-Werror=unused-function]
612 | static int mxc_gpio_runtime_resume(struct device *dev)
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/gpio/gpio-mxc.c:602:12: error: ‘mxc_gpio_runtime_suspend’ defined but not used [-Werror=unused-function]
602 | static int mxc_gpio_runtime_suspend(struct device *dev)
| ^~~~~~~~~~~~~~~~~~~~~~~~
Fix this by using the non-SET *_PM_OPS to configure the dev_pm_ops
callbacks, and by wrapping the driver.pm initializer insider pm_ptr().
As NOIRQ_SYSTEM_SLEEP_PM_OPS() uses pm_sleep_ptr() internally, the
__maybe_unused annotations for the noirq callbacks are no longer needed,
and can be removed.
Fixes: 3283d820dce649ad ("gpio: mxc: add runtime pm support")
Reported-by: noreply@ellerman.id.au
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
drivers/gpio/gpio-mxc.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
Comments
On Tue, Jul 11, 2023 at 10:21 AM Geert Uytterhoeven <geert+renesas@glider.be> wrote: > > If CONFIG_PM=n (e.g. m68k/allmodconfig): > > drivers/gpio/gpio-mxc.c:612:12: error: ‘mxc_gpio_runtime_resume’ defined but not used [-Werror=unused-function] > 612 | static int mxc_gpio_runtime_resume(struct device *dev) > | ^~~~~~~~~~~~~~~~~~~~~~~ > drivers/gpio/gpio-mxc.c:602:12: error: ‘mxc_gpio_runtime_suspend’ defined but not used [-Werror=unused-function] > 602 | static int mxc_gpio_runtime_suspend(struct device *dev) > | ^~~~~~~~~~~~~~~~~~~~~~~~ > > Fix this by using the non-SET *_PM_OPS to configure the dev_pm_ops > callbacks, and by wrapping the driver.pm initializer insider pm_ptr(). > > As NOIRQ_SYSTEM_SLEEP_PM_OPS() uses pm_sleep_ptr() internally, the > __maybe_unused annotations for the noirq callbacks are no longer needed, > and can be removed. Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> > Fixes: 3283d820dce649ad ("gpio: mxc: add runtime pm support") > Reported-by: noreply@ellerman.id.au > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> > --- > drivers/gpio/gpio-mxc.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c > index a9fb6bd9aa6f9645..a43df5d5006e62d3 100644 > --- a/drivers/gpio/gpio-mxc.c > +++ b/drivers/gpio/gpio-mxc.c > @@ -623,7 +623,7 @@ static int mxc_gpio_runtime_resume(struct device *dev) > return 0; > } > > -static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev) > +static int mxc_gpio_noirq_suspend(struct device *dev) > { > struct platform_device *pdev = to_platform_device(dev); > struct mxc_gpio_port *port = platform_get_drvdata(pdev); > @@ -634,7 +634,7 @@ static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev) > return 0; > } > > -static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev) > +static int mxc_gpio_noirq_resume(struct device *dev) > { > struct platform_device *pdev = to_platform_device(dev); > struct mxc_gpio_port *port = platform_get_drvdata(pdev); > @@ -647,8 +647,8 @@ static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev) > } > > static const struct dev_pm_ops mxc_gpio_dev_pm_ops = { > - SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume) > - SET_RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL) > + NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume) > + RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL) > }; > > static int mxc_gpio_syscore_suspend(void) > @@ -695,7 +695,7 @@ static struct platform_driver mxc_gpio_driver = { > .name = "gpio-mxc", > .of_match_table = mxc_gpio_dt_ids, > .suppress_bind_attrs = true, > - .pm = &mxc_gpio_dev_pm_ops, > + .pm = pm_ptr(&mxc_gpio_dev_pm_ops), > }, > .probe = mxc_gpio_probe, > }; > -- > 2.34.1 >
On Tue, Jul 11, 2023 at 9:20 AM Geert Uytterhoeven <geert+renesas@glider.be> wrote: > > If CONFIG_PM=n (e.g. m68k/allmodconfig): > > drivers/gpio/gpio-mxc.c:612:12: error: ‘mxc_gpio_runtime_resume’ defined but not used [-Werror=unused-function] > 612 | static int mxc_gpio_runtime_resume(struct device *dev) > | ^~~~~~~~~~~~~~~~~~~~~~~ > drivers/gpio/gpio-mxc.c:602:12: error: ‘mxc_gpio_runtime_suspend’ defined but not used [-Werror=unused-function] > 602 | static int mxc_gpio_runtime_suspend(struct device *dev) > | ^~~~~~~~~~~~~~~~~~~~~~~~ > > Fix this by using the non-SET *_PM_OPS to configure the dev_pm_ops > callbacks, and by wrapping the driver.pm initializer insider pm_ptr(). > > As NOIRQ_SYSTEM_SLEEP_PM_OPS() uses pm_sleep_ptr() internally, the > __maybe_unused annotations for the noirq callbacks are no longer needed, > and can be removed. > > Fixes: 3283d820dce649ad ("gpio: mxc: add runtime pm support") > Reported-by: noreply@ellerman.id.au > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> > --- > drivers/gpio/gpio-mxc.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c > index a9fb6bd9aa6f9645..a43df5d5006e62d3 100644 > --- a/drivers/gpio/gpio-mxc.c > +++ b/drivers/gpio/gpio-mxc.c > @@ -623,7 +623,7 @@ static int mxc_gpio_runtime_resume(struct device *dev) > return 0; > } > > -static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev) > +static int mxc_gpio_noirq_suspend(struct device *dev) > { > struct platform_device *pdev = to_platform_device(dev); > struct mxc_gpio_port *port = platform_get_drvdata(pdev); > @@ -634,7 +634,7 @@ static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev) > return 0; > } > > -static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev) > +static int mxc_gpio_noirq_resume(struct device *dev) > { > struct platform_device *pdev = to_platform_device(dev); > struct mxc_gpio_port *port = platform_get_drvdata(pdev); > @@ -647,8 +647,8 @@ static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev) > } > > static const struct dev_pm_ops mxc_gpio_dev_pm_ops = { > - SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume) > - SET_RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL) > + NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume) > + RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL) > }; > > static int mxc_gpio_syscore_suspend(void) > @@ -695,7 +695,7 @@ static struct platform_driver mxc_gpio_driver = { > .name = "gpio-mxc", > .of_match_table = mxc_gpio_dt_ids, > .suppress_bind_attrs = true, > - .pm = &mxc_gpio_dev_pm_ops, > + .pm = pm_ptr(&mxc_gpio_dev_pm_ops), > }, > .probe = mxc_gpio_probe, > }; > -- > 2.34.1 > Applied, thanks! Bart
On Thu, Jul 20, 2023 at 5:17 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote: > > On Tue, Jul 11, 2023 at 9:20 AM Geert Uytterhoeven > <geert+renesas@glider.be> wrote: > > > > If CONFIG_PM=n (e.g. m68k/allmodconfig): > > > > drivers/gpio/gpio-mxc.c:612:12: error: ‘mxc_gpio_runtime_resume’ defined but not used [-Werror=unused-function] > > 612 | static int mxc_gpio_runtime_resume(struct device *dev) > > | ^~~~~~~~~~~~~~~~~~~~~~~ > > drivers/gpio/gpio-mxc.c:602:12: error: ‘mxc_gpio_runtime_suspend’ defined but not used [-Werror=unused-function] > > 602 | static int mxc_gpio_runtime_suspend(struct device *dev) > > | ^~~~~~~~~~~~~~~~~~~~~~~~ > > > > Fix this by using the non-SET *_PM_OPS to configure the dev_pm_ops > > callbacks, and by wrapping the driver.pm initializer insider pm_ptr(). > > > > As NOIRQ_SYSTEM_SLEEP_PM_OPS() uses pm_sleep_ptr() internally, the > > __maybe_unused annotations for the noirq callbacks are no longer needed, > > and can be removed. > > > > Fixes: 3283d820dce649ad ("gpio: mxc: add runtime pm support") > > Reported-by: noreply@ellerman.id.au > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> > > --- > > drivers/gpio/gpio-mxc.c | 10 +++++----- > > 1 file changed, 5 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c > > index a9fb6bd9aa6f9645..a43df5d5006e62d3 100644 > > --- a/drivers/gpio/gpio-mxc.c > > +++ b/drivers/gpio/gpio-mxc.c > > @@ -623,7 +623,7 @@ static int mxc_gpio_runtime_resume(struct device *dev) > > return 0; > > } > > > > -static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev) > > +static int mxc_gpio_noirq_suspend(struct device *dev) > > { > > struct platform_device *pdev = to_platform_device(dev); > > struct mxc_gpio_port *port = platform_get_drvdata(pdev); > > @@ -634,7 +634,7 @@ static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev) > > return 0; > > } > > > > -static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev) > > +static int mxc_gpio_noirq_resume(struct device *dev) > > { > > struct platform_device *pdev = to_platform_device(dev); > > struct mxc_gpio_port *port = platform_get_drvdata(pdev); > > @@ -647,8 +647,8 @@ static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev) > > } > > > > static const struct dev_pm_ops mxc_gpio_dev_pm_ops = { > > - SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume) > > - SET_RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL) > > + NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume) > > + RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL) > > }; > > > > static int mxc_gpio_syscore_suspend(void) > > @@ -695,7 +695,7 @@ static struct platform_driver mxc_gpio_driver = { > > .name = "gpio-mxc", > > .of_match_table = mxc_gpio_dt_ids, > > .suppress_bind_attrs = true, > > - .pm = &mxc_gpio_dev_pm_ops, > > + .pm = pm_ptr(&mxc_gpio_dev_pm_ops), > > }, > > .probe = mxc_gpio_probe, > > }; > > -- > > 2.34.1 > > > > Applied, thanks! > > Bart Nevermind, Arnd has a better fix for that so I'll apply his change. Bart
Hi Bartosz, On Thu, Jul 20, 2023 at 5:23 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote: > On Thu, Jul 20, 2023 at 5:17 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote: > > On Tue, Jul 11, 2023 at 9:20 AM Geert Uytterhoeven > > <geert+renesas@glider.be> wrote: > > > If CONFIG_PM=n (e.g. m68k/allmodconfig): > > > > > > drivers/gpio/gpio-mxc.c:612:12: error: ‘mxc_gpio_runtime_resume’ defined but not used [-Werror=unused-function] > > > 612 | static int mxc_gpio_runtime_resume(struct device *dev) > > > | ^~~~~~~~~~~~~~~~~~~~~~~ > > > drivers/gpio/gpio-mxc.c:602:12: error: ‘mxc_gpio_runtime_suspend’ defined but not used [-Werror=unused-function] > > > 602 | static int mxc_gpio_runtime_suspend(struct device *dev) > > > | ^~~~~~~~~~~~~~~~~~~~~~~~ > > > > > > Fix this by using the non-SET *_PM_OPS to configure the dev_pm_ops > > > callbacks, and by wrapping the driver.pm initializer insider pm_ptr(). > > > > > > As NOIRQ_SYSTEM_SLEEP_PM_OPS() uses pm_sleep_ptr() internally, the > > > __maybe_unused annotations for the noirq callbacks are no longer needed, > > > and can be removed. > > > > > > Fixes: 3283d820dce649ad ("gpio: mxc: add runtime pm support") > > > Reported-by: noreply@ellerman.id.au > > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> > > > --- > > > drivers/gpio/gpio-mxc.c | 10 +++++----- > > > 1 file changed, 5 insertions(+), 5 deletions(-) > > > > > > diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c > > > index a9fb6bd9aa6f9645..a43df5d5006e62d3 100644 > > > --- a/drivers/gpio/gpio-mxc.c > > > +++ b/drivers/gpio/gpio-mxc.c > > > @@ -623,7 +623,7 @@ static int mxc_gpio_runtime_resume(struct device *dev) > > > return 0; > > > } > > > > > > -static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev) > > > +static int mxc_gpio_noirq_suspend(struct device *dev) > > > { > > > struct platform_device *pdev = to_platform_device(dev); > > > struct mxc_gpio_port *port = platform_get_drvdata(pdev); > > > @@ -634,7 +634,7 @@ static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev) > > > return 0; > > > } > > > > > > -static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev) > > > +static int mxc_gpio_noirq_resume(struct device *dev) > > > { > > > struct platform_device *pdev = to_platform_device(dev); > > > struct mxc_gpio_port *port = platform_get_drvdata(pdev); > > > @@ -647,8 +647,8 @@ static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev) > > > } > > > > > > static const struct dev_pm_ops mxc_gpio_dev_pm_ops = { > > > - SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume) > > > - SET_RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL) > > > + NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume) > > > + RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL) > > > }; > > > > > > static int mxc_gpio_syscore_suspend(void) > > > @@ -695,7 +695,7 @@ static struct platform_driver mxc_gpio_driver = { > > > .name = "gpio-mxc", > > > .of_match_table = mxc_gpio_dt_ids, > > > .suppress_bind_attrs = true, > > > - .pm = &mxc_gpio_dev_pm_ops, > > > + .pm = pm_ptr(&mxc_gpio_dev_pm_ops), > > > }, > > > .probe = mxc_gpio_probe, > > > }; > > > -- > > > 2.34.1 > > > > > > > Applied, thanks! > > > > Bart > > Nevermind, Arnd has a better fix for that so I'll apply his change. I disagree. And my patch was first ;-) Arnd's version lacks the pm_ptr() around the mxc_gpio_driver.driver.pm initializer, so the compiler cannot throw out the (rather large) unused mxc_gpio_dev_pm_ops structure. Thanks! Gr{oetje,eeting}s, Geert
On Mon, Jul 24, 2023 at 6:50 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote: > > Hi Bartosz, > > On Thu, Jul 20, 2023 at 5:23 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote: > > On Thu, Jul 20, 2023 at 5:17 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote: > > > On Tue, Jul 11, 2023 at 9:20 AM Geert Uytterhoeven > > > <geert+renesas@glider.be> wrote: > > > > If CONFIG_PM=n (e.g. m68k/allmodconfig): > > > > > > > > drivers/gpio/gpio-mxc.c:612:12: error: ‘mxc_gpio_runtime_resume’ defined but not used [-Werror=unused-function] > > > > 612 | static int mxc_gpio_runtime_resume(struct device *dev) > > > > | ^~~~~~~~~~~~~~~~~~~~~~~ > > > > drivers/gpio/gpio-mxc.c:602:12: error: ‘mxc_gpio_runtime_suspend’ defined but not used [-Werror=unused-function] > > > > 602 | static int mxc_gpio_runtime_suspend(struct device *dev) > > > > | ^~~~~~~~~~~~~~~~~~~~~~~~ > > > > > > > > Fix this by using the non-SET *_PM_OPS to configure the dev_pm_ops > > > > callbacks, and by wrapping the driver.pm initializer insider pm_ptr(). > > > > > > > > As NOIRQ_SYSTEM_SLEEP_PM_OPS() uses pm_sleep_ptr() internally, the > > > > __maybe_unused annotations for the noirq callbacks are no longer needed, > > > > and can be removed. > > > > > > > > Fixes: 3283d820dce649ad ("gpio: mxc: add runtime pm support") > > > > Reported-by: noreply@ellerman.id.au > > > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> > > > > --- > > > > drivers/gpio/gpio-mxc.c | 10 +++++----- > > > > 1 file changed, 5 insertions(+), 5 deletions(-) > > > > > > > > diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c > > > > index a9fb6bd9aa6f9645..a43df5d5006e62d3 100644 > > > > --- a/drivers/gpio/gpio-mxc.c > > > > +++ b/drivers/gpio/gpio-mxc.c > > > > @@ -623,7 +623,7 @@ static int mxc_gpio_runtime_resume(struct device *dev) > > > > return 0; > > > > } > > > > > > > > -static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev) > > > > +static int mxc_gpio_noirq_suspend(struct device *dev) > > > > { > > > > struct platform_device *pdev = to_platform_device(dev); > > > > struct mxc_gpio_port *port = platform_get_drvdata(pdev); > > > > @@ -634,7 +634,7 @@ static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev) > > > > return 0; > > > > } > > > > > > > > -static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev) > > > > +static int mxc_gpio_noirq_resume(struct device *dev) > > > > { > > > > struct platform_device *pdev = to_platform_device(dev); > > > > struct mxc_gpio_port *port = platform_get_drvdata(pdev); > > > > @@ -647,8 +647,8 @@ static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev) > > > > } > > > > > > > > static const struct dev_pm_ops mxc_gpio_dev_pm_ops = { > > > > - SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume) > > > > - SET_RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL) > > > > + NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume) > > > > + RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL) > > > > }; > > > > > > > > static int mxc_gpio_syscore_suspend(void) > > > > @@ -695,7 +695,7 @@ static struct platform_driver mxc_gpio_driver = { > > > > .name = "gpio-mxc", > > > > .of_match_table = mxc_gpio_dt_ids, > > > > .suppress_bind_attrs = true, > > > > - .pm = &mxc_gpio_dev_pm_ops, > > > > + .pm = pm_ptr(&mxc_gpio_dev_pm_ops), > > > > }, > > > > .probe = mxc_gpio_probe, > > > > }; > > > > -- > > > > 2.34.1 > > > > > > > > > > Applied, thanks! > > > > > > Bart > > > > Nevermind, Arnd has a better fix for that so I'll apply his change. > > I disagree. And my patch was first ;-) > > Arnd's version lacks the pm_ptr() around the mxc_gpio_driver.driver.pm > initializer, so the compiler cannot throw out the (rather large) unused > mxc_gpio_dev_pm_ops structure. > > Thanks! > Fair enough, I replaced Arnd's patch with yours. Thanks, Bartosz
diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c index a9fb6bd9aa6f9645..a43df5d5006e62d3 100644 --- a/drivers/gpio/gpio-mxc.c +++ b/drivers/gpio/gpio-mxc.c @@ -623,7 +623,7 @@ static int mxc_gpio_runtime_resume(struct device *dev) return 0; } -static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev) +static int mxc_gpio_noirq_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct mxc_gpio_port *port = platform_get_drvdata(pdev); @@ -634,7 +634,7 @@ static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev) return 0; } -static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev) +static int mxc_gpio_noirq_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct mxc_gpio_port *port = platform_get_drvdata(pdev); @@ -647,8 +647,8 @@ static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev) } static const struct dev_pm_ops mxc_gpio_dev_pm_ops = { - SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume) - SET_RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL) + NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume) + RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL) }; static int mxc_gpio_syscore_suspend(void) @@ -695,7 +695,7 @@ static struct platform_driver mxc_gpio_driver = { .name = "gpio-mxc", .of_match_table = mxc_gpio_dt_ids, .suppress_bind_attrs = true, - .pm = &mxc_gpio_dev_pm_ops, + .pm = pm_ptr(&mxc_gpio_dev_pm_ops), }, .probe = mxc_gpio_probe, };