linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/8] agp: Convert to generic power management
@ 2022-10-25 20:38 Bjorn Helgaas
  2022-10-25 20:38 ` [PATCH v2 1/8] agp/efficeon: " Bjorn Helgaas
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2022-10-25 20:38 UTC (permalink / raw)
  To: David Airlie
  Cc: Krzysztof Wilczyński, Rafael J . Wysocki, Vaibhav Gupta,
	dri-devel, linux-pci, linux-pm, linux-kernel, Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

Vaibhav converted several AGP drivers from legacy PCI power management to
generic power management [1].  This series converts the rest of them.

v1 posted at [2].

Changes from v1 to v2:
  - Convert from SIMPLE_DEV_PM_OPS() (which is deprecated) to
    DEFINE_SIMPLE_DEV_PM_OPS() and remove __maybe_unused annotations.

[1] https://lore.kernel.org/all/20210112080924.1038907-1-vaibhavgupta40@gmail.com/#t
[2] https://lore.kernel.org/all/20220607034340.307318-1-helgaas@kernel.org/

Bjorn Helgaas (8):
  agp/efficeon: Convert to generic power management
  agp/intel: Convert to generic power management
  agp/amd-k7: Convert to generic power management
  agp/ati: Convert to generic power management
  agp/nvidia: Convert to generic power management
  agp/amd64: Update to DEFINE_SIMPLE_DEV_PM_OPS()
  agp/sis: Update to DEFINE_SIMPLE_DEV_PM_OPS()
  agp/via: Update to DEFINE_SIMPLE_DEV_PM_OPS()

 drivers/char/agp/amd-k7-agp.c   | 24 ++++--------------------
 drivers/char/agp/amd64-agp.c    |  6 ++----
 drivers/char/agp/ati-agp.c      | 22 ++++------------------
 drivers/char/agp/efficeon-agp.c | 16 ++++------------
 drivers/char/agp/intel-agp.c    | 11 +++++------
 drivers/char/agp/nvidia-agp.c   | 24 ++++--------------------
 drivers/char/agp/sis-agp.c      |  7 ++-----
 drivers/char/agp/via-agp.c      |  6 ++----
 8 files changed, 27 insertions(+), 89 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 1/8] agp/efficeon: Convert to generic power management
  2022-10-25 20:38 [PATCH v2 0/8] agp: Convert to generic power management Bjorn Helgaas
@ 2022-10-25 20:38 ` Bjorn Helgaas
  2022-10-25 20:38 ` [PATCH v2 2/8] agp/intel: " Bjorn Helgaas
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2022-10-25 20:38 UTC (permalink / raw)
  To: David Airlie
  Cc: Krzysztof Wilczyński, Rafael J . Wysocki, Vaibhav Gupta,
	dri-devel, linux-pci, linux-pm, linux-kernel, Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

Convert agpgart-efficeon from legacy PCI power management to the generic
power management framework.

Previously agpgart-efficeon used legacy PCI power management, which means
agp_efficeon_suspend() and agp_efficeon_resume() were responsible for both
device-specific things and generic PCI things like saving and restoring
config space and managing power state.

In this case, agp_efficeon_suspend() was empty, and agp_efficeon_resume()
already did only device-specific things, so simply convert it to take a
struct device * instead of a struct pci_dev *.

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/efficeon-agp.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/char/agp/efficeon-agp.c b/drivers/char/agp/efficeon-agp.c
index c53f0f9ef5b0..f28d42319269 100644
--- a/drivers/char/agp/efficeon-agp.c
+++ b/drivers/char/agp/efficeon-agp.c
@@ -412,18 +412,11 @@ static void agp_efficeon_remove(struct pci_dev *pdev)
 	agp_put_bridge(bridge);
 }
 
-#ifdef CONFIG_PM
-static int agp_efficeon_suspend(struct pci_dev *dev, pm_message_t state)
-{
-	return 0;
-}
-
-static int agp_efficeon_resume(struct pci_dev *pdev)
+static int agp_efficeon_resume(struct device *dev)
 {
 	printk(KERN_DEBUG PFX "agp_efficeon_resume()\n");
 	return efficeon_configure();
 }
-#endif
 
 static const struct pci_device_id agp_efficeon_pci_table[] = {
 	{
@@ -437,6 +430,8 @@ static const struct pci_device_id agp_efficeon_pci_table[] = {
 	{ }
 };
 
+static DEFINE_SIMPLE_DEV_PM_OPS(agp_efficeon_pm_ops, NULL, agp_efficeon_resume);
+
 MODULE_DEVICE_TABLE(pci, agp_efficeon_pci_table);
 
 static struct pci_driver agp_efficeon_pci_driver = {
@@ -444,10 +439,7 @@ static struct pci_driver agp_efficeon_pci_driver = {
 	.id_table	= agp_efficeon_pci_table,
 	.probe		= agp_efficeon_probe,
 	.remove		= agp_efficeon_remove,
-#ifdef CONFIG_PM
-	.suspend	= agp_efficeon_suspend,
-	.resume		= agp_efficeon_resume,
-#endif
+	.driver.pm	= &agp_efficeon_pm_ops,
 };
 
 static int __init agp_efficeon_init(void)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 2/8] agp/intel: Convert to generic power management
  2022-10-25 20:38 [PATCH v2 0/8] agp: Convert to generic power management Bjorn Helgaas
  2022-10-25 20:38 ` [PATCH v2 1/8] agp/efficeon: " Bjorn Helgaas
