Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1302665rwb; Tue, 29 Nov 2022 11:35:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf66hHz5Wn6n1mF68Zn52drEPDV1k6u0jrJ72f06/45g5xtgyr0ehShnFZL51bFCbXBIt0xC X-Received: by 2002:a17:906:f114:b0:7c0:7d70:facd with SMTP id gv20-20020a170906f11400b007c07d70facdmr7609163ejb.645.1669750523806; Tue, 29 Nov 2022 11:35:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669750523; cv=none; d=google.com; s=arc-20160816; b=w10cjnS22phvXwCr1eucArf1AGGZxaYyG7kGXru9NpXfxNIGEtulXWVIC4oKreghxl q12yhm/m6b2wa6y+6/qbGYc87P+yHPe9ZqqdXO/85aXOhluHS8FBOvsTBmss7h4iRqdF C2vcMlB6QlNyriWJDW+xF09qdpdoQdiFhEB1lEHYqAOox9msYydphOza0BkaK/agjV2c seonos8kYK6hQK6FxYw+/ROzXvGnH1F4qlLJMaH3r5mYgvEbwzI/2+cwXwFwcym1u7NK D/CZKbrrfUfvR37OsaBPmqQ6MNu37qYauY234kZUZAxM6Za5Wfm/pj+Nq7E6EHwVyX27 6XOA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nd39-20020a17090762a700b0078dce2b1985si13906056ejc.134.2022.11.29.11.34.59; Tue, 29 Nov 2022 11:35:23 -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 + 84 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 ); 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 To: David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Paul Cercueil , Kieran Bingham , Laurent Pinchart , 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: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Kieran Bingham --- Cc: Laurent Pinchart Cc: Kieran Bingham 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, }, }; -- 2.35.1