diff mbox series

[4/6] xen-platform: Convert to generic power management

Message ID 20191101204558.210235-5-helgaas@kernel.org
State Accepted
Delegated to: Bjorn Helgaas
Headers show
Series PCI/PM: Minor fix and cleanups | expand

Commit Message

Bjorn Helgaas Nov. 1, 2019, 8:45 p.m. UTC
From: Bjorn Helgaas <bhelgaas@google.com>

Convert xen-platform from the legacy PCI power management callbacks to the
generic operations.  This is one step towards removing support for the
legacy PCI callbacks.

The generic .resume_noirq() operation is called by pci_pm_resume_noirq() at
the same point the legacy PCI .resume_early() callback was, so this patch
should not change the xen-platform behavior.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: KarimAllah Ahmed <karahmed@amazon.de>
---
 drivers/xen/platform-pci.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Rafael J. Wysocki Nov. 4, 2019, 10:32 a.m. UTC | #1
On Fri, Nov 1, 2019 at 9:46 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
>
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> Convert xen-platform from the legacy PCI power management callbacks to the
> generic operations.  This is one step towards removing support for the
> legacy PCI callbacks.
>
> The generic .resume_noirq() operation is called by pci_pm_resume_noirq() at
> the same point the legacy PCI .resume_early() callback was, so this patch
> should not change the xen-platform behavior.
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Stefano Stabellini <sstabellini@kernel.org>
> Cc: KarimAllah Ahmed <karahmed@amazon.de>

Good idea:

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

> ---
>  drivers/xen/platform-pci.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/xen/platform-pci.c b/drivers/xen/platform-pci.c
> index 5e30602fdbad..e06e8769eb84 100644
> --- a/drivers/xen/platform-pci.c
> +++ b/drivers/xen/platform-pci.c
> @@ -168,13 +168,17 @@ static const struct pci_device_id platform_pci_tbl[] = {
>         {0,}
>  };
>
> +static struct dev_pm_ops platform_pm_ops = {
> +       .resume_noirq =   platform_pci_resume,
> +};
> +
>  static struct pci_driver platform_driver = {
>         .name =           DRV_NAME,
>         .probe =          platform_pci_probe,
>         .id_table =       platform_pci_tbl,
> -#ifdef CONFIG_PM
> -       .resume_early =   platform_pci_resume,
> -#endif
> +       .driver = {
> +               .pm =     &platform_pm_ops,
> +       },
>  };
>
>  builtin_pci_driver(platform_driver);
> --
> 2.24.0.rc1.363.gb1bccd3e3d-goog
>
Bjorn Helgaas Nov. 4, 2019, 3:23 p.m. UTC | #2
On Fri, Nov 01, 2019 at 03:45:56PM -0500, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
> 
> Convert xen-platform from the legacy PCI power management callbacks to the
> generic operations.  This is one step towards removing support for the
> legacy PCI callbacks.
> 
> The generic .resume_noirq() operation is called by pci_pm_resume_noirq() at
> the same point the legacy PCI .resume_early() callback was, so this patch
> should not change the xen-platform behavior.
> 
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

I made the tweak below to fix the compile error.  I could swear I
built this, but I must have been mistaken.

> Cc: Stefano Stabellini <sstabellini@kernel.org>
> Cc: KarimAllah Ahmed <karahmed@amazon.de>
> ---
>  drivers/xen/platform-pci.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/xen/platform-pci.c b/drivers/xen/platform-pci.c
> index 5e30602fdbad..e06e8769eb84 100644
> --- a/drivers/xen/platform-pci.c
> +++ b/drivers/xen/platform-pci.c
> @@ -168,13 +168,17 @@ static const struct pci_device_id platform_pci_tbl[] = {
>  	{0,}
>  };
>  
> +static struct dev_pm_ops platform_pm_ops = {
> +	.resume_noirq =   platform_pci_resume,
> +};
> +
>  static struct pci_driver platform_driver = {
>  	.name =           DRV_NAME,
>  	.probe =          platform_pci_probe,
>  	.id_table =       platform_pci_tbl,
> -#ifdef CONFIG_PM
> -	.resume_early =   platform_pci_resume,
> -#endif
> +	.driver = {
> +		.pm =     &platform_pm_ops,
> +	},
>  };
>  
>  builtin_pci_driver(platform_driver);
> -- 
> 2.24.0.rc1.363.gb1bccd3e3d-goog

diff --git a/drivers/xen/platform-pci.c b/drivers/xen/platform-pci.c
index e06e8769eb84..59e85e408c23 100644
--- a/drivers/xen/platform-pci.c
+++ b/drivers/xen/platform-pci.c
@@ -74,7 +74,7 @@ static int xen_allocate_irq(struct pci_dev *pdev)
 			"xen-platform-pci", pdev);
 }
 