@ 2022-10-25 20:38 ` Bjorn Helgaas
  2022-10-25 20:38 ` [PATCH v2 3/8] agp/amd-k7: " Bjorn Helgaas
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2022-10-25 20:38 UTC (permalink / raw)
  To: David Airlie
  Cc: Krzysztof Wilczyński, Rafael J . Wysocki, Vaibhav Gupta,
	dri-devel, linux-pci, linux-pm, linux-kernel, Bjorn Helgaas

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 simply convert it to take a
struct device * instead of a struct pci_dev *.

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..c518b3a9db04 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 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 DEFINE_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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 3/8] agp/amd-k7: Convert to generic power management
  2022-10-25 20:38 [PATCH v2 0/8] agp: Convert to generic power management Bjorn Helgaas
  2022-10-25 20:38 ` [PATCH v2 1/8] agp/efficeon: " Bjorn Helgaas
  2022-10-25 20:38 ` [PATCH v2 2/8] agp/intel: " Bjorn Helgaas
@ 2022-10-25 20:38 ` Bjorn Helgaas
  2022-10-25 20:38 ` [PATCH v2 4/8] agp/ati: " Bjorn Helgaas
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2022-10-25 20:38 UTC (permalink / raw)
  To: David Airlie
  Cc: Krzysztof Wilczyński, Rafael J . Wysocki, Vaibhav Gupta,
	dri-devel, linux-pci, linux-pm, linux-kernel, Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

Convert agpgart-amdk7 from legacy PCI power management to the generic power
management framework.

Previously agpgart-amdk7 used legacy PCI power management, and
agp_amdk7_suspend() and agp_amdk7_resume() were responsible for both
device-specific things and generic PCI things like saving and restoring
config space and managing power state:

  agp_amdk7_suspend
    pci_save_state                         <-- generic PCI
    pci_set_power_state                    <-- generic PCI

  agp_amdk7_resume
    pci_set_power_state(PCI_D0)            <-- generic PCI
    pci_restore_state                      <-- generic PCI
    amd_irongate_driver.configure          <-- device-specific

Convert to generic power management where the PCI bus PM methods do the
generic PCI things, and the driver needs only the device-specific part,
i.e.,

  suspend_devices_and_enter
    dpm_suspend_start(PMSG_SUSPEND)
      pci_pm_suspend                       # PCI bus .suspend() method
        agp_amdk7_suspend                  <-- not needed at all; removed
    suspend_enter
      dpm_suspend_noirq(PMSG_SUSPEND)
        pci_pm_suspend_noirq               # PCI bus .suspend_noirq() method
          pci_save_state                   <-- generic PCI
          pci_prepare_to_sleep             <-- generic PCI
            pci_set_power_state
    ...
    dpm_resume_end(PMSG_RESUME)
      pci_pm_resume                        # PCI bus .resume() method
        pci_restore_standard_config
          pci_set_power_state(PCI_D0)      <-- generic PCI
          pci_restore_state                <-- generic PCI
        agp_amdk7_resume                   # driver->pm->resume
          amd_irongate_driver.configure    <-- device-specific

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/amd-k7-agp.c | 24 ++++--------------------
 1 file changed, 4 insertions(+), 20 deletions(-)

diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c
index 2b2095542816..55397ba765d2 100644
--- a/drivers/char/agp/amd-k7-agp.c
+++ b/drivers/char/agp/amd-k7-agp.c
@@ -488,26 +488,11 @@ static void agp_amdk7_remove(struct pci_dev *pdev)
 	agp_put_bridge(bridge);
 }
 
