Patchwork [6/6] sata_mv: add power management support for the PCI controllers.

login
register
mail settings
Submitter Saeed Bishara
Date Dec. 6, 2009, 4:26 p.m.
Message ID <1260116782-31714-6-git-send-email-saeed@marvell.com>
Download mbox | patch
Permalink /patch/40433/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Saeed Bishara - Dec. 6, 2009, 4:26 p.m.
Signed-off-by: Saeed Bishara <saeed@marvell.com>
---
 drivers/ata/sata_mv.c |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)
Grant Grundler - Dec. 7, 2009, 6:32 a.m.
On Sun, Dec 6, 2009 at 8:26 AM, Saeed Bishara <saeed@marvell.com> wrote:
> Signed-off-by: Saeed Bishara <saeed@marvell.com>
> ---
>  drivers/ata/sata_mv.c |   29 +++++++++++++++++++++++++++++
>  1 files changed, 29 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
> index 71ac62e..704d86f 100755
> --- a/drivers/ata/sata_mv.c
> +++ b/drivers/ata/sata_mv.c
> @@ -4161,6 +4161,9 @@ static struct platform_driver mv_platform_driver = {
>  #ifdef CONFIG_PCI
>  static int mv_pci_init_one(struct pci_dev *pdev,
>                           const struct pci_device_id *ent);
> +#ifdef CONFIG_PM
> +static int mv_pci_device_resume(struct pci_dev *pdev);
> +#endif
>
>
>  static struct pci_driver mv_pci_driver = {
> @@ -4168,6 +4171,11 @@ static struct pci_driver mv_pci_driver = {
>        .id_table               = mv_pci_tbl,
>        .probe                  = mv_pci_init_one,
>        .remove                 = ata_pci_remove_one,
> +#ifdef CONFIG_PM
> +       .suspend                = ata_pci_device_suspend,
> +       .resume                 = mv_pci_device_resume,
> +#endif

Saeed,
Apologies - Ignore my previous comment on the mv_platform_driver() patch.
I should have been looking at this patch.

And interesting to see that sata_via is the only SATA driver setting
ata_pci_device_resume() for it's .resume call. The rest of the callers
are PATA drivers.

Reviewed-by: Grant Grundler <grundler@google.com>

thanks,
grant

> +
>  };
>
>  /* move to PCI layer or libata core? */
> @@ -4324,6 +4332,27 @@ static int mv_pci_init_one(struct pci_dev *pdev,
>        return ata_host_activate(host, pdev->irq, mv_interrupt, IRQF_SHARED,
>                                 IS_GEN_I(hpriv) ? &mv5_sht : &mv6_sht);
>  }
> +
> +#ifdef CONFIG_PM
> +static int mv_pci_device_resume(struct pci_dev *pdev)
> +{
> +       struct ata_host *host = dev_get_drvdata(&pdev->dev);
> +       int rc;
> +
> +       rc = ata_pci_device_do_resume(pdev);
> +       if (rc)
> +               return rc;
> +
> +       /* initialize adapter */
> +       rc = mv_init_host(host);
> +       if (rc)
> +               return rc;
> +
> +       ata_host_resume(host);
> +
> +       return 0;
> +}
> +#endif
>  #endif
>
>  static int mv_platform_probe(struct platform_device *pdev);
> --
> 1.6.0.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ide" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jeff Garzik - Dec. 17, 2009, 6:07 a.m.
On 12/06/2009 11:26 AM, Saeed Bishara wrote:
> Signed-off-by: Saeed Bishara<saeed@marvell.com>
> ---
>   drivers/ata/sata_mv.c |   29 +++++++++++++++++++++++++++++
>   1 files changed, 29 insertions(+), 0 deletions(-)

applied


--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 71ac62e..704d86f 100755
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -4161,6 +4161,9 @@  static struct platform_driver mv_platform_driver = {
 #ifdef CONFIG_PCI
 static int mv_pci_init_one(struct pci_dev *pdev,
 			   const struct pci_device_id *ent);
+#ifdef CONFIG_PM
+static int mv_pci_device_resume(struct pci_dev *pdev);
+#endif
 
 
 static struct pci_driver mv_pci_driver = {
@@ -4168,6 +4171,11 @@  static struct pci_driver mv_pci_driver = {
 	.id_table		= mv_pci_tbl,
 	.probe			= mv_pci_init_one,
 	.remove			= ata_pci_remove_one,
+#ifdef CONFIG_PM
+	.suspend		= ata_pci_device_suspend,
+	.resume			= mv_pci_device_resume,
+#endif
+
 };
 
 /* move to PCI layer or libata core? */
@@ -4324,6 +4332,27 @@  static int mv_pci_init_one(struct pci_dev *pdev,
 	return ata_host_activate(host, pdev->irq, mv_interrupt, IRQF_SHARED,
 				 IS_GEN_I(hpriv) ? &mv5_sht : &mv6_sht);
 }
+
+#ifdef CONFIG_PM
+static int mv_pci_device_resume(struct pci_dev *pdev)
+{
+	struct ata_host *host = dev_get_drvdata(&pdev->dev);
+	int rc;
+
+	rc = ata_pci_device_do_resume(pdev);
+	if (rc)
+		return rc;
+
+	/* initialize adapter */
+	rc = mv_init_host(host);
+	if (rc)
+		return rc;
+
+	ata_host_resume(host);
+
+	return 0;
+}
+#endif
 #endif
 
 static int mv_platform_probe(struct platform_device *pdev);