]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
libata: handle pci_enable_device() failure while resuming
authorTejun Heo <htejun@gmail.com>
Tue, 26 Dec 2006 10:39:50 +0000 (19:39 +0900)
committerJeff Garzik <jeff@garzik.org>
Fri, 9 Feb 2007 22:39:30 +0000 (17:39 -0500)
Handle pci_enable_device() failure while resuming.  This patch kills
the "ignoring return value of 'pci_enable_device'" warning message and
propagates __must_check through ata_pci_device_do_resume().

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/ata/ahci.c
drivers/ata/libata-core.c
drivers/ata/sata_sil.c
drivers/ata/sata_sil24.c
include/linux/libata.h

index ca53d5a9c0c571022097b6fdcea886b007e19f99..03b7a0051887cc8a668132ea2ba5c37d6561a9c6 100644 (file)
@@ -1397,7 +1397,9 @@ static int ahci_pci_device_resume(struct pci_dev *pdev)
        void __iomem *mmio = host->mmio_base;
        int rc;
 
-       ata_pci_device_do_resume(pdev);
+       rc = ata_pci_device_do_resume(pdev);
+       if (rc)
+               return rc;
 
        if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) {
                rc = ahci_reset_controller(mmio, pdev);
index a03019c40ac470e8fa53230462b63ec79c735503..89f3cf57b677ecc88778217c64a8712e67f6761f 100644 (file)
@@ -6196,12 +6196,22 @@ void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg)
        }
 }
 
-void ata_pci_device_do_resume(struct pci_dev *pdev)
+int ata_pci_device_do_resume(struct pci_dev *pdev)
 {
+       int rc;
+
        pci_set_power_state(pdev, PCI_D0);
        pci_restore_state(pdev);
-       pci_enable_device(pdev);
+
+       rc = pci_enable_device(pdev);
+       if (rc) {
+               dev_printk(KERN_ERR, &pdev->dev,
+                          "failed to enable device after resume (%d)\n", rc);
+               return rc;
+       }
+
        pci_set_master(pdev);
+       return 0;
 }
 
 int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
@@ -6221,10 +6231,12 @@ int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
 int ata_pci_device_resume(struct pci_dev *pdev)
 {
        struct ata_host *host = dev_get_drvdata(&pdev->dev);
+       int rc;
 
-       ata_pci_device_do_resume(pdev);
-       ata_host_resume(host);
-       return 0;
+       rc = ata_pci_device_do_resume(pdev);
+       if (rc == 0)
+               ata_host_resume(host);
+       return rc;
 }
 #endif /* CONFIG_PCI */
 
index d27ab312cdfb33a220e4e1a52103ab80ca7c4112..1f3fdcf29876bb6936924e67ec21d240a7bdcd55 100644 (file)
@@ -710,8 +710,12 @@ err_out:
 static int sil_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;
 
-       ata_pci_device_do_resume(pdev);
        sil_init_controller(pdev, host->n_ports, host->ports[0]->flags,
                            host->mmio_base);
        ata_host_resume(host);
index 5aa288d2fb867fb2130a0ced4b599cb61f0afeaa..da982ed4bc47c45adac1fa08ed52b12170b55f76 100644 (file)
@@ -1200,8 +1200,11 @@ static int sil24_pci_device_resume(struct pci_dev *pdev)
 {
        struct ata_host *host = dev_get_drvdata(&pdev->dev);
        struct sil24_host_priv *hpriv = host->private_data;
+       int rc;
 
-       ata_pci_device_do_resume(pdev);
+       rc = ata_pci_device_do_resume(pdev);
+       if (rc)
+               return rc;
 
        if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND)
                writel(HOST_CTRL_GLOBAL_RST, hpriv->host_base + HOST_CTRL);
index dab4dc505ce751196b071c94e6f6e574f606d1a8..a8ecaaad55fffdeeb47ef989e2e9e3fefbb79634 100644 (file)
@@ -716,7 +716,7 @@ extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_i
                             unsigned int n_ports);
 extern void ata_pci_remove_one (struct pci_dev *pdev);
 extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg);
-extern void ata_pci_device_do_resume(struct pci_dev *pdev);
+extern int __must_check ata_pci_device_do_resume(struct pci_dev *pdev);
 extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
 extern int ata_pci_device_resume(struct pci_dev *pdev);
 extern int ata_pci_clear_simplex(struct pci_dev *pdev);