Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2198404rwb; Mon, 7 Nov 2022 10:17:07 -0800 (PST) X-Google-Smtp-Source: AMsMyM5cbvJaD5mY0Rii9O04wjAFa/AlTp/1hehOI/J59XZSv3t+6cz4M7tV5h4zI0KwN8jK8Q+H X-Received: by 2002:a17:907:b602:b0:7ad:e82c:3355 with SMTP id vl2-20020a170907b60200b007ade82c3355mr36052547ejc.3.1667845027335; Mon, 07 Nov 2022 10:17:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667845027; cv=none; d=google.com; s=arc-20160816; b=eVj59p4a2iFzFVkGwqAOnxTF2f02owRo2B4CimiFg9MbQsQPXBVc7HU6MEjycdkLJv pb1D/Z95M9DLs5BtoTpfOHj7tvUsoeENkZ0MZhiqHe33KYuc2IlNc5mbAbQpnGogxxh7 6hlZRg2auUXHZ6i6VWVcFqFpz/VpLXj2TIFs/Gf0AGgkiOp6ifU6sdDU3DELGhpqyDbo eTNrPQ0dghbBO7QximVr41/IuNYXgI6w8lne/qfRCVcjAq4oxSHE9SK8WaHuLFWjWqdd 91j1caZxbSRf6XS+bwCS7qj5UxVfwUYOPeaDuij0TV+aGCgdbyasxZ6SqgCs2e3PnDST fakA== 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=FpKBRvbfGxTJfnKV4fn4HQn1v0QW6PL5yfSkhMzLybQ=; b=ugG9aof3xmCwChvcvrBKTn3CyIWhuwQRYeF3mDol+3CtiH5Y85j11SxMbFOgNnHJT3 K5GOVshw2fwDtobjOtb9cZbkjTMfYPQ2FwKZtRmdvOEZKpIGqP9NSjBKcPuOcSckH8hy i8H0FX2+rW36MhZDdDLMUadvQzGBenn+Cr4OMYfr7KLtvk5l1DzuKRAm3PmdgB8TyQe9 +vJJEYbbEqv0CNMpgyZmDk9IDASj7enBI3ab+ikNtox0l1jgGdVgJMmiwRgtUsrpT2Ir u20+j2y9RiBwxUmAZ3ZN8pA6hmnl7sYfbpP1NE77XAY5J0ASe8idxz1MeYTXR7kBLXDO 7mrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=t6u5Sv21; 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 h11-20020a056402280b00b00460d06fa777si12779563ede.87.2022.11.07.10.16.43; Mon, 07 Nov 2022 10:17:07 -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=t6u5Sv21; 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 S232929AbiKGRz7 (ORCPT + 93 others); Mon, 7 Nov 2022 12:55:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232646AbiKGRy3 (ORCPT ); Mon, 7 Nov 2022 12:54:29 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAFE8248C8; Mon, 7 Nov 2022 09:53:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1667843591; 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=FpKBRvbfGxTJfnKV4fn4HQn1v0QW6PL5yfSkhMzLybQ=; b=t6u5Sv21PJgRfXF++fVJX+VAdRGp22WwCvx3HAFeoJqKhPNeoyYRMFB/djd+Ebh/lf3kZC rTKnn3KtzAURpA6fRa2lcs47DlsesOMS7QWiaBDdWzUwWUWvImJPGeQHLrv76gHL5K2OX9 M6bDNVdE7juf+odLNfe79u2KQmnHw54= From: Paul Cercueil To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Paul Cercueil , Laurent Pinchart , Kieran Bingham , linux-renesas-soc@vger.kernel.org Subject: [PATCH 17/26] drm: rcar-du: Remove #ifdef guards for PM related functions Date: Mon, 7 Nov 2022 17:52:47 +0000 Message-Id: <20221107175256.360839-7-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: 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 --- 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 a2776f1d6f2c..0a89094461cc 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