Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2179021rwb; Mon, 7 Nov 2022 10:04:32 -0800 (PST) X-Google-Smtp-Source: AMsMyM7AtvQIPCJ1E++dFltDOBVoJqr7+1TpcoKjwvJokOpSip/072fERG89UB2Y5iS4C56rb4JA X-Received: by 2002:a17:906:9be3:b0:7ad:d3a4:9df3 with SMTP id de35-20020a1709069be300b007add3a49df3mr39431510ejc.682.1667844272319; Mon, 07 Nov 2022 10:04:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667844272; cv=none; d=google.com; s=arc-20160816; b=QjDhnYN5v9eRNAZG2yV2lu+WONyJGpvpgZJymLCDD49EZuqG7SntjWY9pYuM16Bt8h 7ZKbRO1011LfSQllLqKzC3vdVYbu/U9S5LPFy4UncwaMmF16TUUo06lHtW2GFX/7QzW6 P32CpNC7LuQIPsH4R+sr03Rpew8iFpu2rhnANrqE+H4KrCkzwUuu4Z972vl5YkrLfq81 W8JuwGBICgNMAoDQfpgUxbbtqErSDEWjl29e4LGhiGyt2jeAgXi+bwK627jnTWhp3SCK JG1RQrb3k+A4j5QmMakvhs1xQvsH+gG9jiBNFqhIB1Ey9EUa8GVWZI5aJ8cSgL+UoXQH rliQ== 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=CL7OS3zNzCh06Be+7/qgqOMluJ9oQWh2haWI6qGfS0c=; b=bkFmAAg1O0dIKITdIdLzWncvkSH47XC4LcyQCIeO2RRve1s3l+9sAYWr2yHZ9KaS3i 8UXpdr6zhP91s7jauYtb4d5QjvB4pBepmKldPzmBnWlN1Lq8rmgrDgchYt5bfmjA6hi0 A/T5lNR5IQMw9Q5dG7C4MISMS1FT27PkbOLQX7tbrA5JHBOGA5bKnI/8KGCnaWAc0f0D 8iz5Qr9BaqN/GTu8+Kmk3OpRulSh4eMyHP5RVb3Vc/oSILUdny2Ygop07Yulj8usZwo3 A79vmcb0SGfRImVGoGl18nFJyrG2X00ib5wPkJGpz0OeySDhEbOh/wSDV2jUplvIzqp4 ck4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b="jLLnGL/9"; 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 sg37-20020a170907a42500b0078dce38525asi11214677ejc.896.2022.11.07.10.04.08; Mon, 07 Nov 2022 10:04:32 -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="jLLnGL/9"; 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 S231440AbiKGRzo (ORCPT + 92 others); Mon, 7 Nov 2022 12:55:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232459AbiKGRyZ (ORCPT ); Mon, 7 Nov 2022 12:54:25 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 062452670 for ; Mon, 7 Nov 2022 09:53:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1667843588; 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=CL7OS3zNzCh06Be+7/qgqOMluJ9oQWh2haWI6qGfS0c=; b=jLLnGL/9f2JDrJH58XLM/6o5cp6HQ1F1qCSbSlQ1pxuXLDotQ5OUMyELZPKv7LixR6kC7j lecrrVbllOZEPqDOC3ObQoJ381+3fF3cbtIowNkEbiRBzAZ4eAdfgy3ItQoLrShjIs7ckS w8bhXq6p/Ngr3vGuvcc14DFra0pKc/4= 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 , Chun-Kuang Hu , Philipp Zabel , Matthias Brugger , linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 14/26] drm: mediatek: Remove #ifdef guards for PM related functions Date: Mon, 7 Nov 2022 17:52:44 +0000 Message-Id: <20221107175256.360839-4-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: Chun-Kuang Hu Cc: Philipp Zabel Cc: Matthias Brugger Cc: linux-mediatek@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org --- drivers/gpu/drm/mediatek/mtk_dp.c | 6 ++---- drivers/gpu/drm/mediatek/mtk_hdmi.c | 9 ++++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c index 9d085c05c49c..00861a914855 100644 --- a/drivers/gpu/drm/mediatek/mtk_dp.c +++ b/drivers/gpu/drm/mediatek/mtk_dp.c @@ -2590,7 +2590,6 @@ static int mtk_dp_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP static int mtk_dp_suspend(struct device *dev) { struct mtk_dp *mtk_dp = dev_get_drvdata(dev); @@ -2613,9 +2612,8 @@ static int mtk_dp_resume(struct device *dev) return 0; } -#endif -static SIMPLE_DEV_PM_OPS(mtk_dp_pm_ops, mtk_dp_suspend, mtk_dp_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(mtk_dp_pm_ops, mtk_dp_suspend, mtk_dp_resume); static const struct mtk_dp_data mt8195_edp_data = { .bridge_type = DRM_MODE_CONNECTOR_eDP, @@ -2650,7 +2648,7 @@ static struct platform_driver mtk_dp_driver = { .driver = { .name = "mediatek-drm-dp", .of_match_table = mtk_dp_of_match, - .pm = &mtk_dp_pm_ops, + .pm = pm_sleep_ptr(&mtk_dp_pm_ops), }, }; diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c index 4c80b6896dc3..93b2a36d3fc5 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c @@ -1754,7 +1754,6 @@ static int mtk_drm_hdmi_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP static int mtk_hdmi_suspend(struct device *dev) { struct mtk_hdmi *hdmi = dev_get_drvdata(dev); @@ -1777,9 +1776,9 @@ static int mtk_hdmi_resume(struct device *dev) return 0; } -#endif -static SIMPLE_DEV_PM_OPS(mtk_hdmi_pm_ops, - mtk_hdmi_suspend, mtk_hdmi_resume); + +static DEFINE_SIMPLE_DEV_PM_OPS(mtk_hdmi_pm_ops, + mtk_hdmi_suspend, mtk_hdmi_resume); static const struct mtk_hdmi_conf mtk_hdmi_conf_mt2701 = { .tz_disabled = true, @@ -1809,7 +1808,7 @@ static struct platform_driver mtk_hdmi_driver = { .driver = { .name = "mediatek-drm-hdmi", .of_match_table = mtk_drm_hdmi_of_ids, - .pm = &mtk_hdmi_pm_ops, + .pm = pm_sleep_ptr(&mtk_hdmi_pm_ops), }, }; -- 2.35.1