Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1289474rwb; Tue, 29 Nov 2022 11:23:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf4tQPEPAKWicLHsXt7nsZMQh5LTdax+t6l+Wt/x8tI3AhxNgZS4tKdI35wyrVHL8tIoxplU X-Received: by 2002:a17:906:a18c:b0:7ad:9629:fb96 with SMTP id s12-20020a170906a18c00b007ad9629fb96mr2282614ejy.751.1669749810072; Tue, 29 Nov 2022 11:23:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669749810; cv=none; d=google.com; s=arc-20160816; b=xW8Zjxk7Way21OjkI8GVgf7wHo1FzdscO9biLAVvHWUQ5HEqPCVJfPDz+NotUJnaYf hIns6aY2apM/Ie7kpOf2BSVOZmjKMBeMDhd66DK1pvLz7ZYFpVlEEzUQCkeAyROrl5Y6 qWruqzS+ogEOlC8z9Niy14DpzayjMLK63jkfdJ9Sygac/M3NcL8O2YnYFLqKHuPS9xOd LxgnocFSW0CSC8W7GnVwrI5gf/zFWSQUI6ySJYoTBGSdC76mGfGatq9lov3DwUYe1MPe 9Losh+NUkwyeZlOqVlZNBY1o4XbfZGmnaVT5RIiWymTmU1PZnxe3w2jbVe1VdfhqOcGb QiUA== 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=otLZTlXQs3lS98jbgn2cwZ6QYH6xDeRXlcMO9hILBzA=; b=CTJjICWElMvbBqpHCWwbR2s8PLhW2tYYeQhHzcdf0wdTd0jQNWuPEbw5EMvZY4rmC1 qdx9Yy0V0gaRcd3ZEc/iYZyEdXUAgdEcR2pw+jXZPltl68yRzxWtXMFAWLKT8Sg/toN7 Rx8K/Bntgc1714507SLci6Pj9YPgY6mR66SxPeEQZl8udNNX87opWLBw0L2ZT9hd+3QZ 4q3XD19q8uOccMy+b/sZDPhgRwjXeij10eoUGScIje7fH77YTsTYuHW1DLBp9Rq8Yxfx GOwMNn/D6ee6RhwM7ZJvvFHgmTzZlPGIn+K4wPPVSnQdOQ0Ez3/T1KAF6kiCnEucZi4N Oq/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=Vcu3dIzy; 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 f23-20020a17090624d700b007919f213511si10787117ejb.951.2022.11.29.11.23.07; Tue, 29 Nov 2022 11:23:30 -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=Vcu3dIzy; 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 S236857AbiK2TVW (ORCPT + 85 others); Tue, 29 Nov 2022 14:21:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236811AbiK2TUv (ORCPT ); Tue, 29 Nov 2022 14:20:51 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9A4E6C720 for ; Tue, 29 Nov 2022 11:20:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1669749593; 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=otLZTlXQs3lS98jbgn2cwZ6QYH6xDeRXlcMO9hILBzA=; b=Vcu3dIzy72Pv8eXVbs2yPpjXGsVi/HZwA8f23CDsiNB1+5Vlkva4ITx2p+y2ViTdLAM1pF rn5lFJkUSY9TvZKr8uTb8ojxS3DxWzWNKRPGr2jBTJ/b2jZURNMv1xCCkMGeIlFcimGpEy eh0vMm9lfbzOiINuvLLqezm1OwMxK0Y= From: Paul Cercueil To: 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 v2 14/26] drm: mediatek: Remove #ifdef guards for PM related functions Date: Tue, 29 Nov 2022 19:19:30 +0000 Message-Id: <20221129191942.138244-1-paul@crapouillou.net> In-Reply-To: <20221129191733.137897-1-paul@crapouillou.net> References: <20221129191733.137897-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 0a8e0a13f516..52f77a6af10f 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c @@ -1755,7 +1755,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); @@ -1778,9 +1777,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, @@ -1810,7 +1809,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