From patchwork Tue Nov 29 19:17:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 13059036 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 90A52C4332F for ; Tue, 29 Nov 2022 19:18:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 781F010E230; Tue, 29 Nov 2022 19:18:56 +0000 (UTC) Received: from aposti.net (aposti.net [89.234.176.197]) by gabe.freedesktop.org (Postfix) with ESMTPS id D7F1310E22A for ; Tue, 29 Nov 2022 19:18:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1669749480; 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=XJfb607OEPZzj5jgkFphMZxTPqxtnHJHM51G7bS3xhg=; b=NHeNnfajuJj9RKYJuLwf++m+ogVpTx5mJDmSLqyL7XYR/Sv/A8mIz8XsTQlKwTWAcwC8L5 tMJKHInbAvfNrr0xxTdaa88NpD4bqf3cgKpPG+SlGkoBYqtCAlbq9OrAHuYzYK1wmkiCp5 mMJ22m4Cwp4riY9CkZMFeJsyHG6w47c= From: Paul Cercueil To: David Airlie , Daniel Vetter Subject: [PATCH v2 07/26] drm: mxsfb: Define and use generic PM ops Date: Tue, 29 Nov 2022 19:17:14 +0000 Message-Id: <20221129191733.137897-8-paul@crapouillou.net> In-Reply-To: <20221129191733.137897-1-paul@crapouillou.net> References: <20221129191733.137897-1-paul@crapouillou.net> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , Sascha Hauer , linux-kernel@vger.kernel.org, Paul Cercueil , dri-devel@lists.freedesktop.org, Pengutronix Kernel Team , Shawn Guo , linux-arm-kernel@lists.infradead.org, NXP Linux Team Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Use the new DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS() macro to create a "struct dev_pm_ops" that can be used by this driver, instead of using custom PM callbacks with the same behaviour. v2: Use the DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS() macro instead of an exported dev_pm_ops. Signed-off-by: Paul Cercueil Reviewed-by: Marek Vasut --- Cc: Marek Vasut Cc: Stefan Agner 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/mxsfb/mxsfb_drv.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c index 810edea0a31e..c63d2eb3b379 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c @@ -398,25 +398,7 @@ static void mxsfb_shutdown(struct platform_device *pdev) drm_atomic_helper_shutdown(drm); } -#ifdef CONFIG_PM_SLEEP -static int mxsfb_suspend(struct device *dev) -{ - struct drm_device *drm = dev_get_drvdata(dev); - - return drm_mode_config_helper_suspend(drm); -} - -static int mxsfb_resume(struct device *dev) -{ - struct drm_device *drm = dev_get_drvdata(dev); - - return drm_mode_config_helper_resume(drm); -} -#endif - -static const struct dev_pm_ops mxsfb_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(mxsfb_suspend, mxsfb_resume) -}; +DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS(mxsfb_pm_ops); static struct platform_driver mxsfb_platform_driver = { .probe = mxsfb_probe, @@ -425,7 +407,7 @@ static struct platform_driver mxsfb_platform_driver = { .driver = { .name = "mxsfb", .of_match_table = mxsfb_dt_ids, - .pm = &mxsfb_pm_ops, + .pm = pm_sleep_ptr(&mxsfb_pm_ops), }, };