From: Bjorn Helgaas <helgaas@kernel.org>
To: David Airlie <airlied@linux.ie>,
"Rafael J . Wysocki" <rafael@kernel.org>
Cc: Vaibhav Gupta <vaibhavgupta40@gmail.com>,
linux-pm@vger.org, linux-pci@vger.org,
linux-kernel@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com>
Subject: [PATCH 2/5] agp/intel: Convert to generic power management
Date: Mon, 6 Jun 2022 22:43:37 -0500 [thread overview]
Message-ID: <20220607034340.307318-3-helgaas@kernel.org> (raw)
In-Reply-To: <20220607034340.307318-1-helgaas@kernel.org>
From: Bjorn Helgaas <bhelgaas@google.com>
Convert agpgart-intel from legacy PCI power management to the generic power
management framework.
Previously agpgart-intel used legacy PCI power management, and
agp_intel_resume() was responsible for both device-specific things and
generic PCI things like saving and restoring config space and managing
power state.
In this case, agp_intel_suspend() was empty, and agp_intel_resume() already
did only device-specific things, so the conversion is trivial.
Based on 0aeddbd0cb07 ("via-agp: convert to generic power management") by
Vaibhav Gupta <vaibhavgupta40@gmail.com>.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
drivers/char/agp/intel-agp.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index 9e4f27a6cb5a..dbb209a6c62e 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -817,16 +817,15 @@ static void agp_intel_remove(struct pci_dev *pdev)
agp_put_bridge(bridge);
}
-#ifdef CONFIG_PM
-static int agp_intel_resume(struct pci_dev *pdev)
+static int __maybe_unused agp_intel_resume(struct device *dev)
{
+ struct pci_dev *pdev = to_pci_dev(dev);
struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
bridge->driver->configure();
return 0;
}
-#endif
static const struct pci_device_id agp_intel_pci_table[] = {
#define ID(x) \
@@ -895,14 +894,14 @@ static const struct pci_device_id agp_intel_pci_table[] = {
MODULE_DEVICE_TABLE(pci, agp_intel_pci_table);
+static SIMPLE_DEV_PM_OPS(agp_intel_pm_ops, NULL, agp_intel_resume);
+
static struct pci_driver agp_intel_pci_driver = {
.name = "agpgart-intel",
.id_table = agp_intel_pci_table,
.probe = agp_intel_probe,
.remove = agp_intel_remove,
-#ifdef CONFIG_PM
- .resume = agp_intel_resume,
-#endif
+ .driver.pm = &agp_intel_pm_ops,
};
static int __init agp_intel_init(void)
--
2.25.1
next prev parent reply other threads:[~2022-06-07 3:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-07 3:43 [PATCH 0/5] agp: Convert to generic power management Bjorn Helgaas
2022-06-07 3:43 ` [PATCH 1/5] agp/efficeon: " Bjorn Helgaas
2022-06-07 3:43 ` Bjorn Helgaas [this message]
2022-06-07 3:43 ` [PATCH 3/5] agp/amd-k7: " Bjorn Helgaas
2022-06-07 3:43 ` [PATCH 4/5] agp/ati: " Bjorn Helgaas
2022-06-07 3:43 ` [PATCH 5/5] agp/nvidia: " 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=20220607034340.307318-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.org \
--cc=linux-pm@vger.org \
--cc=rafael@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox