Message ID | 20221129191942.138244-4-paul@crapouillou.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp525635wrr; Tue, 29 Nov 2022 11:24:43 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Ca1Rh4+zKRuw0+hZ4DnIyAjoeJPIrLXUKM088AoX5aoVjpvXlM4gulVdLxy+GDSrt+Zuo X-Received: by 2002:a17:906:2817:b0:7ba:da1f:a727 with SMTP id r23-20020a170906281700b007bada1fa727mr25028249ejc.276.1669749883607; Tue, 29 Nov 2022 11:24:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669749883; cv=none; d=google.com; s=arc-20160816; b=e35setuMlLmv8Kcxj5INquANY5dek0O+zzz4JxnqoNUX6oMN9C9RP16IBpBLCxO1xL MWHnxNK2un596lrFSu3AxGxc57oLrfO4bLnJVQ0ov1G9X23QHZubEvN95t3zmIPOEo5G cLONOr6XNWO1MwROuUjscd/8XbGuQApuD0MCvihFPZL2J/y674+rDyK97PIpAMOCiYJu wX7i4fxzAoLPDgurgxvEJvq+mMxCXPey5snOG0WCijGIWzPp0jqKkyT4+twklHHxOeqz PJ3/hqGDKoGTv+PBQE0rBWgSKS0YKGlfF0/7Nkt/0Fc++HiPAvfcHHZhr3rHAoYl7xB+ ylLg== 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=cJkd7RTlZ/tYJRcRZWVNstn3toofhEeX9u1GcJR6nBQ=; b=nv4jZCbQ78g1E58CbhF/uMwoNOseNQj4SRp+BGObVUh7pP/cRYDGZGdvbO21yJ80Sf ce7FCiAbvD7rR3RrHd8mC2OwkFeQR0RZjngbk4xE+qU37NBMPq7xbnlCt78dblcERbq7 3mzHtOczolOrLWXS9YylNezwn6JE3eC57Ydbvq6ay8abRJPq/Z7cZJrqgTv+ohqM0MG3 iLBMBtd5zQUWMUtlxNXezA+TBr+AWb6S3D7YCv8npKmpwV7+0itH6LH//JlHvr7BBoNk EOXbl1A+6HOo+K1tqa0bPYoekU5wTxyMYPr4J+1ww6GxLtj6E5xWx8JDhdEsP/0Tzrjt og5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=frKJZENc; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w10-20020a05640234ca00b004627d582888si13339324edc.24.2022.11.29.11.24.20; Tue, 29 Nov 2022 11:24:43 -0800 (PST) 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=@crapouillou.net header.s=mail header.b=frKJZENc; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236917AbiK2TW1 (ORCPT <rfc822;rbbytesnap@gmail.com> + 99 others); Tue, 29 Nov 2022 14:22:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236944AbiK2TV6 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 29 Nov 2022 14:21:58 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 277C46F37F; Tue, 29 Nov 2022 11:20:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1669749596; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cJkd7RTlZ/tYJRcRZWVNstn3toofhEeX9u1GcJR6nBQ=; b=frKJZENcWkEdn/Szt43naXV3W7zH6A8igNeDsUNMGtmkuXxJ8WxVxGdQH6Zlc50iytxAOY +6Y5NpLVwk6vHosTN874YUgdEAmr5uTuVCRHeL12Ey8RppruudcW6Z1GTNBK7hkHJXrL1i j+GSCiaPXxIIEZQ+t3/eBOuyi2Geaqo= From: Paul Cercueil <paul@crapouillou.net> To: David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch> Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Paul Cercueil <paul@crapouillou.net>, Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, linux-renesas-soc@vger.kernel.org Subject: [PATCH v2 17/26] drm: rcar-du: Remove #ifdef guards for PM related functions Date: Tue, 29 Nov 2022 19:19:33 +0000 Message-Id: <20221129191942.138244-4-paul@crapouillou.net> In-Reply-To: <20221129191942.138244-1-paul@crapouillou.net> References: <20221129191733.137897-1-paul@crapouillou.net> <20221129191942.138244-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750859653768861115?= X-GMAIL-MSGID: =?utf-8?q?1750859653768861115?= |
Series |
None
|
|
Commit Message
Paul Cercueil
Nov. 29, 2022, 7:19 p.m. UTC
Use the DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> --- Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Cc: linux-renesas-soc@vger.kernel.org --- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
Comments
Hi Paul, Thank you for the patch. On Tue, Nov 29, 2022 at 07:19:33PM +0000, Paul Cercueil wrote: > Use the DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle > the .suspend/.resume callbacks. > > These macros allow the suspend and resume functions to be automatically > dropped by the compiler when CONFIG_SUSPEND is disabled, without having > to use #ifdef guards. > > This has the advantage of always compiling these functions in, > independently of any Kconfig option. Thanks to that, bugs and other > regressions are subsequently easier to catch. > > Signed-off-by: Paul Cercueil <paul@crapouillou.net> > Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Will you get this whole series merged in one go in drm-misc, or do you expect me to take this patch in my tree ? I'd prefer the first option if possible (less work for me :-)). > --- > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> > Cc: linux-renesas-soc@vger.kernel.org > --- > drivers/gpu/drm/rcar-du/rcar_du_drv.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c > index d003e8d9e7a2..eeec1e02446f 100644 > --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c > +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c > @@ -599,7 +599,6 @@ static const struct drm_driver rcar_du_driver = { > * Power management > */ > > -#ifdef CONFIG_PM_SLEEP > static int rcar_du_pm_suspend(struct device *dev) > { > struct rcar_du_device *rcdu = dev_get_drvdata(dev); > @@ -613,11 +612,9 @@ static int rcar_du_pm_resume(struct device *dev) > > return drm_mode_config_helper_resume(&rcdu->ddev); > } > -#endif > > -static const struct dev_pm_ops rcar_du_pm_ops = { > - SET_SYSTEM_SLEEP_PM_OPS(rcar_du_pm_suspend, rcar_du_pm_resume) > -}; > +static DEFINE_SIMPLE_DEV_PM_OPS(rcar_du_pm_ops, > + rcar_du_pm_suspend, rcar_du_pm_resume); > > /* ----------------------------------------------------------------------------- > * Platform driver > @@ -712,7 +709,7 @@ static struct platform_driver rcar_du_platform_driver = { > .shutdown = rcar_du_shutdown, > .driver = { > .name = "rcar-du", > - .pm = &rcar_du_pm_ops, > + .pm = pm_sleep_ptr(&rcar_du_pm_ops), > .of_match_table = rcar_du_of_table, > }, > };
Hi Laurent, Le mardi 29 novembre 2022 à 21:43 +0200, Laurent Pinchart a écrit : > Hi Paul, > > Thank you for the patch. > > On Tue, Nov 29, 2022 at 07:19:33PM +0000, Paul Cercueil wrote: > > Use the DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to > > handle > > the .suspend/.resume callbacks. > > > > These macros allow the suspend and resume functions to be > > automatically > > dropped by the compiler when CONFIG_SUSPEND is disabled, without > > having > > to use #ifdef guards. > > > > This has the advantage of always compiling these functions in, > > independently of any Kconfig option. Thanks to that, bugs and other > > regressions are subsequently easier to catch. > > > > Signed-off-by: Paul Cercueil <paul@crapouillou.net> > > Reviewed-by: Kieran Bingham > > <kieran.bingham+renesas@ideasonboard.com> > > Reviewed-by: Laurent Pinchart > <laurent.pinchart+renesas@ideasonboard.com> > > Will you get this whole series merged in one go in drm-misc, or do > you > expect me to take this patch in my tree ? I'd prefer the first option > if > possible (less work for me :-)). I actually answered that in my cover letter ;) However I assumed it had to go through drm-next, if you think it can go through drm-misc-next, I can apply it myself. Cheers, -Paul > > > --- > > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> > > Cc: linux-renesas-soc@vger.kernel.org > > --- > > drivers/gpu/drm/rcar-du/rcar_du_drv.c | 9 +++------ > > 1 file changed, 3 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c > > b/drivers/gpu/drm/rcar-du/rcar_du_drv.c > > index d003e8d9e7a2..eeec1e02446f 100644 > > --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c > > +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c > > @@ -599,7 +599,6 @@ static const struct drm_driver rcar_du_driver = > > { > > * Power management > > */ > > > > -#ifdef CONFIG_PM_SLEEP > > static int rcar_du_pm_suspend(struct device *dev) > > { > > struct rcar_du_device *rcdu = dev_get_drvdata(dev); > > @@ -613,11 +612,9 @@ static int rcar_du_pm_resume(struct device > > *dev) > > > > return drm_mode_config_helper_resume(&rcdu->ddev); > > } > > -#endif > > > > -static const struct dev_pm_ops rcar_du_pm_ops = { > > - SET_SYSTEM_SLEEP_PM_OPS(rcar_du_pm_suspend, > > rcar_du_pm_resume) > > -}; > > +static DEFINE_SIMPLE_DEV_PM_OPS(rcar_du_pm_ops, > > + rcar_du_pm_suspend, > > rcar_du_pm_resume); > > > > /* --------------------------------------------------------------- > > -------------- > > * Platform driver > > @@ -712,7 +709,7 @@ static struct platform_driver > > rcar_du_platform_driver = { > > .shutdown = rcar_du_shutdown, > > .driver = { > > .name = "rcar-du", > > - .pm = &rcar_du_pm_ops, > > + .pm = pm_sleep_ptr(&rcar_du_pm_ops), > > .of_match_table = rcar_du_of_table, > > }, > > }; >
Hi Paul, On Tue, Nov 29, 2022 at 09:05:49PM +0000, Paul Cercueil wrote: > Le mardi 29 novembre 2022 à 21:43 +0200, Laurent Pinchart a écrit : > > On Tue, Nov 29, 2022 at 07:19:33PM +0000, Paul Cercueil wrote: > > > Use the DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle > > > the .suspend/.resume callbacks. > > > > > > These macros allow the suspend and resume functions to be automatically > > > dropped by the compiler when CONFIG_SUSPEND is disabled, without having > > > to use #ifdef guards. > > > > > > This has the advantage of always compiling these functions in, > > > independently of any Kconfig option. Thanks to that, bugs and other > > > regressions are subsequently easier to catch. > > > > > > Signed-off-by: Paul Cercueil <paul@crapouillou.net> > > > Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> > > > > Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> > > > > Will you get this whole series merged in one go in drm-misc, or do you > > expect me to take this patch in my tree ? I'd prefer the first option if > > possible (less work for me :-)). > > I actually answered that in my cover letter ;) Oops. I read until "V2" and didn't notice the last paragraph, sorry. > However I assumed it had to go through drm-next, if you think it can go > through drm-misc-next, I can apply it myself. This seems like a good candidate for drm-misc to me. > > > --- > > > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > > Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> > > > Cc: linux-renesas-soc@vger.kernel.org > > > --- > > > drivers/gpu/drm/rcar-du/rcar_du_drv.c | 9 +++------ > > > 1 file changed, 3 insertions(+), 6 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c > > > b/drivers/gpu/drm/rcar-du/rcar_du_drv.c > > > index d003e8d9e7a2..eeec1e02446f 100644 > > > --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c > > > +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c > > > @@ -599,7 +599,6 @@ static const struct drm_driver rcar_du_driver = > > > { > > > * Power management > > > */ > > > > > > -#ifdef CONFIG_PM_SLEEP > > > static int rcar_du_pm_suspend(struct device *dev) > > > { > > > struct rcar_du_device *rcdu = dev_get_drvdata(dev); > > > @@ -613,11 +612,9 @@ static int rcar_du_pm_resume(struct device > > > *dev) > > > > > > return drm_mode_config_helper_resume(&rcdu->ddev); > > > } > > > -#endif > > > > > > -static const struct dev_pm_ops rcar_du_pm_ops = { > > > - SET_SYSTEM_SLEEP_PM_OPS(rcar_du_pm_suspend, > > > rcar_du_pm_resume) > > > -}; > > > +static DEFINE_SIMPLE_DEV_PM_OPS(rcar_du_pm_ops, > > > + rcar_du_pm_suspend, > > > rcar_du_pm_resume); > > > > > > /* --------------------------------------------------------------- > > > -------------- > > > * Platform driver > > > @@ -712,7 +709,7 @@ static struct platform_driver > > > rcar_du_platform_driver = { > > > .shutdown = rcar_du_shutdown, > > > .driver = { > > > .name = "rcar-du", > > > - .pm = &rcar_du_pm_ops, > > > + .pm = pm_sleep_ptr(&rcar_du_pm_ops), > > > .of_match_table = rcar_du_of_table, > > > }, > > > };
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c index d003e8d9e7a2..eeec1e02446f 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c @@ -599,7 +599,6 @@ static const struct drm_driver rcar_du_driver = { * Power management */ -#ifdef CONFIG_PM_SLEEP static int rcar_du_pm_suspend(struct device *dev) { struct rcar_du_device *rcdu = dev_get_drvdata(dev); @@ -613,11 +612,9 @@ static int rcar_du_pm_resume(struct device *dev) return drm_mode_config_helper_resume(&rcdu->ddev); } -#endif -static const struct dev_pm_ops rcar_du_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(rcar_du_pm_suspend, rcar_du_pm_resume) -}; +static DEFINE_SIMPLE_DEV_PM_OPS(rcar_du_pm_ops, + rcar_du_pm_suspend, rcar_du_pm_resume); /* ----------------------------------------------------------------------------- * Platform driver @@ -712,7 +709,7 @@ static struct platform_driver rcar_du_platform_driver = { .shutdown = rcar_du_shutdown, .driver = { .name = "rcar-du", - .pm = &rcar_du_pm_ops, + .pm = pm_sleep_ptr(&rcar_du_pm_ops), .of_match_table = rcar_du_of_table, }, };