From patchwork Mon Nov 7 17:50:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 16593 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2200490wru; Mon, 7 Nov 2022 09:53:43 -0800 (PST) X-Google-Smtp-Source: AMsMyM4J3/vfuR3b9XThbgeIH3R5+5xc6MkSWwy8wibCxTPhFuA+kAwM0FFQYwH7z63147EccvwQ X-Received: by 2002:a63:85c8:0:b0:46f:5bbb:737f with SMTP id u191-20020a6385c8000000b0046f5bbb737fmr45492205pgd.93.1667843623073; Mon, 07 Nov 2022 09:53:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667843623; cv=none; d=google.com; s=arc-20160816; b=D6+iZW/wGfI8DFfV7JNb0nlqPxkGQEwpMxf/iqkbjCMSal8kKJLKwOYKxnf8Oy/RV9 dhrSUV9elCxbV/AGqN/fIVdK2dHpu1Oh/d1/noHtd1Nc1WJinSX3fxytL8pp2rZq1aY3 ZnJPbl1f/5xN4Hjj0/KqrcmoORj9H8YeaHXclr6glIXsiT3PtQeoyv/B0eatWwsRfy4e fot3iOGQrT3pcHHWdK1bPRDimqEZDR54P8prLcaQh4DJZsBAqOKDPetHNilxEVk6S2vj 8BmPYj5oFlCyanNJ7/2Ny06KbKA2XUQlUaIBsLhQJt9VOul5wuQviXbbw5B1mFHiU7M9 nxWg== 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=EDRHgJeXjD/Lfgp6cHobjOELEmX34fviCtkXalmd8+c=; b=FjGo2LlDothHnz8s9jrA2dtWQuSytpuqrD9iYHj7h4tBn6SWN/j3e005WqX+5VXtHY NzifYrpHD27Icz3OeJZn5NNZdY6AvREeBWwQb1c/d00vxjCTSbEMZdqWJUWoypvkbN8x tkamFHExCwL+lIkBpNMWyX7TVFO0PjWBeHQN4Zd79Q+tNzaAFKwaBPoGRK0voXdmVwSi M9YLk+L9I1N2XRisMfVcU/T4g5YkmPFhkj7rPNwtwMhWCqP8ZiDfCeGm1CUt8QIWb8gc J5yUQyIXMQv+KDsdm0y5CmLSQcwij+mDN0yZuO0uvWNW+OEYCOQ6Y4YnmqQ4DyXY+Wiu z1eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b="f0JM/l8s"; 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 o5-20020a056a001bc500b0056e4c9407d9si9230315pfw.97.2022.11.07.09.53.28; Mon, 07 Nov 2022 09:53:43 -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="f0JM/l8s"; 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 S231969AbiKGRvh (ORCPT + 99 others); Mon, 7 Nov 2022 12:51:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231464AbiKGRv3 (ORCPT ); Mon, 7 Nov 2022 12:51:29 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A62F723E9C for ; Mon, 7 Nov 2022 09:51:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1667843473; 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=EDRHgJeXjD/Lfgp6cHobjOELEmX34fviCtkXalmd8+c=; b=f0JM/l8sjONQLMbeKaV/13rSiNUmMjvk1GSAMsTvoHb8ClwnThUWo7yB/bPzQpKMojrQtX Gh+xqUDRaNWRqQcrKl8qKs/IwLSiuWGYy+8WGZDAG8aG6KtfazclijdWmWPoJ0kmCQY5n5 I6QP0f4xD6v2Df9PkdLUssmfIjwqs2U= 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 , Gerd Hoffmann , virtualization@lists.linux-foundation.org Subject: [PATCH 02/26] drm: bochs: Use the dev_pm_ops provided by modeset helper Date: Mon, 7 Nov 2022 17:50:42 +0000 Message-Id: <20221107175106.360578-3-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: Yes 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?1748860795155876359?= X-GMAIL-MSGID: =?utf-8?q?1748860795155876359?= Use the drm_mode_config_pm_ops structure exported by drm_modeset_helper.c, which provides the exact same PM callbacks. Signed-off-by: Paul Cercueil --- Cc: Gerd Hoffmann Cc: virtualization@lists.linux-foundation.org --- drivers/gpu/drm/tiny/bochs.c | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c index 04682f831544..26e9cba89f68 100644 --- a/drivers/gpu/drm/tiny/bochs.c +++ b/drivers/gpu/drm/tiny/bochs.c @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -610,30 +611,6 @@ static const struct drm_driver bochs_driver = { DRM_GEM_VRAM_DRIVER, }; -/* ---------------------------------------------------------------------- */ -/* pm interface */ - -#ifdef CONFIG_PM_SLEEP -static int bochs_pm_suspend(struct device *dev) -{ - struct drm_device *drm_dev = 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 = dev_get_drvdata(dev); - - return drm_mode_config_helper_resume(drm_dev); -} -#endif - -static const struct dev_pm_ops bochs_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(bochs_pm_suspend, - bochs_pm_resume) -}; - /* ---------------------------------------------------------------------- */ /* pci interface */ @@ -721,7 +698,7 @@ static struct pci_driver bochs_pci_driver = { .id_table = bochs_pci_tbl, .probe = bochs_pci_probe, .remove = bochs_pci_remove, - .driver.pm = &bochs_pm_ops, + .driver.pm = pm_sleep_ptr(&drm_mode_config_pm_ops), }; /* ---------------------------------------------------------------------- */