Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2223097rwb; Mon, 7 Nov 2022 10:36:01 -0800 (PST) X-Google-Smtp-Source: AMsMyM4qsdSW7xUVgiVSOK00WcEbjmFGRC/yZz6vhfCskaq+6ClGRPx8/0p9xfNYxKUEQ+UFKSKX X-Received: by 2002:a05:6a00:1810:b0:56b:f29d:cc8e with SMTP id y16-20020a056a00181000b0056bf29dcc8emr50739106pfa.33.1667846161027; Mon, 07 Nov 2022 10:36:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667846161; cv=none; d=google.com; s=arc-20160816; b=QhJIRzfu0/hAOg48CWhOATcjqSuoegGJQAQrOPicgQWB0IqEbKfLZ7w6waqaYLLF0q 9oh3oTUgEwhDVphcPjE5ZAOOxojm8DbEdfcxD3I2XXF42ZT8CAojyvwT5534KZlhFpAh Vxi+BzwNyWQXjVAa3Abcw2n+SXFZCoypRCfkLJKSow7o53LSkrTE9bj6pKUdNcT8jRHb fVcVvIRjlcJTu4EvwqxTC4vnsTYJZHofNHPQoN2ZoiB6qFZ7A25I1sqd/y1VVYUxv722 l6HMKEr7CrlAFq32s5cT8QB9vYB9Gv2gUBmrNqyfPEETC5lpCAFqtTTEHDSVb/At5DzI 4WQA== 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=a1iA3eBj97Rvq7OWPrwJVhtvp5JKUE1pcF7E3020HnE=; b=oWwZfBBcPjOO0sd7bzQEZgm+pZkyzQnUmD0aM6opvHo5+BJwpZgcalRtS6fg0I74AA BNN5y3pkq7ZijA88WxkbIhZyetqKMKV7f08VDuuGiMoFFvRJKsYt9jZ6Owno4EGQHXLa ct9ZuR0AR2TsK+O095cZyd66COWSX+ekh+I0+onC1DVzX1LEAiYX/g7hzqKTRmYO9+j5 TAjdmCaVAZP3jT+wMLxKXMI1/4z5+Sa02zEfcqaQEXp/ZM3VeUHiFbcUG7kCxSzCCrF4 i9sNVDdtthK4RZ0LH3fEY47wJ12oM2Fc5N3AZHD3c9pMPCC1j65+FtclkKrlfl7ZFQ+I sCSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=C0yI4JVT; 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 u14-20020a170903124e00b0016f9420a15asi12426254plh.168.2022.11.07.10.35.45; Mon, 07 Nov 2022 10:36:01 -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=C0yI4JVT; 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 S232060AbiKGRyK (ORCPT + 92 others); Mon, 7 Nov 2022 12:54:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232435AbiKGRxn (ORCPT ); Mon, 7 Nov 2022 12:53:43 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EE5524F26 for ; Mon, 7 Nov 2022 09:52:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1667843483; 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=a1iA3eBj97Rvq7OWPrwJVhtvp5JKUE1pcF7E3020HnE=; b=C0yI4JVTIUpFCbvbJ/En9ggpLv7PJh2Calp+CdhOu4/DiNEOXY7Aupd/todjjef0wmZOee RS6RWewoLwaCK5zFqrr3I2ebT4be5vTwPYflm1ecpcEtb10fHbDi6UdeNVNQfF94XM3Mdg OCrSx2/2Wzd2ZJ3eqrrGtfrXJAy81oI= 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 , Laurentiu Palcu , Lucas Stach , Philipp Zabel , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org Subject: [PATCH 10/26] drm: imx/dcss: Remove #ifdef guards for PM related functions Date: Mon, 7 Nov 2022 17:50:50 +0000 Message-Id: <20221107175106.360578-11-paul@crapouillou.net> In-Reply-To: <20221107175106.360578-1-paul@crapouillou.net> References: <20221107175106.360578-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 EXPORT_GPL_DEV_PM_OPS() and pm_ptr() macros to handle the PM callbacks. These macros allow the PM functions to be automatically dropped by the compiler when CONFIG_PM 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: Laurentiu Palcu Cc: Lucas Stach Cc: Philipp Zabel Cc: Shawn Guo Cc: Sascha Hauer Cc: Pengutronix Kernel Team Cc: Fabio Estevam Cc: NXP Linux Team Cc: linux-arm-kernel@lists.infradead.org --- drivers/gpu/drm/imx/dcss/dcss-dev.c | 17 +++++++++-------- drivers/gpu/drm/imx/dcss/dcss-dev.h | 7 +++---- drivers/gpu/drm/imx/dcss/dcss-drv.c | 8 +------- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/imx/dcss/dcss-dev.c b/drivers/gpu/drm/imx/dcss/dcss-dev.c index 3f5750cc2673..66d9233ffb98 100644 --- a/drivers/gpu/drm/imx/dcss/dcss-dev.c +++ b/drivers/gpu/drm/imx/dcss/dcss-dev.c @@ -249,8 +249,7 @@ void dcss_dev_destroy(struct dcss_dev *dcss) kfree(dcss); } -#ifdef CONFIG_PM_SLEEP -int dcss_dev_suspend(struct device *dev) +static int dcss_dev_suspend(struct device *dev) { struct dcss_dev *dcss = dcss_drv_dev_to_dcss(dev); struct drm_device *ddev = dcss_drv_dev_to_drm(dev); @@ -273,7 +272,7 @@ int dcss_dev_suspend(struct device *dev) return 0; } -int dcss_dev_resume(struct device *dev) +static int dcss_dev_resume(struct device *dev) { struct dcss_dev *dcss = dcss_drv_dev_to_dcss(dev); struct drm_device *ddev = dcss_drv_dev_to_drm(dev); @@ -296,10 +295,8 @@ int dcss_dev_resume(struct device *dev) return 0; } -#endif /* CONFIG_PM_SLEEP */ -#ifdef CONFIG_PM -int dcss_dev_runtime_suspend(struct device *dev) +static int dcss_dev_runtime_suspend(struct device *dev) { struct dcss_dev *dcss = dcss_drv_dev_to_dcss(dev); int ret; @@ -313,7 +310,7 @@ int dcss_dev_runtime_suspend(struct device *dev) return 0; } -int dcss_dev_runtime_resume(struct device *dev) +static int dcss_dev_runtime_resume(struct device *dev) { struct dcss_dev *dcss = dcss_drv_dev_to_dcss(dev); @@ -325,4 +322,8 @@ int dcss_dev_runtime_resume(struct device *dev) return 0; } -#endif /* CONFIG_PM */ + +EXPORT_GPL_DEV_PM_OPS(dcss_dev_pm_ops) = { + RUNTIME_PM_OPS(dcss_dev_runtime_suspend, dcss_dev_runtime_resume, NULL) + SYSTEM_SLEEP_PM_OPS(dcss_dev_suspend, dcss_dev_resume) +}; diff --git a/drivers/gpu/drm/imx/dcss/dcss-dev.h b/drivers/gpu/drm/imx/dcss/dcss-dev.h index 1e582270c6ea..f27b87c09599 100644 --- a/drivers/gpu/drm/imx/dcss/dcss-dev.h +++ b/drivers/gpu/drm/imx/dcss/dcss-dev.h @@ -9,6 +9,7 @@ #include #include #include +#include #include