diff options
author | Tejun Heo <htejun@gmail.com> | 2006-12-26 05:39:50 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-02-09 17:39:30 -0500 |
commit | 553c4aa630af7bc885e056d0436e4eb7f238579b (patch) | |
tree | 5a6cf3b15e05309fcfbdb5f68471e2a20b235613 | |
parent | 8bfa79fcb81d2bdb043f60ab4171704467808b55 (diff) |
libata: handle pci_enable_device() failure while resuming
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>
-rw-r--r-- | drivers/ata/ahci.c | 4 | ||||
-rw-r--r-- | drivers/ata/libata-core.c | 22 | ||||
-rw-r--r-- | drivers/ata/sata_sil.c | 6 | ||||
-rw-r--r-- | drivers/ata/sata_sil24.c | 5 | ||||
-rw-r--r-- | include/linux/libata.h | 2 |
5 files changed, 30 insertions, 9 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index ca53d5a9c0c5..03b7a0051887 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -1397,7 +1397,9 @@ static int ahci_pci_device_resume(struct pci_dev *pdev) | |||
1397 | void __iomem *mmio = host->mmio_base; | 1397 | void __iomem *mmio = host->mmio_base; |
1398 | int rc; | 1398 | int rc; |
1399 | 1399 | ||
1400 | ata_pci_device_do_resume(pdev); | 1400 | rc = ata_pci_device_do_resume(pdev); |
1401 | if (rc) | ||
1402 | return rc; | ||
1401 | 1403 | ||
1402 | if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) { | 1404 | if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) { |
1403 | rc = ahci_reset_controller(mmio, pdev); | 1405 | rc = ahci_reset_controller(mmio, pdev); |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index a03019c40ac4..89f3cf57b677 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -6196,12 +6196,22 @@ void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg) | |||
6196 | } | 6196 | } |
6197 | } | 6197 | } |
6198 | 6198 | ||
6199 | void ata_pci_device_do_resume(struct pci_dev *pdev) | 6199 | int ata_pci_device_do_resume(struct pci_dev *pdev) |
6200 | { | 6200 | { |
6201 | int rc; | ||
6202 | |||
6201 | pci_set_power_state(pdev, PCI_D0); | 6203 | pci_set_power_state(pdev, PCI_D0); |
6202 | pci_restore_state(pdev); | 6204 | pci_restore_state(pdev); |
6203 | pci_enable_device(pdev); | 6205 | |
6206 | rc = pci_enable_device(pdev); | ||
6207 | if (rc) { | ||
6208 | dev_printk(KERN_ERR, &pdev->dev, | ||
6209 | "failed to enable device after resume (%d)\n", rc); | ||
6210 | return rc; | ||
6211 | } | ||
6212 | |||
6204 | pci_set_master(pdev); | 6213 | pci_set_master(pdev); |
6214 | return 0; | ||
6205 | } | 6215 | } |
6206 | 6216 | ||
6207 | int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg) | 6217 | 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) | |||
6221 | int ata_pci_device_resume(struct pci_dev *pdev) | 6231 | int ata_pci_device_resume(struct pci_dev *pdev) |
6222 | { | 6232 | { |
6223 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | 6233 | struct ata_host *host = dev_get_drvdata(&pdev->dev); |
6234 | int rc; | ||
6224 | 6235 | ||
6225 | ata_pci_device_do_resume(pdev); | 6236 | rc = ata_pci_device_do_resume(pdev); |
6226 | ata_host_resume(host); | 6237 | if (rc == 0) |
6227 | return 0; | 6238 | ata_host_resume(host); |
6239 | return rc; | ||
6228 | } | 6240 | } |
6229 | #endif /* CONFIG_PCI */ | 6241 | #endif /* CONFIG_PCI */ |
6230 | 6242 | ||
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c index d27ab312cdfb..1f3fdcf29876 100644 --- a/drivers/ata/sata_sil.c +++ b/drivers/ata/sata_sil.c | |||
@@ -710,8 +710,12 @@ err_out: | |||
710 | static int sil_pci_device_resume(struct pci_dev *pdev) | 710 | static int sil_pci_device_resume(struct pci_dev *pdev) |
711 | { | 711 | { |
712 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | 712 | struct ata_host *host = dev_get_drvdata(&pdev->dev); |
713 | int rc; | ||
714 | |||
715 | rc = ata_pci_device_do_resume(pdev); | ||
716 | if (rc) | ||
717 | return rc; | ||
713 | 718 | ||
714 | ata_pci_device_do_resume(pdev); | ||
715 | sil_init_controller(pdev, host->n_ports, host->ports[0]->flags, | 719 | sil_init_controller(pdev, host->n_ports, host->ports[0]->flags, |
716 | host->mmio_base); | 720 | host->mmio_base); |
717 | ata_host_resume(host); | 721 | ata_host_resume(host); |
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index 5aa288d2fb86..da982ed4bc47 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c | |||
@@ -1200,8 +1200,11 @@ static int sil24_pci_device_resume(struct pci_dev *pdev) | |||
1200 | { | 1200 | { |
1201 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | 1201 | struct ata_host *host = dev_get_drvdata(&pdev->dev); |
1202 | struct sil24_host_priv *hpriv = host->private_data; | 1202 | struct sil24_host_priv *hpriv = host->private_data; |
1203 | int rc; | ||
1203 | 1204 | ||
1204 | ata_pci_device_do_resume(pdev); | 1205 | rc = ata_pci_device_do_resume(pdev); |
1206 | if (rc) | ||
1207 | return rc; | ||
1205 | 1208 | ||
1206 | if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) | 1209 | if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) |
1207 | writel(HOST_CTRL_GLOBAL_RST, hpriv->host_base + HOST_CTRL); | 1210 | writel(HOST_CTRL_GLOBAL_RST, hpriv->host_base + HOST_CTRL); |
diff --git a/include/linux/libata.h b/include/linux/libata.h index dab4dc505ce7..a8ecaaad55ff 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -716,7 +716,7 @@ extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_i | |||
716 | unsigned int n_ports); | 716 | unsigned int n_ports); |
717 | extern void ata_pci_remove_one (struct pci_dev *pdev); | 717 | extern void ata_pci_remove_one (struct pci_dev *pdev); |
718 | extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg); | 718 | extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg); |
719 | extern void ata_pci_device_do_resume(struct pci_dev *pdev); | 719 | extern int __must_check ata_pci_device_do_resume(struct pci_dev *pdev); |
720 | extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); | 720 | extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); |
721 | extern int ata_pci_device_resume(struct pci_dev *pdev); | 721 | extern int ata_pci_device_resume(struct pci_dev *pdev); |
722 | extern int ata_pci_clear_simplex(struct pci_dev *pdev); | 722 | extern int ata_pci_clear_simplex(struct pci_dev *pdev); |