-#ifdef CONFIG_PM
-
-static int agp_amdk7_suspend(struct pci_dev *pdev, pm_message_t state)
+static int agp_amdk7_resume(struct device *dev)
 {
-	pci_save_state(pdev);
-	pci_set_power_state(pdev, pci_choose_state(pdev, state));
-
-	return 0;
-}
-
-static int agp_amdk7_resume(struct pci_dev *pdev)
-{
-	pci_set_power_state(pdev, PCI_D0);
-	pci_restore_state(pdev);
-
 	return amd_irongate_driver.configure();
 }
 
-#endif /* CONFIG_PM */
-
 /* must be the same order as name table above */
 static const struct pci_device_id agp_amdk7_pci_table[] = {
 	{
@@ -539,15 +524,14 @@ static const struct pci_device_id agp_amdk7_pci_table[] = {
 
 MODULE_DEVICE_TABLE(pci, agp_amdk7_pci_table);
 
+static DEFINE_SIMPLE_DEV_PM_OPS(agp_amdk7_pm_ops, NULL, agp_amdk7_resume);
+
 static struct pci_driver agp_amdk7_pci_driver = {
 	.name		= "agpgart-amdk7",
 	.id_table	= agp_amdk7_pci_table,
 	.probe		= agp_amdk7_probe,
 	.remove		= agp_amdk7_remove,
-#ifdef CONFIG_PM
-	.suspend	= agp_amdk7_suspend,
-	.resume		= agp_amdk7_resume,
-#endif
+	.driver.pm	= &agp_amdk7_pm_ops,
 };
 
 static int __init agp_amdk7_init(void)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 4/8] agp/ati: Convert to generic power management
  2022-10-25 20:38 [PATCH v2 0/8] agp: Convert to generic power management Bjorn Helgaas
                   ` (2 preceding siblings ...)
  2022-10-25 20:38 ` [PATCH v2 3/8] agp/amd-k7: " Bjorn Helgaas
@ 2022-10-25 20:38 ` Bjorn Helgaas
  2022-10-25 20:38 ` [PATCH v2 5/8] agp/nvidia: " Bjorn Helgaas
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2022-10-25 20:38 UTC (permalink / raw)
  To: David Airlie
  Cc: Krzysztof Wilczyński, Rafael J . Wysocki, Vaibhav Gupta,
	dri-devel, linux-pci, linux-pm, linux-kernel, Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

Convert agpgart-ati from legacy PCI power management to the generic power
management framework.

Previously agpgart-ati used legacy PCI power management, and
agp_ati_suspend() and agp_ati_resume() were responsible for both
device-specific things and generic PCI things like saving and restoring
config space and managing power state:

  agp_ati_suspend
    pci_save_state                         <-- generic PCI
    pci_set_power_state(PCI_D3hot)         <-- generic PCI

  agp_ati_resume
    pci_set_power_state(PCI_D0)            <-- generic PCI
    pci_restore_state                      <-- generic PCI
    ati_configure                          <-- device-specific

With generic power management, the PCI bus PM methods do the generic PCI
things, and the driver needs only the device-specific part, i.e.,

  suspend_devices_and_enter
    dpm_suspend_start(PMSG_SUSPEND)
      pci_pm_suspend                       # PCI bus .suspend() method
        agp_ati_suspend                    <-- not needed at all; removed
    suspend_enter
      dpm_suspend_noirq(PMSG_SUSPEND)
        pci_pm_suspend_noirq               # PCI bus .suspend_noirq() method
          pci_save_state                   <-- generic PCI
          pci_prepare_to_sleep             <-- generic PCI
            pci_set_power_state
    ...
    dpm_resume_end(PMSG_RESUME)
      pci_pm_resume                        # PCI bus .resume() method
        pci_restore_standard_config
          pci_set_power_state(PCI_D0)      <-- generic PCI
          pci_restore_state                <-- generic PCI
        agp_ati_resume                     # driver->pm->resume
          ati_configure                    <-- device-specific

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/ati-agp.c | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
index 6f5530482d83..3c1fce48aabe 100644
--- a/drivers/char/agp/ati-agp.c
+++ b/drivers/char/agp/ati-agp.c
@@ -238,23 +238,10 @@ static int ati_configure(void)
 }
 
 
-#ifdef CONFIG_PM
-static int agp_ati_suspend(struct pci_dev *dev, pm_message_t state)
+static int agp_ati_resume(struct device *dev)
 {
-	pci_save_state(dev);
-	pci_set_power_state(dev, PCI_D3hot);
-
-	return 0;
-}
-
-static int agp_ati_resume(struct pci_dev *dev)
-{
-	pci_set_power_state(dev, PCI_D0);
-	pci_restore_state(dev);
-
 	return ati_configure();
 }
-#endif
 
 /*
  *Since we don't need contiguous memory we just try
@@ -559,15 +546,14 @@ static const struct pci_device_id agp_ati_pci_table[] = {
 
 MODULE_DEVICE_TABLE(pci, agp_ati_pci_table);
 
+static DEFINE_SIMPLE_DEV_PM_OPS(agp_ati_pm_ops, NULL, agp_ati_resume);
+
 static struct pci_driver agp_ati_pci_driver = {
 	.name		= "agpgart-ati",
 	.id_table	= agp_ati_pci_table,
 	.probe		= agp_ati_probe,
 	.remove		= agp_ati_remove,
-#ifdef CONFIG_PM
-	.suspend	= agp_ati_suspend,
-	.resume		= agp_ati_resume,
-#endif
+	.driver.pm	= &agp_ati_pm_ops,
 };
 
 static int __init agp_ati_init(void)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 5/8] agp/nvidia: Convert to generic power management
  2022-10-25 20:38 [PATCH v2 0/8] agp: Convert to generic power management Bjorn Helgaas
                   ` (3 preceding siblings ...)
  2022-10-25 20:38 ` [PATCH v2 4/8] agp/ati: " Bjorn Helgaas
@ 2022-10-25 20:38 ` Bjorn Helgaas
  2022-10-25 20:38 ` [PATCH v2 6/8] agp/amd64: Update to DEFINE_SIMPLE_DEV_PM_OPS() Bjorn Helgaas
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2022-10-25 20:38 UTC (permalink / raw)
  To: David Airlie
  Cc: Krzysztof Wilczyński, Rafael J . Wysocki, Vaibhav Gupta,
	dri-devel, linux-pci, linux-pm, linux-kernel, Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

Convert agpgart-nvidia from legacy PCI power management to the generic
power management framework.

Previously agpgart-nvidia used legacy PCI power management, and
agp_nvidia_suspend() and agp_nvidia_resume() were responsible for both
device-specific things and generic PCI things:

  agp_nvidia_suspend
    pci_save_state                         <-- generic PCI
    pci_set_power_state(PCI_D3hot)         <-- generic PCI

  agp_nvidia_resume
    pci_set_power_state(PCI_D0)            <-- generic PCI
    pci_restore_state                      <-- generic PCI
    nvidia_configure                       <-- device-specific

Convert to generic power management where the PCI bus PM methods do the
generic PCI things, and the driver needs only the device-specific part,
i.e.,

  suspend_devices_and_enter
    dpm_suspend_start(PMSG_SUSPEND)
      pci_pm_suspend                       # PCI bus .suspend() method
        agp_nvidia_suspend                 <-- not needed at all; removed
    suspend_enter
      dpm_suspend_noirq(PMSG_SUSPEND)
        pci_pm_suspend_noirq               # PCI bus .suspend_noirq() method
          pci_save_state                   <-- generic PCI
          pci_prepare_to_sleep             <-- generic PCI
            pci_set_power_state
    ...
    dpm_resume_end(PMSG_RESUME)
      pci_pm_resume                        # PCI bus .resume() method
        pci_restore_standard_config
          pci_set_power_state(PCI_D0)      <-- generic PCI
          pci_restore_state                <-- generic PCI
        agp_nvidia_resume                  # driver->pm->resume
          nvidia_configure                 <-- device-specific

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/nvidia-agp.c | 24 ++++--------------------
 1 file changed, 4 insertions(+), 20 deletions(-)

diff --git a/drivers/char/agp/nvidia-agp.c b/drivers/char/agp/nvidia-agp.c
index 826dbd06f6bb..dbcbc06cc202 100644
--- a/drivers/char/agp/nvidia-agp.c
+++ b/drivers/char/agp/nvidia-agp.c
@@ -404,28 +404,13 @@ static void agp_nvidia_remove(struct pci_dev *pdev)
 	agp_put_bridge(bridge);
 }
 
-#ifdef CONFIG_PM
-static int agp_nvidia_suspend(struct pci_dev *pdev, pm_message_t state)
+static int agp_nvidia_resume(struct device *dev)
 {
-	pci_save_state(pdev);
-	pci_set_power_state(pdev, PCI_D3hot);
-
-	return 0;
-}
-
-static int agp_nvidia_resume(struct pci_dev *pdev)
-{
-	/* set power state 0 and restore PCI space */
-	pci_set_power_state(pdev, PCI_D0);
-	pci_restore_state(pdev);
-
 	/* reconfigure AGP hardware again */
 	nvidia_configure();
 
 	return 0;
 }
