From nobody Fri Sep 19 03:48:28 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6536BC4332F for ; Tue, 29 Nov 2022 19:18:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236692AbiK2TSO (ORCPT ); Tue, 29 Nov 2022 14:18:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236680AbiK2TSJ (ORCPT ); Tue, 29 Nov 2022 14:18:09 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C493D5B5A9 for ; Tue, 29 Nov 2022 11:18:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1669749470; 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=dIthVPfRqMzRLHonB9Z3+9yNKc8FhZTyJnewRLDcrPs=; b=v6cI95cKHZF7JRsW6yCZyviPrYgL1hUQg6mGKb3+uSwSQT68AJ3ZblHdt2FXdYjVdF2lxU YhUSzbi1grVPHthQtkb3JWgqIRU8fEVCYtMlY3+3ITbHhcGY6uZfFk5LsBbEBlxgN4TgmX 0FTfc9J1QbkFBazrASWsvhNoZ8uol00= From: Paul Cercueil To: David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Paul Cercueil , Gerd Hoffmann , virtualization@lists.linux-foundation.org Subject: [PATCH v2 02/26] drm: bochs: Define and use generic PM ops Date: Tue, 29 Nov 2022 19:17:09 +0000 Message-Id: <20221129191733.137897-3-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 --- Cc: Gerd Hoffmann Cc: virtualization@lists.linux-foundation.org --- drivers/gpu/drm/tiny/bochs.c | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c index 024346054c70..598488905607 100644 --- a/drivers/gpu/drm/tiny/bochs.c +++ b/drivers/gpu/drm/tiny/bochs.c @@ -2,6 +2,7 @@ =20 #include #include +#include =20 #include #include @@ -610,30 +611,6 @@ static const struct drm_driver bochs_driver =3D { DRM_GEM_VRAM_DRIVER, }; =20 -/* ---------------------------------------------------------------------- = */ -/* pm interface = */ - -#ifdef CONFIG_PM_SLEEP -static int bochs_pm_suspend(struct device *dev) -{ - struct drm_device *drm_dev =3D dev_get_drvdata(dev); - - return drm_mode_config_helper_suspend(drm_dev); -} - -static int bochs_pm_resume(struct device *dev) -{ - struct drm_device *drm_dev =3D dev_get_drvdata(dev); - - return drm_mode_config_helper_resume(drm_dev); -} -#endif - -static const struct dev_pm_ops bochs_pm_ops =3D { - SET_SYSTEM_SLEEP_PM_OPS(bochs_pm_suspend, - bochs_pm_resume) -}; - /* ---------------------------------------------------------------------- = */ /* pci interface = */ =20 @@ -716,12 +693,14 @@ static const struct pci_device_id bochs_pci_tbl[] =3D= { { /* end of list */ } }; =20 +DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS(bochs_pm_ops); + static struct pci_driver bochs_pci_driver =3D { .name =3D "bochs-drm", .id_table =3D bochs_pci_tbl, .probe =3D bochs_pci_probe, .remove =3D bochs_pci_remove, - .driver.pm =3D &bochs_pm_ops, + .driver.pm =3D pm_sleep_ptr(&bochs_pm_ops), }; =20 /* ---------------------------------------------------------------------- = */ --=20 2.35.1