diff options
author | Jean Delvare <khali@linux-fr.org> | 2006-04-18 08:49:56 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-06-11 17:02:27 -0400 |
commit | 8d92bc2270d67a43b1d7e94a8cb6f81f1435fe9a (patch) | |
tree | 62e1d36d17e7b20bf6530104059807242c91f96a | |
parent | 0ce030395b92270567423d57d9d432eb77df32f2 (diff) |
[PATCH] PCI: Error handling on PCI device resume
We currently don't handle errors properly when resuming a PCI device:
* In pci_default_resume() we capture the error code returned by
pci_enable_device() but don't pass it up to the caller.
Introduced by commit 95a629657dbe28e44a312c47815b3dc3f1ce0970
* In pci_resume_device(), the errors possibly returned by the driver's
.resume method or by the generic pci_default_resume() function are
ignored.
This patch fixes both issues.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/pci/pci-driver.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 1456759936c5..10e1a905c144 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -285,9 +285,9 @@ static int pci_device_suspend(struct device * dev, pm_message_t state) | |||
285 | * Default resume method for devices that have no driver provided resume, | 285 | * Default resume method for devices that have no driver provided resume, |
286 | * or not even a driver at all. | 286 | * or not even a driver at all. |
287 | */ | 287 | */ |
288 | static void pci_default_resume(struct pci_dev *pci_dev) | 288 | static int pci_default_resume(struct pci_dev *pci_dev) |
289 | { | 289 | { |
290 | int retval; | 290 | int retval = 0; |
291 | 291 | ||
292 | /* restore the PCI config space */ | 292 | /* restore the PCI config space */ |
293 | pci_restore_state(pci_dev); | 293 | pci_restore_state(pci_dev); |
@@ -297,18 +297,21 @@ static void pci_default_resume(struct pci_dev *pci_dev) | |||
297 | /* if the device was busmaster before the suspend, make it busmaster again */ | 297 | /* if the device was busmaster before the suspend, make it busmaster again */ |
298 | if (pci_dev->is_busmaster) | 298 | if (pci_dev->is_busmaster) |
299 | pci_set_master(pci_dev); | 299 | pci_set_master(pci_dev); |
300 | |||
301 | return retval; | ||
300 | } | 302 | } |
301 | 303 | ||
302 | static int pci_device_resume(struct device * dev) | 304 | static int pci_device_resume(struct device * dev) |
303 | { | 305 | { |
306 | int error; | ||
304 | struct pci_dev * pci_dev = to_pci_dev(dev); | 307 | struct pci_dev * pci_dev = to_pci_dev(dev); |
305 | struct pci_driver * drv = pci_dev->driver; | 308 | struct pci_driver * drv = pci_dev->driver; |
306 | 309 | ||
307 | if (drv && drv->resume) | 310 | if (drv && drv->resume) |
308 | drv->resume(pci_dev); | 311 | error = drv->resume(pci_dev); |
309 | else | 312 | else |
310 | pci_default_resume(pci_dev); | 313 | error = pci_default_resume(pci_dev); |
311 | return 0; | 314 | return error; |
312 | } | 315 | } |
313 | 316 | ||
314 | static void pci_device_shutdown(struct device *dev) | 317 | static void pci_device_shutdown(struct device *dev) |