Message ID | 20221129191942.138244-6-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 q4csp525922wrr; Tue, 29 Nov 2022 11:25:29 -0800 (PST) X-Google-Smtp-Source: AA0mqf4tPeCzuMiwTTYaIo//H1JhoiT2BdRh7gC18E3+8XSrS2SGTOFzBXTwZs8WSp1BoQ7fs1Ki X-Received: by 2002:a05:6402:3485:b0:468:89dd:d326 with SMTP id v5-20020a056402348500b0046889ddd326mr35884872edc.352.1669749928967; Tue, 29 Nov 2022 11:25:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669749928; cv=none; d=google.com; s=arc-20160816; b=hZ87mWPr1/VsNqyWJRNwOJkfbHEhE92UjdY/zieQRh3EQ/5YHCJW/Ukeauy61ci39i R7JQEQ3t7ScJNZQdn7oPYup1SYXTQnebb7Z2Qu8Y0BW87OGP++Yzzq8LkitlltrlVz4t eyblwSOFti4toOHrRVnGRvOpXT8Rn2RkSgOVpiII4Ti0n5KlTtFiGu3+RYmj+XRLPbJ8 yMvyb3CLzcocDw+koD8xRun2F8v61WbWWOCzQ2W86sDAzd41HSqEGUk5CkIpisR202h0 XBfO1xVTsGEduYgb4uX92I597s0VMsXalqG63lZG+1nd5qpkYpiFTSJVs4WriY3G/Gvx jmMw== 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=93KzSvS5igs3S+cAbvCYD4WLcuFTokGvoynUcK5Icnw=; b=sdX8IjZyR2FPEA0EiZCunmRWjLxWxI7PW4XS0AUvWhCHzM+eKHOheVvYffVNI2OQ9t CMT1hD87s21u1lt8hwr6uzR+oNRM206XU7nJxYhnmHJDsjmM7tpy2mK56SinKja15ql3 bFWP1hsMLH/bQIuE9r5gZNUJqbHbORR0jw5A4RJ111EtCcHGLxpIZQj6ZzJ/Efs11nYB KAdKd+vCTrAMSzaeyN/qwhVuQFlLbkPBab6HY1xexCoF1e51D8yBizyhlO6T1/AnCa0Z JustMn5CNhMQOSdU9hjzlHmFGCa8N/iuglfQob0Gcb800BD3UGP3A/UddIfC5Nbw4D9D deHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=vF6P0PbF; 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 la26-20020a170907781a00b007c08e3b0e1asi1170132ejc.637.2022.11.29.11.24.55; Tue, 29 Nov 2022 11:25:28 -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=vF6P0PbF; 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 S236897AbiK2TXD (ORCPT <rfc822;rbbytesnap@gmail.com> + 99 others); Tue, 29 Nov 2022 14:23:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236931AbiK2TWl (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 29 Nov 2022 14:22:41 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F8D26F82F; Tue, 29 Nov 2022 11:20:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1669749598; 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=93KzSvS5igs3S+cAbvCYD4WLcuFTokGvoynUcK5Icnw=; b=vF6P0PbFzl3XQTIIeBBWk33b7nBsalJsw5sWVgBOpfAglBFB67FxzQSWsQwUrn2sbPwcof PDY5kynsihQ8MxQeQgm+f5SiDXDvYvV/eVpATZ8/VubDNplHqon2MmXPAUM8vuVxOUCMkq AZkSjDXGGJMWeM8hlCJbk6T5DeNVhzY= 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 19/26] drm: shmobile: Remove #ifdef guards for PM related functions Date: Tue, 29 Nov 2022 19:19:35 +0000 Message-Id: <20221129191942.138244-6-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?1750859701644451172?= X-GMAIL-MSGID: =?utf-8?q?1750859701644451172?= |
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/shmobile/shmob_drm_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:35PM +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> > --- > 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/shmobile/shmob_drm_drv.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c > index 3d511fa38913..337040fa6438 100644 > --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c > +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c > @@ -143,7 +143,6 @@ static const struct drm_driver shmob_drm_driver = { > * Power management > */ > > -#ifdef CONFIG_PM_SLEEP > static int shmob_drm_pm_suspend(struct device *dev) > { > struct shmob_drm_device *sdev = dev_get_drvdata(dev); > @@ -165,11 +164,9 @@ static int shmob_drm_pm_resume(struct device *dev) > drm_kms_helper_poll_enable(sdev->ddev); > return 0; > } > -#endif > > -static const struct dev_pm_ops shmob_drm_pm_ops = { > - SET_SYSTEM_SLEEP_PM_OPS(shmob_drm_pm_suspend, shmob_drm_pm_resume) > -}; > +static DEFINE_SIMPLE_DEV_PM_OPS(shmob_drm_pm_ops, > + shmob_drm_pm_suspend, shmob_drm_pm_resume); > > /* ----------------------------------------------------------------------------- > * Platform driver > @@ -292,7 +289,7 @@ static struct platform_driver shmob_drm_platform_driver = { > .remove = shmob_drm_remove, > .driver = { > .name = "shmob-drm", > - .pm = &shmob_drm_pm_ops, > + .pm = pm_sleep_ptr(&shmob_drm_pm_ops), > }, > }; >
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c index 3d511fa38913..337040fa6438 100644 --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c @@ -143,7 +143,6 @@ static const struct drm_driver shmob_drm_driver = { * Power management */ -#ifdef CONFIG_PM_SLEEP static int shmob_drm_pm_suspend(struct device *dev) { struct shmob_drm_device *sdev = dev_get_drvdata(dev); @@ -165,11 +164,9 @@ static int shmob_drm_pm_resume(struct device *dev) drm_kms_helper_poll_enable(sdev->ddev); return 0; } -#endif -static const struct dev_pm_ops shmob_drm_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(shmob_drm_pm_suspend, shmob_drm_pm_resume) -}; +static DEFINE_SIMPLE_DEV_PM_OPS(shmob_drm_pm_ops, + shmob_drm_pm_suspend, shmob_drm_pm_resume); /* ----------------------------------------------------------------------------- * Platform driver @@ -292,7 +289,7 @@ static struct platform_driver shmob_drm_platform_driver = { .remove = shmob_drm_remove, .driver = { .name = "shmob-drm", - .pm = &shmob_drm_pm_ops, + .pm = pm_sleep_ptr(&shmob_drm_pm_ops), }, };