-static int platform_pci_resume(struct pci_dev *pdev)
+static int platform_pci_resume(struct device *dev)
 {
 	int err;
 
@@ -83,7 +83,7 @@ static int platform_pci_resume(struct pci_dev *pdev)
 
 	err = xen_set_callback_via(callback_via);
 	if (err) {
-		dev_err(&pdev->dev, "platform_pci_resume failure!\n");
+		dev_err(dev, "platform_pci_resume failure!\n");
 		return err;
 	}
 	return 0;
Bjorn Helgaas Nov. 5, 2019, 9:51 p.m. UTC | #3
On Mon, Nov 04, 2019 at 09:23:30AM -0600, Bjorn Helgaas wrote:
> On Fri, Nov 01, 2019 at 03:45:56PM -0500, Bjorn Helgaas wrote:
> > From: Bjorn Helgaas <bhelgaas@google.com>
> > 
> > Convert xen-platform from the legacy PCI power management callbacks to the
> > generic operations.  This is one step towards removing support for the
> > legacy PCI callbacks.
> > 
> > The generic .resume_noirq() operation is called by pci_pm_resume_noirq() at
> > the same point the legacy PCI .resume_early() callback was, so this patch
> > should not change the xen-platform behavior.
> > 
> > Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> 
> I made the tweak below to fix the compile error.  I could swear I
> built this, but I must have been mistaken.
> 
> > Cc: Stefano Stabellini <sstabellini@kernel.org>
> > Cc: KarimAllah Ahmed <karahmed@amazon.de>

I applied this to pci/pm for v5.5 as part of the larger series:
https://lore.kernel.org/r/20191101204558.210235-1-helgaas@kernel.org

> > ---
> >  drivers/xen/platform-pci.c | 10 +++++++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/xen/platform-pci.c b/drivers/xen/platform-pci.c
> > index 5e30602fdbad..e06e8769eb84 100644
> > --- a/drivers/xen/platform-pci.c
> > +++ b/drivers/xen/platform-pci.c
> > @@ -168,13 +168,17 @@ static const struct pci_device_id platform_pci_tbl[] = {
> >  	{0,}
> >  };
> >  
> > +static struct dev_pm_ops platform_pm_ops = {
> > +	.resume_noirq =   platform_pci_resume,
> > +};
> > +
> >  static struct pci_driver platform_driver = {
> >  	.name =           DRV_NAME,
> >  	.probe =          platform_pci_probe,
> >  	.id_table =       platform_pci_tbl,
> > -#ifdef CONFIG_PM
> > -	.resume_early =   platform_pci_resume,
> > -#endif
> > +	.driver = {
> > +		.pm =     &platform_pm_ops,
> > +	},
> >  };
> >  
> >  builtin_pci_driver(platform_driver);
> > -- 
> > 2.24.0.rc1.363.gb1bccd3e3d-goog
> 
> diff --git a/drivers/xen/platform-pci.c b/drivers/xen/platform-pci.c
> index e06e8769eb84..59e85e408c23 100644
> --- a/drivers/xen/platform-pci.c
> +++ b/drivers/xen/platform-pci.c
> @@ -74,7 +74,7 @@ static int xen_allocate_irq(struct pci_dev *pdev)
>  			"xen-platform-pci", pdev);
>  }
>  
> -static int platform_pci_resume(struct pci_dev *pdev)
> +static int platform_pci_resume(struct device *dev)
>  {
>  	int err;
>  
> @@ -83,7 +83,7 @@ static int platform_pci_resume(struct pci_dev *pdev)
>  
>  	err = xen_set_callback_via(callback_via);
>  	if (err) {
> -		dev_err(&pdev->dev, "platform_pci_resume failure!\n");
> +		dev_err(dev, "platform_pci_resume failure!\n");
>  		return err;
>  	}
>  	return 0;
diff mbox series

Patch

diff --git a/drivers/xen/platform-pci.c b/drivers/xen/platform-pci.c
index 5e30602fdbad..e06e8769eb84 100644
--- a/drivers/xen/platform-pci.c
+++ b/drivers/xen/platform-pci.c
@@ -168,13 +168,17 @@  static const struct pci_device_id platform_pci_tbl[] = {
 	{0,}
 };
 
+static struct dev_pm_ops platform_pm_ops = {
+	.resume_noirq =   platform_pci_resume,
+};
+
 static struct pci_driver platform_driver = {
 	.name =           DRV_NAME,
 	.probe =          platform_pci_probe,
 	.id_table =       platform_pci_tbl,
-#ifdef CONFIG_PM
-	.resume_early =   platform_pci_resume,
-#endif
+	.driver = {
+		.pm =     &platform_pm_ops,
+	},
 };
 
 builtin_pci_driver(platform_driver);