-#endif
-
 
 static const struct pci_device_id agp_nvidia_pci_table[] = {
 	{
@@ -449,15 +434,14 @@ static const struct pci_device_id agp_nvidia_pci_table[] = {
 
 MODULE_DEVICE_TABLE(pci, agp_nvidia_pci_table);
 
+static DEFINE_SIMPLE_DEV_PM_OPS(agp_nvidia_pm_ops, NULL, agp_nvidia_resume);
+
 static struct pci_driver agp_nvidia_pci_driver = {
 	.name		= "agpgart-nvidia",
 	.id_table	= agp_nvidia_pci_table,
 	.probe		= agp_nvidia_probe,
 	.remove		= agp_nvidia_remove,
-#ifdef CONFIG_PM
-	.suspend	= agp_nvidia_suspend,
-	.resume		= agp_nvidia_resume,
-#endif
+	.driver.pm	= &agp_nvidia_pm_ops,
 };
 
 static int __init agp_nvidia_init(void)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 6/8] agp/amd64: Update to DEFINE_SIMPLE_DEV_PM_OPS()
  2022-10-25 20:38 [PATCH v2 0/8] agp: Convert to generic power management Bjorn Helgaas
                   ` (4 preceding siblings ...)
  2022-10-25 20:38 ` [PATCH v2 5/8] agp/nvidia: " Bjorn Helgaas
@ 2022-10-25 20:38 ` Bjorn Helgaas
  2022-10-25 20:38 ` [PATCH v2 7/8] agp/sis: " Bjorn Helgaas
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2022-10-25 20:38 UTC (permalink / raw)
  To: David Airlie
  Cc: Krzysztof Wilczyński, Rafael J . Wysocki, Vaibhav Gupta,
	dri-devel, linux-pci, linux-pm, linux-kernel, Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

As of 1a3c7bb08826 ("PM: core: Add new *_PM_OPS macros, deprecate old
ones"), SIMPLE_DEV_PM_OPS() is deprecated in favor of
DEFINE_SIMPLE_DEV_PM_OPS(), which has the advantage that the PM callbacks
don't need to be wrapped with #ifdef CONFIG_PM or tagged with
__maybe_unused.

Convert to DEFINE_SIMPLE_DEV_PM_OPS().  No functional change intended.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/char/agp/amd64-agp.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index 84a4aa9312cf..ce8651436609 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -588,9 +588,7 @@ static void agp_amd64_remove(struct pci_dev *pdev)
 	agp_bridges_found--;
 }
 
-#define agp_amd64_suspend NULL
-
-static int __maybe_unused agp_amd64_resume(struct device *dev)
+static int agp_amd64_resume(struct device *dev)
 {
 	struct pci_dev *pdev = to_pci_dev(dev);
 
@@ -727,7 +725,7 @@ static const struct pci_device_id agp_amd64_pci_promisc_table[] = {
 	{ }
 };
 
-static SIMPLE_DEV_PM_OPS(agp_amd64_pm_ops, agp_amd64_suspend, agp_amd64_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(agp_amd64_pm_ops, NULL, agp_amd64_resume);
 
 static struct pci_driver agp_amd64_pci_driver = {
 	.name		= "agpgart-amd64",
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 7/8] agp/sis: Update to DEFINE_SIMPLE_DEV_PM_OPS()
  2022-10-25 20:38 [PATCH v2 0/8] agp: Convert to generic power management Bjorn Helgaas
                   ` (5 preceding siblings ...)
  2022-10-25 20:38 ` [PATCH v2 6/8] agp/amd64: Update to DEFINE_SIMPLE_DEV_PM_OPS() Bjorn Helgaas
@ 2022-10-25 20:38 ` Bjorn Helgaas
  2022-10-25 20:38 ` [PATCH v2 8/8] agp/via: " Bjorn Helgaas
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2022-10-25 20:38 UTC (permalink / raw)
  To: David Airlie
  Cc: Krzysztof Wilczyński, Rafael J . Wysocki, Vaibhav Gupta,
	dri-devel, linux-pci, linux-pm, linux-kernel, Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

As of 1a3c7bb08826 ("PM: core: Add new *_PM_OPS macros, deprecate old
ones"), SIMPLE_DEV_PM_OPS() is deprecated in favor of
DEFINE_SIMPLE_DEV_PM_OPS(), which has the advantage that the PM callbacks
don't need to be wrapped with #ifdef CONFIG_PM or tagged with
__maybe_unused.

Convert to DEFINE_SIMPLE_DEV_PM_OPS().  No functional change intended.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/char/agp/sis-agp.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/char/agp/sis-agp.c b/drivers/char/agp/sis-agp.c
index f8a02f4bef1b..484bb101c53b 100644
--- a/drivers/char/agp/sis-agp.c
+++ b/drivers/char/agp/sis-agp.c
@@ -217,10 +217,7 @@ static void agp_sis_remove(struct pci_dev *pdev)
 	agp_put_bridge(bridge);
 }
 
-#define agp_sis_suspend NULL
-
-static int __maybe_unused agp_sis_resume(
-	__attribute__((unused)) struct device *dev)
+static int agp_sis_resume(__attribute__((unused)) struct device *dev)
 {
 	return sis_driver.configure();
 }
@@ -407,7 +404,7 @@ 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 DEFINE_SIMPLE_DEV_PM_OPS(agp_sis_pm_ops, NULL, agp_sis_resume);
 
 static struct pci_driver agp_sis_pci_driver = {
 	.name		= "agpgart-sis",
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 8/8] agp/via: Update to DEFINE_SIMPLE_DEV_PM_OPS()
  2022-10-25 20:38 [PATCH v2 0/8] agp: Convert to generic power management Bjorn Helgaas
                   ` (6 preceding siblings ...)
  2022-10-25 20:38 ` [PATCH v2 7/8] agp/sis: " Bjorn Helgaas
@ 2022-10-25 20:38 ` Bjorn Helgaas
  2022-10-25 22:17 ` [PATCH v2 0/8] agp: Convert to generic power management Dave Airlie
  2022-10-25 22:44 ` Bjorn Helgaas
  9 siblings, 0 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2022-10-25 20:38 UTC (permalink / raw)
  To: David Airlie
  Cc: Krzysztof Wilczyński, Rafael J . Wysocki, Vaibhav Gupta,
	dri-devel, linux-pci, linux-pm, linux-kernel, Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

As of 1a3c7bb08826 ("PM: core: Add new *_PM_OPS macros, deprecate old
ones"), SIMPLE_DEV_PM_OPS() is deprecated in favor of
DEFINE_SIMPLE_DEV_PM_OPS(), which has the advantage that the PM callbacks
don't need to be wrapped with #ifdef CONFIG_PM or tagged with
__maybe_unused.

Convert to DEFINE_SIMPLE_DEV_PM_OPS().  No functional change intended.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/char/agp/via-agp.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c
index b2f484f527fb..bc5140af2dcb 100644
--- a/drivers/char/agp/via-agp.c
+++ b/drivers/char/agp/via-agp.c
@@ -489,9 +489,7 @@ static void agp_via_remove(struct pci_dev *pdev)
 	agp_put_bridge(bridge);
 }
 
-#define agp_via_suspend NULL
-
-static int __maybe_unused agp_via_resume(struct device *dev)
+static int agp_via_resume(struct device *dev)
 {
 	struct agp_bridge_data *bridge = dev_get_drvdata(dev);
 
@@ -551,7 +549,7 @@ static const struct pci_device_id agp_via_pci_table[] = {
 
 MODULE_DEVICE_TABLE(pci, agp_via_pci_table);
 
-static SIMPLE_DEV_PM_OPS(agp_via_pm_ops, agp_via_suspend, agp_via_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(agp_via_pm_ops, NULL, agp_via_resume);
 
 static struct pci_driver agp_via_pci_driver = {
 	.name		= "agpgart-via",
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 0/8] agp: Convert to generic power management
  2022-10-25 20:38 [PATCH v2 0/8] agp: Convert to generic power management Bjorn Helgaas
                   ` (7 preceding siblings ...)
  2022-10-25 20:38 ` [PATCH v2 8/8] agp/via: " Bjorn Helgaas
@ 2022-10-25 22:17 ` Dave Airlie
  2022-10-25 22:43   ` Bjorn Helgaas
  2022-10-25 22:44 ` Bjorn Helgaas
  9 siblings, 1 reply; 12+ messages in thread
From: Dave Airlie @ 2022-10-25 22:17 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: David Airlie, Krzysztof Wilczyński, linux-pm, linux-pci,
	Vaibhav Gupta, linux-kernel, dri-devel, Bjorn Helgaas,
	Rafael J . Wysocki

On Wed, 26 Oct 2022 at 06:39, Bjorn Helgaas <helgaas@kernel.org> wrote:
>
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> Vaibhav converted several AGP drivers from legacy PCI power management to
> generic power management [1].  This series converts the rest of them.

Do you want to merge through the PCI tree?

Acked-by: Dave Airlie <airlied@redhat.com>

Dave.
>
> v1 posted at [2].
>
> Changes from v1 to v2:
>   - Convert from SIMPLE_DEV_PM_OPS() (which is deprecated) to
>     DEFINE_SIMPLE_DEV_PM_OPS() and remove __maybe_unused annotations.
>
> [1] https://lore.kernel.org/all/20210112080924.1038907-1-vaibhavgupta40@gmail.com/#t
> [2] https://lore.kernel.org/all/20220607034340.307318-1-helgaas@kernel.org/
>
> Bjorn Helgaas (8):
>   agp/efficeon: Convert to generic power management
>   agp/intel: Convert to generic power management
>   agp/amd-k7: Convert to generic power management
>   agp/ati: Convert to generic power management
>   agp/nvidia: Convert to generic power management
>   agp/amd64: Update to DEFINE_SIMPLE_DEV_PM_OPS()
>   agp/sis: Update to DEFINE_SIMPLE_DEV_PM_OPS()
>   agp/via: Update to DEFINE_SIMPLE_DEV_PM_OPS()
>
>  drivers/char/agp/amd-k7-agp.c   | 24 ++++--------------------
>  drivers/char/agp/amd64-agp.c    |  6 ++----
>  drivers/char/agp/ati-agp.c      | 22 ++++------------------
>  drivers/char/agp/efficeon-agp.c | 16 ++++------------
>  drivers/char/agp/intel-agp.c    | 11 +++++------
>  drivers/char/agp/nvidia-agp.c   | 24 ++++--------------------
>  drivers/char/agp/sis-agp.c      |  7 ++-----
>  drivers/char/agp/via-agp.c      |  6 ++----
>  8 files changed, 27 insertions(+), 89 deletions(-)
>
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 0/8] agp: Convert to generic power management
  2022-10-25 22:17 ` [PATCH v2 0/8] agp: Convert to generic power management Dave Airlie
@ 2022-10-25 22:43   ` Bjorn Helgaas
  0 siblings, 0 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2022-10-25 22:43 UTC (permalink / raw)
  To: Dave Airlie
  Cc: Krzysztof Wilczyński, Vaibhav Gupta, linux-pci, linux-pm,
	linux-kernel, dri-devel, Bjorn Helgaas, David Airlie,
	Rafael J . Wysocki

On Wed, Oct 26, 2022 at 08:17:47AM +1000, Dave Airlie wrote:
> On Wed, 26 Oct 2022 at 06:39, Bjorn Helgaas <helgaas@kernel.org> wrote:
> >
> > From: Bjorn Helgaas <bhelgaas@google.com>
> >
> > Vaibhav converted several AGP drivers from legacy PCI power management to
> > generic power management [1].  This series converts the rest of them.
> 
> Do you want to merge through the PCI tree?
> 
> Acked-by: Dave Airlie <airlied@redhat.com>

Sure, will be happy to.  Thanks!

> > v1 posted at [2].
> >
> > Changes from v1 to v2:
> >   - Convert from SIMPLE_DEV_PM_OPS() (which is deprecated) to
> >     DEFINE_SIMPLE_DEV_PM_OPS() and remove __maybe_unused annotations.
> >
> > [1] https://lore.kernel.org/all/20210112080924.1038907-1-vaibhavgupta40@gmail.com/#t
> > [2] https://lore.kernel.org/all/20220607034340.307318-1-helgaas@kernel.org/
> >
> > Bjorn Helgaas (8):
> >   agp/efficeon: Convert to generic power management
> >   agp/intel: Convert to generic power management
> >   agp/amd-k7: Convert to generic power management
> >   agp/ati: Convert to generic power management
> >   agp/nvidia: Convert to generic power management
> >   agp/amd64: Update to DEFINE_SIMPLE_DEV_PM_OPS()
> >   agp/sis: Update to DEFINE_SIMPLE_DEV_PM_OPS()
> >   agp/via: Update to DEFINE_SIMPLE_DEV_PM_OPS()
> >
> >  drivers/char/agp/amd-k7-agp.c   | 24 ++++--------------------
> >  drivers/char/agp/amd64-agp.c    |  6 ++----
> >  drivers/char/agp/ati-agp.c      | 22 ++++------------------
> >  drivers/char/agp/efficeon-agp.c | 16 ++++------------
> >  drivers/char/agp/intel-agp.c    | 11 +++++------
> >  drivers/char/agp/nvidia-agp.c   | 24 ++++--------------------
> >  drivers/char/agp/sis-agp.c      |  7 ++-----
> >  drivers/char/agp/via-agp.c      |  6 ++----
> >  8 files changed, 27 insertions(+), 89 deletions(-)
> >
> > --
> > 2.25.1
> >

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 0/8] agp: Convert to generic power management
  2022-10-25 20:38 [PATCH v2 0/8] agp: Convert to generic power management Bjorn Helgaas
                   ` (8 preceding siblings ...)
  2022-10-25 22:17 ` [PATCH v2 0/8] agp: Convert to generic power management Dave Airlie
@ 2022-10-25 22:44 ` Bjorn Helgaas
  9 siblings, 0 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2022-10-25 22:44 UTC (permalink / raw)
  To: David Airlie
  Cc: Krzysztof Wilczyński, linux-pm, linux-pci, Vaibhav Gupta,
	linux-kernel, dri-devel, Bjorn Helgaas, Rafael J . Wysocki

On Tue, Oct 25, 2022 at 03:38:44PM -0500, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
> 
> Vaibhav converted several AGP drivers from legacy PCI power management to
> generic power management [1].  This series converts the rest of them.
> 
> v1 posted at [2].
> 
> Changes from v1 to v2:
>   - Convert from SIMPLE_DEV_PM_OPS() (which is deprecated) to
>     DEFINE_SIMPLE_DEV_PM_OPS() and remove __maybe_unused annotations.
> 
> [1] https://lore.kernel.org/all/20210112080924.1038907-1-vaibhavgupta40@gmail.com/#t
> [2] https://lore.kernel.org/all/20220607034340.307318-1-helgaas@kernel.org/
> 
> Bjorn Helgaas (8):
>   agp/efficeon: Convert to generic power management
>   agp/intel: Convert to generic power management
>   agp/amd-k7: Convert to generic power management
>   agp/ati: Convert to generic power management
>   agp/nvidia: Convert to generic power management
>   agp/amd64: Update to DEFINE_SIMPLE_DEV_PM_OPS()
>   agp/sis: Update to DEFINE_SIMPLE_DEV_PM_OPS()
>   agp/via: Update to DEFINE_SIMPLE_DEV_PM_OPS()
> 
>  drivers/char/agp/amd-k7-agp.c   | 24 ++++--------------------
>  drivers/char/agp/amd64-agp.c    |  6 ++----
>  drivers/char/agp/ati-agp.c      | 22 ++++------------------
>  drivers/char/agp/efficeon-agp.c | 16 ++++------------
>  drivers/char/agp/intel-agp.c    | 11 +++++------
>  drivers/char/agp/nvidia-agp.c   | 24 ++++--------------------
>  drivers/char/agp/sis-agp.c      |  7 ++-----
>  drivers/char/agp/via-agp.c      |  6 ++----
>  8 files changed, 27 insertions(+), 89 deletions(-)

Applied with Dave's ack to pci/pm-agp for v6.2.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-10-25 22:44 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-25 20:38 [PATCH v2 0/8] agp: Convert to generic power management Bjorn Helgaas
2022-10-25 20:38 ` [PATCH v2 1/8] agp/efficeon: " Bjorn Helgaas
2022-10-25 20:38 ` [PATCH v2 2/8] agp/intel: " Bjorn Helgaas
2022-10-25 20:38 ` [PATCH v2 3/8] agp/amd-k7: " Bjorn Helgaas
2022-10-25 20:38 ` [PATCH v2 4/8] agp/ati: " Bjorn Helgaas
2022-10-25 20:38 ` [PATCH v2 5/8] agp/nvidia: " Bjorn Helgaas
2022-10-25 20:38 ` [PATCH v2 6/8] agp/amd64: Update to DEFINE_SIMPLE_DEV_PM_OPS() Bjorn Helgaas
2022-10-25 20:38 ` [PATCH v2 7/8] agp/sis: " Bjorn Helgaas
2022-10-25 20:38 ` [PATCH v2 8/8] agp/via: " Bjorn Helgaas
2022-10-25 22:17 ` [PATCH v2 0/8] agp: Convert to generic power management Dave Airlie
2022-10-25 22:43   ` Bjorn Helgaas
2022-10-25 22:44 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).