Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp4256964rwo; Tue, 25 Jul 2023 03:19:55 -0700 (PDT) X-Google-Smtp-Source: APBJJlE0rfwwL2TtDC3FRi5ZRehiLV0rcuqUMJJT4IC0uWdtNOL/J36ame4kL/R2usFcg7dhyzv+ X-Received: by 2002:a05:6a20:4312:b0:128:ffb7:dcfe with SMTP id h18-20020a056a20431200b00128ffb7dcfemr2104226pzk.1.1690280394627; Tue, 25 Jul 2023 03:19:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690280394; cv=none; d=google.com; s=arc-20160816; b=GNGOA5krJGUrqS2FkGZFdzjc4Qxp/2ALkxQLan5F8kOF4ZRKNb6kENPna11V7saHe0 UqHmBCXcdEtU7IZCy6A0sgeUs2/nSdQqX0BMG0RcPVTo9Gjr19c9SMr+FDGZqJcT/gJh nzxikMIGojnbSye8O3xLtRHhXUfr2lASrAfX7m2TWpnby+BcfqGcvfGGSsNXq/K3WqQI 8i0Y/B1Di1UJ3rDo1qIYin8EMuu9smy20bDccghiqpCVySLCT8aF9uECCA8VeAOLzYg3 VrZgwXNgVauohpbpmfPVdjfo7y2Wm+dMdNEIwNMN/bUqG0IXoDKo5Ot9gr0yu1lVxIbu 3tRQ== 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 :dkim-signature; bh=l0CXr8qUO3I0b7KpmPpq9/x2xv1za5Y0XE1WB4W2dco=; fh=1bJG1phYehD5MYOYq8NI2WpKc7Whqn+MUsBeFncweN8=; b=S9uJ0rbLdYmTXsUHSB7Qj+eWKdJ1IZqS3RhCkg0ywMLCMJTIy8QiOLAzeIBHwTX6bp kybZhGyLiOzdqPe4U2bPaGRNMc0Q1yq8+32Nqqnjdl/v28F5XpHIfRYVbDmoC5oBxluM 8rJz9qcSbP2HZzeAJ3oPqLmUbiueNKzhwGv9DYR2CegVXWIbhy4WlN8OBZV9/Ucp/AFj nm70UdoVHIDS/MFj3Wwdp2YnpqhiG25P8wAdFyhqTGkVVFScTsquPibm13iAcdoScT9P sqH7tYf/jYaBBFOeJd037lOkAJlOOmI/1D6NuBb3VQiRXyxRYyjMvyj8awuA8Zzn5+y8 kZ/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20221208.gappssmtp.com header.s=20221208 header.b=lL+qxX++; 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 w4-20020a656944000000b00551bb2b99besi7189141pgq.85.2023.07.25.03.19.42; Tue, 25 Jul 2023 03:19:54 -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; dkim=pass header.i=@bgdev-pl.20221208.gappssmtp.com header.s=20221208 header.b=lL+qxX++; 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 S233529AbjGYJ6d (ORCPT + 99 others); Tue, 25 Jul 2023 05:58:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232939AbjGYJ6X (ORCPT ); Tue, 25 Jul 2023 05:58:23 -0400 Received: from mail-ua1-x92b.google.com (mail-ua1-x92b.google.com [IPv6:2607:f8b0:4864:20::92b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8757E1FC6 for ; Tue, 25 Jul 2023 02:58:13 -0700 (PDT) Received: by mail-ua1-x92b.google.com with SMTP id a1e0cc1a2514c-794b8fe8cc4so4212943241.0 for ; Tue, 25 Jul 2023 02:58:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1690279092; x=1690883892; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=l0CXr8qUO3I0b7KpmPpq9/x2xv1za5Y0XE1WB4W2dco=; b=lL+qxX++mKtv4r4f3KBsqJpG6c+NUpeIZF7o8MnMcy+bdBdH7QAGMhjJD+hATUi3V3 6uHgehJ6yU6DCnQ5z2KMjsI6OGboAZiIPy45Eyu8SEh24DIiOdYd76Dp3u8vGPGBX5nm HY8JhyPgSv3zfr0ULBKqdi/spIsqYrkDvLYEzRUDAQxbkfIzpbse4pWmwovfd+Hpf8xH 1lUspD322S0cE1WXgBeDjIO8sZ6ARh4/K6gsk2HaSLVyf3BbcCv5tiAf+JlGaUnj/tPM BaJqcicgsKxWwJeUlnUS2/U4ZfWGCoBFkEAsewMSAq9+rL++k5Dig/Yg5ldU8qmR8o+X PUdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690279092; x=1690883892; 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=l0CXr8qUO3I0b7KpmPpq9/x2xv1za5Y0XE1WB4W2dco=; b=dwW3hmzETpUK90IWHTHVzdqNBcXQ3u/9S37zgkhoky0WOLw2MQdydJmzZvM6MNJZKJ z2bJGitpqn7WmL7q3c1ihtQ265VHmD2WWgOoYmcd+P8KW+AdHuJ58r4OOVhbUPENJZ7W iiqi54OXpXsbzGjf8Eo/aNPnZDhX4CMSo9LJbMYyl+9rysP43p/xPWkwYvrTe9hqdndw 5tazZ/6iq0+AG/K4sFCSnVHXfsTTBS0ReyOltuuH3omFJTGPzzewaWNugbDVJmYCm/xN i6n6y3fgjp5NVl1hA+BAevbWIxN1TuMaqGJxfGzZVZwtUUPw2ZHPuHAdOlEbQ8TJcYYY 1w+A== X-Gm-Message-State: ABy/qLYo4VqmQxuU4CX5P6yzTPYxbmLtGnjAkZrzj+MxO7Vfoej7kwA1 DTJ071op7pe0VjIuIojd9zoEzUbnig4txAfKnEhzdw== X-Received: by 2002:a67:f5c3:0:b0:43f:3426:9e35 with SMTP id t3-20020a67f5c3000000b0043f34269e35mr517225vso.12.1690279092356; Tue, 25 Jul 2023 02:58:12 -0700 (PDT) MIME-Version: 1.0 References: <20230711072053.2837327-1-geert+renesas@glider.be> In-Reply-To: From: Bartosz Golaszewski Date: Tue, 25 Jul 2023 11:58:01 +0200 Message-ID: Subject: Re: [PATCH] gpio: mxc: Improve PM configuration To: Geert Uytterhoeven 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: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 24, 2023 at 6:50=E2=80=AFPM Geert Uytterhoeven wrote: > > Hi Bartosz, > > On Thu, Jul 20, 2023 at 5:23=E2=80=AFPM Bartosz Golaszewski wrote: > > On Thu, Jul 20, 2023 at 5:17=E2=80=AFPM Bartosz Golaszewski wrote: > > > On Tue, Jul 11, 2023 at 9:20=E2=80=AFAM Geert Uytterhoeven > > > wrote: > > > > If CONFIG_PM=3Dn (e.g. m68k/allmodconfig): > > > > > > > > drivers/gpio/gpio-mxc.c:612:12: error: =E2=80=98mxc_gpio_runtim= e_resume=E2=80=99 defined but not used [-Werror=3Dunused-function] > > > > 612 | static int mxc_gpio_runtime_resume(struct device *dev) > > > > | ^~~~~~~~~~~~~~~~~~~~~~~ > > > > drivers/gpio/gpio-mxc.c:602:12: error: =E2=80=98mxc_gpio_runtim= e_suspend=E2=80=99 defined but not used [-Werror=3Dunused-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 ne= eded, > > > > 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 devic= e *dev) > > > > return 0; > > > > } > > > > > > > > -static int __maybe_unused mxc_gpio_noirq_suspend(struct device *de= v) > > > > +static int mxc_gpio_noirq_suspend(struct device *dev) > > > > { > > > > struct platform_device *pdev =3D to_platform_device(dev); > > > > struct mxc_gpio_port *port =3D platform_get_drvdata(pdev); > > > > @@ -634,7 +634,7 @@ static int __maybe_unused mxc_gpio_noirq_suspen= d(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 =3D to_platform_device(dev); > > > > struct mxc_gpio_port *port =3D 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 =3D { > > > > - SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_g= pio_noirq_resume) > > > > - SET_RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runti= me_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_r= esume, NULL) > > > > }; > > > > > > > > static int mxc_gpio_syscore_suspend(void) > > > > @@ -695,7 +695,7 @@ static struct platform_driver mxc_gpio_driver = =3D { > > > > .name =3D "gpio-mxc", > > > > .of_match_table =3D mxc_gpio_dt_ids, > > > > .suppress_bind_attrs =3D true, > > > > - .pm =3D &mxc_gpio_dev_pm_ops, > > > > + .pm =3D pm_ptr(&mxc_gpio_dev_pm_ops), > > > > }, > > > > .probe =3D 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