From patchwork Mon Nov 7 17:50:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 16601 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2201136wru; Mon, 7 Nov 2022 09:55:05 -0800 (PST) X-Google-Smtp-Source: AMsMyM5e2FuZOWMe1SI6hAA8CH7LLF19WJK3qBmZ6RQRMDvkeNiowJUG5qKlNtzRz+p16gquCO50 X-Received: by 2002:aa7:8b46:0:b0:56c:349f:191e with SMTP id i6-20020aa78b46000000b0056c349f191emr50780601pfd.29.1667843704955; Mon, 07 Nov 2022 09:55:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667843704; cv=none; d=google.com; s=arc-20160816; b=eX8kkaJKV5IqVQdj0lM4dbColp9Hqo0fOsNks88gCP+DvELlqh2hcYQrOakjcU9+Hm o7u4MrWPQ0LGhAw3+J53eF1hN8kNgMfMjepSNf8UztQwfWiGE87DX9nENwvI5iQEO/LU zmKV3Cn3UTvTAsLWiUwN2kBw5hcjM6MbBrU4lm/YqNNe3NVYegqNWmZ49ow+N4fZ4vrw y25+rarQphrrF67QRpiNSnSIjStbtP3MMFW2OCpEV3lUOSLZcMzJbBV4Nw12vIfF5ydB EPQ49PH8wOMZMTeXahB1fMevm0vXarEfNBdS1hWTBUydYG8LaTBr5718uudphoxQkE0n qcQQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d19-20020a056a0024d300b0056c125186aasi12011358pfv.4.2022.11.07.09.54.51; Mon, 07 Nov 2022 09:55:04 -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 + 99 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748860881167287528?= X-GMAIL-MSGID: =?utf-8?q?1748860881167287528?= 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 Reviewed-by: Laurentiu Palcu Tested-by: Laurentiu Palcu --- 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