Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp3399987rwo; Mon, 24 Jul 2023 10:23:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlFHlYV6sNIM3INYyf8wLAAvzTvh2yE/DOVM/rqtz3xMzzG+sSrCjRtiFde2FATNEkRrooqC X-Received: by 2002:aa7:ccd0:0:b0:522:2a0c:d254 with SMTP id y16-20020aa7ccd0000000b005222a0cd254mr3928022edt.33.1690219419281; Mon, 24 Jul 2023 10:23:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690219419; cv=none; d=google.com; s=arc-20160816; b=WMqOpOKpv5Ua+0rNgzQNUXeOSHUerY3x6kqKco4lu8bISFzrbWuwyOOtMskC6z+B3Y LmWcEmqbyUgFyVAdaG5i3q14gIlwj/m6Vm3kpjZDr7AurlYPFeoBtW1E5rMDTayHt/UB IVCa4AhceAfovio3JGwfPTqaaf3mAQGmuHT6e5kW8w+NuBwb3rKehE868u+dU28nrGSD IharrCW86fBsPexaDcAju0GUtROxAML9d1qJuSRi/PaOGgFxapqMmws2dZZaidOtny9f 6rxkXfRDhSPVV0mAQl6WppUDP7UqgOkOMeLmN07034xYTJQ74nfnXynFImEfdFbJw463 9gZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=QFFn6SgMkkIipPX7swqIoO+93SQ5YAM6Npe9k05mQ9I=; fh=kPAqiH6x18mK4L1LYEVNYW+m4v5QVuFENQL+WLtvrF0=; b=fW5wvwikRRsV6ddmEBFP2zW4Lq/it7fiTZHvefYJdBCdON+LRXPJ3MCvq6U+CPfLe8 Mfv3YspzUw5rOro11zrZOafs6kGHz6kSnmUBg56WExx7+Ommog0i/ck0DVLz6NeH4eYV UM3vkRI2rtNPu+YIaleUCBpdufxMWe7jBx/OyhHimY2rWQnlPiXhQXb/gQoPxZLyyZKB jxGQDgze4Xxra7FVq4tPQRrNbTZDYN6GiNcdVCkoZ8YWrp5vP7pckPCr5iooxHOnpl63 XR4rkCR5Q31x2MLRJ8NTo3RJap1B+CnUGgHq2KF8AVelV5ULpMBRECUqr+sNSF/9y7b3 lHkQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v16-20020aa7cd50000000b0051e0ef8936asi6874032edw.291.2023.07.24.10.23.15; Mon, 24 Jul 2023 10:23:39 -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 S230139AbjGXQu5 convert rfc822-to-8bit (ORCPT + 99 others); Mon, 24 Jul 2023 12:50:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229853AbjGXQuz (ORCPT ); Mon, 24 Jul 2023 12:50:55 -0400 Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com [209.85.167.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47282D7; Mon, 24 Jul 2023 09:50:54 -0700 (PDT) Received: by mail-oi1-f174.google.com with SMTP id 5614622812f47-3a36b309524so3462457b6e.3; Mon, 24 Jul 2023 09:50:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690217453; x=1690822253; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y7TFRM2vKH90k3Dtf6CLI36a//C1NHq5z29tE+TVuvw=; b=KaRTk5xtWLXjkCrMXW1CDH2z5cNbiEiHzW13EFs2Gte5voHPahk+2Vm5Y6VYGm6Ot5 Ds2j2DuqYEFfOzppLTblKIPP1F7+vY7JVJoBjdEoQrueF+FIZ1bkpSVy5m79g5vTNzlq qcGRUVZJg8Tyf7UupjKWxvBDa2eHlaVFx/ul5N7VuRWe4veXv1vnfGlPqIXyeiyIpUAl 3LRlOFIX+zRoSsMeYof35Syh8p/tqmefYfd2bYme7Ro5e051o7psTI5QvafedupY+Rct C8s/nyF2hYyiGch/Ck7LGqJRN747ZPDvwThjcKE0kRMMKml/ZawD0c+bNHtaqWLJSn2u hNbg== X-Gm-Message-State: ABy/qLa/WtwA8Q5+B9xzXyfHZEUtZy2eIuPOj2e25gJYtOxLA8P3zZ8P aWyTLLkBYDJZyHrIFZFcDEvI4IjZh7qEpg== X-Received: by 2002:a54:4089:0:b0:3a1:dc7e:bb39 with SMTP id i9-20020a544089000000b003a1dc7ebb39mr10783173oii.18.1690217453321; Mon, 24 Jul 2023 09:50:53 -0700 (PDT) Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com. [209.85.219.173]) by smtp.gmail.com with ESMTPSA id v14-20020a81a54e000000b005773430a57csm2870741ywg.78.2023.07.24.09.50.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 Jul 2023 09:50:53 -0700 (PDT) Received: by mail-yb1-f173.google.com with SMTP id 3f1490d57ef6-ca4a6e11f55so3806428276.1; Mon, 24 Jul 2023 09:50:52 -0700 (PDT) X-Received: by 2002:a25:e0c2:0:b0:d06:e29e:9bca with SMTP id x185-20020a25e0c2000000b00d06e29e9bcamr6446755ybg.55.1690217452760; Mon, 24 Jul 2023 09:50:52 -0700 (PDT) MIME-Version: 1.0 References: <20230711072053.2837327-1-geert+renesas@glider.be> In-Reply-To: From: Geert Uytterhoeven Date: Mon, 24 Jul 2023 18:50:41 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] gpio: mxc: Improve PM configuration To: Bartosz Golaszewski Cc: Linus Walleij , Andy Shevchenko , Shenwei Wang , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org Hi Bartosz, On Thu, Jul 20, 2023 at 5:23 PM Bartosz Golaszewski wrote: > On Thu, Jul 20, 2023 at 5:17 PM Bartosz Golaszewski wrote: > > On Tue, Jul 11, 2023 at 9:20 AM Geert Uytterhoeven > > 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 > > > --- > > > 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 -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds