Skip to content

Commit

Permalink
[PATCH] PCI: Error handling on PCI device resume
Browse files Browse the repository at this point in the history
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 95a6296
* 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>
  • Loading branch information
Jean Delvare authored and gregkh committed Jun 11, 2006
1 parent 0ce0303 commit 8d92bc2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions drivers/pci/pci-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,9 @@ static int pci_device_suspend(struct device * dev, pm_message_t state)
* Default resume method for devices that have no driver provided resume,
* or not even a driver at all.
*/
static void pci_default_resume(struct pci_dev *pci_dev)
static int pci_default_resume(struct pci_dev *pci_dev)
{
int retval;
int retval = 0;

/* restore the PCI config space */
pci_restore_state(pci_dev);
Expand All @@ -297,18 +297,21 @@ static void pci_default_resume(struct pci_dev *pci_dev)
/* if the device was busmaster before the suspend, make it busmaster again */
if (pci_dev->is_busmaster)
pci_set_master(pci_dev);

return retval;
}

static int pci_device_resume(struct device * dev)
{
int error;
struct pci_dev * pci_dev = to_pci_dev(dev);
struct pci_driver * drv = pci_dev->driver;

if (drv && drv->resume)
drv->resume(pci_dev);
error = drv->resume(pci_dev);
else
pci_default_resume(pci_dev);
return 0;
error = pci_default_resume(pci_dev);
return error;
}

static void pci_device_shutdown(struct device *dev)
Expand Down

0 comments on commit 8d92bc2

Please sign in to comment.