From: Bjorn Helgaas <helgaas@kernel.org>
To: David Airlie <airlied@linux.ie>
Cc: Vaibhav Gupta <vaibhav.varodek@gmail.com>,
Vaibhav Gupta <vaibhavgupta40@gmail.com>,
"Rafael J . Wysocki" <rafael@kernel.org>,
linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
Bjorn Helgaas <bhelgaas@google.com>
Subject: [PATCH v2 2/3] sis-agp: convert to generic power management
Date: Tue, 30 Nov 2021 20:54:18 -0600 [thread overview]
Message-ID: <20211201025419.2797624-3-helgaas@kernel.org> (raw)
In-Reply-To: <20211201025419.2797624-1-helgaas@kernel.org>
From: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Convert sis-agp from legacy PCI power management to the generic power
management framework.
Previously, sis-agp used legacy PCI power management. agp_sis_suspend()
looked like this:
agp_sis_suspend
pci_save_state(pdev)
pci_set_power_state(pdev, pci_choose_state(pdev, state))
With generic power management, these are both done by the PCI core in
pci_pm_runtime_suspend(), so drop agp_sis_suspend() completely.
agp_sis_resume() looked like this:
agp_sis_resume
pci_set_power_state(pdev, PCI_D0)
pci_restore_state(pdev)
sis_driver.configure()
With generic power management, the PCI parts are done by
pci_pm_runtime_resume(), so drop those from agp_sis_resume().
[bhelgaas: commit log]
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
drivers/char/agp/sis-agp.c | 25 ++++++-------------------
1 file changed, 6 insertions(+), 19 deletions(-)
diff --git a/drivers/char/agp/sis-agp.c b/drivers/char/agp/sis-agp.c
index 14909fc5d767..f8a02f4bef1b 100644
--- a/drivers/char/agp/sis-agp.c
+++ b/drivers/char/agp/sis-agp.c
@@ -217,26 +217,14 @@ static void agp_sis_remove(struct pci_dev *pdev)
agp_put_bridge(bridge);
}
-#ifdef CONFIG_PM
+#define agp_sis_suspend NULL
-static int agp_sis_suspend(struct pci_dev *pdev, pm_message_t state)
+static int __maybe_unused agp_sis_resume(
+ __attribute__((unused)) struct device *dev)
{
- pci_save_state(pdev);
- pci_set_power_state(pdev, pci_choose_state(pdev, state));
-
- return 0;
-}
-
-static int agp_sis_resume(struct pci_dev *pdev)
-{
- pci_set_power_state(pdev, PCI_D0);
- pci_restore_state(pdev);
-
return sis_driver.configure();
}
-#endif /* CONFIG_PM */
-
static const struct pci_device_id agp_sis_pci_table[] = {
{
.class = (PCI_CLASS_BRIDGE_HOST << 8),
@@ -419,15 +407,14 @@ static const struct pci_device_id agp_sis_pci_table[] = {
MODULE_DEVICE_TABLE(pci, agp_sis_pci_table);
+static SIMPLE_DEV_PM_OPS(agp_sis_pm_ops, agp_sis_suspend, agp_sis_resume);
+
static struct pci_driver agp_sis_pci_driver = {
.name = "agpgart-sis",
.id_table = agp_sis_pci_table,
.probe = agp_sis_probe,
.remove = agp_sis_remove,
-#ifdef CONFIG_PM
- .suspend = agp_sis_suspend,
- .resume = agp_sis_resume,
-#endif
+ .driver.pm = &agp_sis_pm_ops,
};
static int __init agp_sis_init(void)
--
2.25.1
next prev parent reply other threads:[~2021-12-01 2:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-01 2:54 [PATCH v2 RESEND 0/3] agp: convert to generic power management Bjorn Helgaas
2021-12-01 2:54 ` [PATCH v2 1/3] amd64-agp: " Bjorn Helgaas
2021-12-02 17:43 ` Bjorn Helgaas
2021-12-01 2:54 ` Bjorn Helgaas [this message]
2021-12-01 2:54 ` [PATCH v2 3/3] via-agp: " Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211201025419.2797624-3-helgaas@kernel.org \
--to=helgaas@kernel.org \
--cc=airlied@linux.ie \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=vaibhav.varodek@gmail.com \
--cc=vaibhavgupta40@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.