Message ID | 20221107175256.360839-11-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 l7csp2202004wru; Mon, 7 Nov 2022 09:57:00 -0800 (PST) X-Google-Smtp-Source: AMsMyM5j4gwQEyZvFbx4ruEEcIDdlhvHEyVVrz2UcIHY/bu0eGJWfl7MMVqgj+EQwG26aJC3/g1R X-Received: by 2002:a17:902:b7c8:b0:188:537d:ad0d with SMTP id v8-20020a170902b7c800b00188537dad0dmr25015323plz.112.1667843820168; Mon, 07 Nov 2022 09:57:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667843820; cv=none; d=google.com; s=arc-20160816; b=e+lt4GkNt57hBCviFhOaVpLgOuJ/dLzKNL6sLkGmqLTI/zWezRBSJdkN2Gpv826Pib q8CHJC7wUSAH3V01J2KhNSrFY6IQPlJWsTXbpkiR26cvJZwudXJCSu2jdOUsvUlKDM5F pRExLLQAPbqp0xFkIcv7o1hfId0e+tyUddduCSjLw1kQ9c7RG2ShuqFuTSe9OaMPQ/Wh kpPNO1u6RgMWO8GD4vkvRkkg0bGB+cr6iV+eka1bAu1nEEECPXrOaeKhQK2kPgeGDe7/ u9DKrsuTURdKyLpgqlA7x0l1/ajGcggBMdUkPr0dZTT2d1y/3tRky/1bHF9aU0zHxB4e yXhg== 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=yJBAdivZchmEtJwMCV+Ir3IdI2sK9lAdweiG3PvAk1M=; b=UWMJ01BeBNf5R1oR9z6m7C325fiIM0xX3YO4W4zKI94PN7VlV/eMyekd6iLpUv4hUY /RIHttMyiAmw3HEnjJNHLuzsfhtuflHWW97zNZi3K3g0cvl5GflyDVzowznGHBEJWr5j jmdPImVom/BwkETYEHo+x4UDkB18CnTfwZ6EXxcokx6CU8/b3GyABEGcQLnfSxwnuUja bdYKS+2b1isrWYTRFhU44Thub/NeEpgCbZ8IHAgUIWYgbDRrlZ+m4wb+xJHzqpU/YWzb rC8b8wKiPbpYUqM9n6970vUGhTOWVJrRVj4HroJTD7OiDBB1RRjJc6dXMoKJhhSdrkNC hiiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=gbQ52Pey; 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 j1-20020a170902c3c100b001784c98bfddsi9856743plj.24.2022.11.07.09.56.46; Mon, 07 Nov 2022 09:57:00 -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=gbQ52Pey; 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 S232832AbiKGR41 (ORCPT <rfc822;hjfbswb@gmail.com> + 99 others); Mon, 7 Nov 2022 12:56:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232033AbiKGRzF (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 7 Nov 2022 12:55:05 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BDA924F3F for <linux-kernel@vger.kernel.org>; Mon, 7 Nov 2022 09:54:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1667843595; 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=yJBAdivZchmEtJwMCV+Ir3IdI2sK9lAdweiG3PvAk1M=; b=gbQ52Peys2tN5G9YAucMuOQ/E9FwpYYiTaey3zV+AzjXvtY5Pqygg9DUs2xBvjQg0DlWlz 4tGvGmoadQ1ochh2n3uL6P0JgRf8/OJYjRywOYuwSYTUOzg1qGnmwJhOOBIdsEwE0NbE7c vTVRPFI5+nMWEh2n17Kbo6Ix3CF3yBA= 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>, Jyri Sarha <jyri.sarha@iki.fi>, Tomi Valkeinen <tomba@kernel.org> Subject: [PATCH 21/26] drm: tilcdc: Remove #ifdef guards for PM related functions Date: Mon, 7 Nov 2022 17:52:51 +0000 Message-Id: <20221107175256.360839-11-paul@crapouillou.net> In-Reply-To: <20221107175256.360839-1-paul@crapouillou.net> References: <20221107175106.360578-1-paul@crapouillou.net> <20221107175256.360839-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?1748861001510634156?= X-GMAIL-MSGID: =?utf-8?q?1748861001510634156?= |
Series |
drm: Get rid of #ifdef CONFIG_PM* guards
|
|
Commit Message
Paul Cercueil
Nov. 7, 2022, 5:52 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: Jyri Sarha <jyri.sarha@iki.fi>
Cc: Tomi Valkeinen <tomba@kernel.org>
---
drivers/gpu/drm/tilcdc/tilcdc_drv.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index f72755b8ea14..cd5bdc2f803a 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c @@ -496,7 +496,6 @@ static const struct drm_driver tilcdc_driver = { * Power management: */ -#ifdef CONFIG_PM_SLEEP static int tilcdc_pm_suspend(struct device *dev) { struct drm_device *ddev = dev_get_drvdata(dev); @@ -518,11 +517,9 @@ static int tilcdc_pm_resume(struct device *dev) pinctrl_pm_select_default_state(dev); return drm_mode_config_helper_resume(ddev); } -#endif -static const struct dev_pm_ops tilcdc_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(tilcdc_pm_suspend, tilcdc_pm_resume) -}; +static DEFINE_SIMPLE_DEV_PM_OPS(tilcdc_pm_ops, + tilcdc_pm_suspend, tilcdc_pm_resume); /* * Platform driver: @@ -597,7 +594,7 @@ static struct platform_driver tilcdc_platform_driver = { .remove = tilcdc_pdev_remove, .driver = { .name = "tilcdc", - .pm = &tilcdc_pm_ops, + .pm = pm_sleep_ptr(&tilcdc_pm_ops), .of_match_table = tilcdc_of_match, }, };