Message ID | 20221107175256.360839-12-paul@crapouillou.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2202116wru; Mon, 7 Nov 2022 09:57:20 -0800 (PST) X-Google-Smtp-Source: AMsMyM7xu+UmLB0kFrdQEDp3+anVS5EklasMt1/I9DR0MG0WKI0mOCIpNN6mfxKEGNyjfCVgORFF X-Received: by 2002:a63:3346:0:b0:470:89:8e92 with SMTP id z67-20020a633346000000b0047000898e92mr735711pgz.487.1667843840402; Mon, 07 Nov 2022 09:57:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667843840; cv=none; d=google.com; s=arc-20160816; b=adPNoxx4XsPZY441V/IDCeqfx9QiR5mrygz22SHdS2WE49POQTJcD7iYkR4qlN0N/S 0dx739o+btfSDMj+XdftuLn8o6aPIfuWHRuY20Kg+hSJV2NJfb36SSjhuXGbntqHZxXz P2jXc7iOlvLNl0r9ltWIiXhjlWInPEO2LVF83acydickPrceamc3Ro4HLoVHy8lyXDWS 2xiJItFP2noDRKM8gsTvhJAGAn0Ug5EgGf565+I1Tnwa92i1RMPwkFD42C75lCG8crF6 FW/zVnVvhGrRit5WNOMP3d23S8QNTC/X0Zxf27snVuktYhLnRITmqvRRCndSL2spBMuB n50A== 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=v5THks8G5thM8MpzfovKFJFQl1Oz6R2zYzhs11WmEBw=; b=jSE/+wuVz6BK3yIZF8AzJN/QPOIfS6a2n7FKTW90hu3oSPZ1Q7nxzgZaqo3WHP5Rhz GBTgfLjg3+uV4upgS/zf/T6RS6HtWv626Stds5Xuxvq3qK9M1q1t8vJz5jX10iudoB9V JIrOsMiscsKMICo0t93sfRZx9p2QiNnT7wmBUXXfUgFzZyf0zTkpd046evqW1mgVrLQG iGRoC/47VgpHJ7PKYEDML4/h9k1WK1bUPqbEdvhnqOKruowByguwKibCaAxjyxv4Vzwi bQNs5IyYZr+qjvMsdIJ5/Gjc0KDrszdK2PDbNOiCRnKoB/MF+a3Drb8CESreZ3u9M5oV 2MwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=wRUg0fzP; 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 g23-20020a1709029f9700b0017872bc9843si9838868plq.137.2022.11.07.09.57.06; Mon, 07 Nov 2022 09:57:20 -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=wRUg0fzP; 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 S232169AbiKGR4k (ORCPT <rfc822;hjfbswb@gmail.com> + 99 others); Mon, 7 Nov 2022 12:56:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232637AbiKGRzZ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 7 Nov 2022 12:55:25 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1EC424F2C for <linux-kernel@vger.kernel.org>; Mon, 7 Nov 2022 09:54:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1667843596; 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=v5THks8G5thM8MpzfovKFJFQl1Oz6R2zYzhs11WmEBw=; b=wRUg0fzPYgUjWGRA7Zk51JSJfOFCQz6mEfxbR520rZUbVMVAA9VZ7aYLFyg8knC7zr6j76 d1DpHWTqb9UgGG/9fSsBi4mTOCrep6aKkMc6LhSA2mZBWOFUgwuSUkD+JfcmQnHGtF3KcI BdiFKNvCT3d8He4siopok9nrVSU5bTk= From: Paul Cercueil <paul@crapouillou.net> To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch> Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Paul Cercueil <paul@crapouillou.net>, Hans de Goede <hdegoede@redhat.com> Subject: [PATCH 22/26] drm: vboxvideo: Remove #ifdef guards for PM related functions Date: Mon, 7 Nov 2022 17:52:52 +0000 Message-Id: <20221107175256.360839-12-paul@crapouillou.net> In-Reply-To: <20221107175256.360839-1-paul@crapouillou.net> References: <20221107175106.360578-1-paul@crapouillou.net> <20221107175256.360839-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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748861022550696853?= X-GMAIL-MSGID: =?utf-8?q?1748861022550696853?= |
Series |
drm: Get rid of #ifdef CONFIG_PM* guards
|
|
Commit Message
Paul Cercueil
Nov. 7, 2022, 5:52 p.m. UTC
Use the pm_sleep_ptr() macro to handle the .suspend / .resume callbacks.
This macro allows the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND 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 <paul@crapouillou.net>
---
Cc: Hans de Goede <hdegoede@redhat.com>
---
drivers/gpu/drm/vboxvideo/vbox_drv.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
Comments
Hi, On 11/7/22 18:52, Paul Cercueil wrote: > Use the pm_sleep_ptr() macro to handle the .suspend / .resume callbacks. > > This macro allows the suspend and resume functions to be automatically > dropped by the compiler when CONFIG_SUSPEND 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 <paul@crapouillou.net> > --- > Cc: Hans de Goede <hdegoede@redhat.com> Thanks, patch looks good to me: Reviewed-by: Hans de Goede <hdegoede@redhat.com> Regards, Hans > --- > drivers/gpu/drm/vboxvideo/vbox_drv.c | 6 +----- > 1 file changed, 1 insertion(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/vboxvideo/vbox_drv.c b/drivers/gpu/drm/vboxvideo/vbox_drv.c > index f4f2bd79a7cb..79318441ed7e 100644 > --- a/drivers/gpu/drm/vboxvideo/vbox_drv.c > +++ b/drivers/gpu/drm/vboxvideo/vbox_drv.c > @@ -102,7 +102,6 @@ static void vbox_pci_remove(struct pci_dev *pdev) > vbox_hw_fini(vbox); > } > > -#ifdef CONFIG_PM_SLEEP > static int vbox_pm_suspend(struct device *dev) > { > struct vbox_private *vbox = dev_get_drvdata(dev); > @@ -160,16 +159,13 @@ static const struct dev_pm_ops vbox_pm_ops = { > .poweroff = vbox_pm_poweroff, > .restore = vbox_pm_resume, > }; > -#endif > > static struct pci_driver vbox_pci_driver = { > .name = DRIVER_NAME, > .id_table = pciidlist, > .probe = vbox_pci_probe, > .remove = vbox_pci_remove, > -#ifdef CONFIG_PM_SLEEP > - .driver.pm = &vbox_pm_ops, > -#endif > + .driver.pm = pm_sleep_ptr(&vbox_pm_ops), > }; > > DEFINE_DRM_GEM_FOPS(vbox_fops);
diff --git a/drivers/gpu/drm/vboxvideo/vbox_drv.c b/drivers/gpu/drm/vboxvideo/vbox_drv.c index f4f2bd79a7cb..79318441ed7e 100644 --- a/drivers/gpu/drm/vboxvideo/vbox_drv.c +++ b/drivers/gpu/drm/vboxvideo/vbox_drv.c @@ -102,7 +102,6 @@ static void vbox_pci_remove(struct pci_dev *pdev) vbox_hw_fini(vbox); } -#ifdef CONFIG_PM_SLEEP static int vbox_pm_suspend(struct device *dev) { struct vbox_private *vbox = dev_get_drvdata(dev); @@ -160,16 +159,13 @@ static const struct dev_pm_ops vbox_pm_ops = { .poweroff = vbox_pm_poweroff, .restore = vbox_pm_resume, }; -#endif static struct pci_driver vbox_pci_driver = { .name = DRIVER_NAME, .id_table = pciidlist, .probe = vbox_pci_probe, .remove = vbox_pci_remove, -#ifdef CONFIG_PM_SLEEP - .driver.pm = &vbox_pm_ops, -#endif + .driver.pm = pm_sleep_ptr(&vbox_pm_ops), }; DEFINE_DRM_GEM_FOPS(vbox_fops);