Message ID | 20221107175106.360578-9-paul@crapouillou.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2201001wru; Mon, 7 Nov 2022 09:54:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf4sjZ04rVYvURNHlDgRgwKd/1ZJEVcgfkBD7xgjcTYfKUtbAbN2S6ki8MhNSioG60EgqZpc X-Received: by 2002:a05:6a00:8cd:b0:56e:fd68:6c6d with SMTP id s13-20020a056a0008cd00b0056efd686c6dmr8281006pfu.81.1667843691339; Mon, 07 Nov 2022 09:54:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667843691; cv=none; d=google.com; s=arc-20160816; b=wOk2j8K4BESdOVqhpeYvZ6asM1OEoVVyEt8fl3npi/5nzaNk1g6lphYCuzkIIRDVMV ub7wNjCuwyNDxTvNAWewVHBPc88Bv9c0vL61yGTyzSLvFcJqGepACyzcpIvZIRoD1Wz6 kxmVMgWQTtLoEi4EkdNnsK9xSGFTvHSElq6LotpQLAJrSBQyoL495+ECXWojisYRO8VS FAUaIHwZLJo7owS1KSZJiouUs+3ZZzlyFjCSt6DPFo8NPySa30bRoJ/3qj51JkZ7BU1F kTbkuj8s8wwcv6MuH98BRiJdOAK9vKaWvZxaH6mVwHYOir6cN0f+0/VF2iXee/I504qq sFpw== 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=J6lrUUQrnG1hoBLHHonfLfMerCAB94qKyHJkeyV1GEE=; b=v93u7w26Kea1EZSDo052Z/MkSXQ2wEC+h2xREUTOvtBbuUb2yupt9zKPx9PToVkB6+ Sgq4kokGSICVgm4Uj1qQ7cwskU3Lsr3+TU5K3lIf9oUh1iV95llEOfVKpqnah1iNBhyA 0U9HBn8sp2NZ3B+kt2/xzQgExFjgVD56YTkd7YRsD9sTi3/VjPpMzl1C817hd6XLfzSy skY0hu6k3ghKxkLE7/Ny0EpSPD+zpYFW0xZ7Mbkrt3QP2urUTjYjJEuaQhQYrLUyFUF0 OPAwTyV1F79L9JB/wolE6DC+r+FzXJcEh5633dUmAmiC+o0Q216+OG88Io/zzs1aAMUE a9vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b="mOQsq/Yg"; 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 e190-20020a621ec7000000b00541c0da3083si10155332pfe.302.2022.11.07.09.54.38; Mon, 07 Nov 2022 09:54:51 -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="mOQsq/Yg"; 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 S232537AbiKGRxN (ORCPT <rfc822;hjfbswb@gmail.com> + 99 others); Mon, 7 Nov 2022 12:53:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232544AbiKGRwr (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 7 Nov 2022 12:52:47 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D517D25E91 for <linux-kernel@vger.kernel.org>; Mon, 7 Nov 2022 09:52:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1667843480; 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=J6lrUUQrnG1hoBLHHonfLfMerCAB94qKyHJkeyV1GEE=; b=mOQsq/YgbgLowrcMuJ9PYfkUUJGVmSR0UC2N+mrw4pWcTL7x7t3PurcnDE9N741lXgI7xO Npdvj5CpH+prx/VHOjCE6UJ5J1y/Udi7n1P3AJ5AkbNLowSYbB+zInJeirWWJGxzKo1/xE c/X7buNkJ9fOXZGRBxb8e/gUfvI0qgM= From: Paul Cercueil <paul@crapouillou.net> To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>, 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>, Sam Ravnborg <sam@ravnborg.org>, Boris Brezillon <bbrezillon@kernel.org>, Nicolas Ferre <nicolas.ferre@microchip.com>, Alexandre Belloni <alexandre.belloni@bootlin.com>, Claudiu Beznea <claudiu.beznea@microchip.com>, linux-arm-kernel@lists.infradead.org Subject: [PATCH 08/26] drm: atmel-hlcdc: Remove #ifdef guards for PM related functions Date: Mon, 7 Nov 2022 17:50:48 +0000 Message-Id: <20221107175106.360578-9-paul@crapouillou.net> In-Reply-To: <20221107175106.360578-1-paul@crapouillou.net> References: <20221107175106.360578-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?1748860866275776425?= X-GMAIL-MSGID: =?utf-8?q?1748860866275776425?= |
Series |
drm: Get rid of #ifdef CONFIG_PM* guards
|
|
Commit Message
Paul Cercueil
Nov. 7, 2022, 5:50 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>
---
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Boris Brezillon <bbrezillon@kernel.org>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Claudiu Beznea <claudiu.beznea@microchip.com>
Cc: linux-arm-kernel@lists.infradead.org
---
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
Comments
On Mon, Nov 07, 2022 at 05:50:48PM +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> > --- > Cc: Sam Ravnborg <sam@ravnborg.org> > Cc: Boris Brezillon <bbrezillon@kernel.org> > Cc: Nicolas Ferre <nicolas.ferre@microchip.com> > Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> > Cc: Claudiu Beznea <claudiu.beznea@microchip.com> > Cc: linux-arm-kernel@lists.infradead.org Acked-by: Sam Ravnborg <sam@ravnborg.org> Thanks for taking care of this. Sam
On 07.11.2022 19:50, Paul Cercueil wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > 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> > --- > Cc: Sam Ravnborg <sam@ravnborg.org> > Cc: Boris Brezillon <bbrezillon@kernel.org> > Cc: Nicolas Ferre <nicolas.ferre@microchip.com> > Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> > Cc: Claudiu Beznea <claudiu.beznea@microchip.com> > Cc: linux-arm-kernel@lists.infradead.org Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com> > --- > drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c > index f7e7f4e919c7..05146936cc70 100644 > --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c > +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c > @@ -784,7 +784,6 @@ static int atmel_hlcdc_dc_drm_remove(struct platform_device *pdev) > return 0; > } > > -#ifdef CONFIG_PM_SLEEP > static int atmel_hlcdc_dc_drm_suspend(struct device *dev) > { > struct drm_device *drm_dev = dev_get_drvdata(dev); > @@ -815,10 +814,10 @@ static int atmel_hlcdc_dc_drm_resume(struct device *dev) > > return drm_atomic_helper_resume(drm_dev, dc->suspend.state); > } > -#endif > > -static SIMPLE_DEV_PM_OPS(atmel_hlcdc_dc_drm_pm_ops, > - atmel_hlcdc_dc_drm_suspend, atmel_hlcdc_dc_drm_resume); > +static DEFINE_SIMPLE_DEV_PM_OPS(atmel_hlcdc_dc_drm_pm_ops, > + atmel_hlcdc_dc_drm_suspend, > + atmel_hlcdc_dc_drm_resume); > > static const struct of_device_id atmel_hlcdc_dc_of_match[] = { > { .compatible = "atmel,hlcdc-display-controller" }, > @@ -830,7 +829,7 @@ static struct platform_driver atmel_hlcdc_dc_platform_driver = { > .remove = atmel_hlcdc_dc_drm_remove, > .driver = { > .name = "atmel-hlcdc-display-controller", > - .pm = &atmel_hlcdc_dc_drm_pm_ops, > + .pm = pm_sleep_ptr(&atmel_hlcdc_dc_drm_pm_ops), > .of_match_table = atmel_hlcdc_dc_of_match, > }, > }; > -- > 2.35.1 >
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c index f7e7f4e919c7..05146936cc70 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c @@ -784,7 +784,6 @@ static int atmel_hlcdc_dc_drm_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP static int atmel_hlcdc_dc_drm_suspend(struct device *dev) { struct drm_device *drm_dev = dev_get_drvdata(dev); @@ -815,10 +814,10 @@ static int atmel_hlcdc_dc_drm_resume(struct device *dev) return drm_atomic_helper_resume(drm_dev, dc->suspend.state); } -#endif -static SIMPLE_DEV_PM_OPS(atmel_hlcdc_dc_drm_pm_ops, - atmel_hlcdc_dc_drm_suspend, atmel_hlcdc_dc_drm_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(atmel_hlcdc_dc_drm_pm_ops, + atmel_hlcdc_dc_drm_suspend, + atmel_hlcdc_dc_drm_resume); static const struct of_device_id atmel_hlcdc_dc_of_match[] = { { .compatible = "atmel,hlcdc-display-controller" }, @@ -830,7 +829,7 @@ static struct platform_driver atmel_hlcdc_dc_platform_driver = { .remove = atmel_hlcdc_dc_drm_remove, .driver = { .name = "atmel-hlcdc-display-controller", - .pm = &atmel_hlcdc_dc_drm_pm_ops, + .pm = pm_sleep_ptr(&atmel_hlcdc_dc_drm_pm_ops), .of_match_table = atmel_hlcdc_dc_of_match, }, };