tree 0e48656b5d61e26078a50af9f6766e52934fbedf
parent 085ae41f66657a9655ce832b0a61832a06f0e1dc
author Greg Kroah-Hartman <[EMAIL PROTECTED]> Fri, 29 Jul 2005 01:37:33 -0700
committer Greg Kroah-Hartman <[EMAIL PROTECTED]> Fri, 09 Sep 2005 04:57:25 -0700

[PATCH] PCI: start paying attention to a lot of pci function return values

Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

 drivers/pci/bus.c              |    3 ++-
 drivers/pci/pci-driver.c       |    6 ++++--
 drivers/pci/pci.c              |    7 +++++--
 drivers/pci/pcie/portdrv_pci.c |    8 ++++++--
 drivers/usb/core/hcd-pci.c     |   24 +++++++++++++++++++-----
 drivers/usb/host/ehci-hcd.c    |    4 +++-
 6 files changed, 39 insertions(+), 13 deletions(-)

diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -140,10 +140,11 @@ void __devinit pci_bus_add_devices(struc
 void pci_enable_bridges(struct pci_bus *bus)
 {
        struct pci_dev *dev;
+       int retval;
 
        list_for_each_entry(dev, &bus->devices, bus_list) {
                if (dev->subordinate) {
-                       pci_enable_device(dev);
+                       retval = pci_enable_device(dev);
                        pci_set_master(dev);
                        pci_enable_bridges(dev->subordinate);
                }
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -272,17 +272,19 @@ static int pci_device_suspend(struct dev
 }
 
 
-/* 
+/*
  * 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)
 {
+       int retval;
+
        /* restore the PCI config space */
        pci_restore_state(pci_dev);
        /* if the device was enabled before suspend, reenable */
        if (pci_dev->is_enabled)
-               pci_enable_device(pci_dev);
+               retval = pci_enable_device(pci_dev);
        /* if the device was busmaster before the suspend, make it busmaster 
again */
        if (pci_dev->is_busmaster)
                pci_set_master(pci_dev);
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -444,8 +444,11 @@ pci_enable_device_bars(struct pci_dev *d
 {
        int err;
 
-       pci_set_power_state(dev, PCI_D0);
-       if ((err = pcibios_enable_device(dev, bars)) < 0)
+       err = pci_set_power_state(dev, PCI_D0);
+       if (err)
+               return err;
+       err = pcibios_enable_device(dev, bars);
+       if (err < 0)
                return err;
        return 0;
 }
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
--- a/drivers/pci/pcie/portdrv_pci.c
+++ b/drivers/pci/pcie/portdrv_pci.c
@@ -90,15 +90,19 @@ static void pcie_portdrv_save_config(str
                pci_save_msi_state(dev);
 }
 
-static void pcie_portdrv_restore_config(struct pci_dev *dev)
+static int pcie_portdrv_restore_config(struct pci_dev *dev)
 {
        struct pcie_port_device_ext *p_ext = pci_get_drvdata(dev);
+       int retval;
 
        pci_restore_state(dev);
        if (p_ext->interrupt_mode == PCIE_PORT_MSI_MODE)
                pci_restore_msi_state(dev);
-       pci_enable_device(dev);
+       retval = pci_enable_device(dev);
+       if (retval)
+               return retval;
        pci_set_master(dev);
+       return 0;
 }
 
 /*
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -260,8 +260,10 @@ int usb_hcd_pci_suspend (struct pci_dev 
                retval = pci_set_power_state (dev, PCI_D3hot);
                if (retval == 0) {
                        dev_dbg (hcd->self.controller, "--> PCI D3\n");
-                       pci_enable_wake (dev, PCI_D3hot, hcd->remote_wakeup);
-                       pci_enable_wake (dev, PCI_D3cold, hcd->remote_wakeup);
+                       retval = pci_enable_wake (dev, PCI_D3hot, 
hcd->remote_wakeup);
+                       if (retval)
+                               break;
+                       retval = pci_enable_wake (dev, PCI_D3cold, 
hcd->remote_wakeup);
                } else if (retval < 0) {
                        dev_dbg (&dev->dev, "PCI D3 suspend fail, %d\n",
                                        retval);
@@ -335,8 +337,20 @@ int usb_hcd_pci_resume (struct pci_dev *
                                dev->current_state);
                }
 #endif
-               pci_enable_wake (dev, dev->current_state, 0);
-               pci_enable_wake (dev, PCI_D3cold, 0);
+               retval = pci_enable_wake (dev, dev->current_state, 0);
+               if (retval) {
+                       dev_err(hcd->self.controller,
+                               "can't enable_wake to %d, %d!\n",
+                               dev->current_state, retval);
+                       return retval;
+               }
+               retval = pci_enable_wake (dev, PCI_D3cold, 0);
+               if (retval) {
+                       dev_err(hcd->self.controller,
+                               "can't enable_wake to %d, %d!\n",
+                               PCI_D3cold, retval);
+                       return retval;
+               }
        } else {
                /* Same basic cases: clean (powered/not), dirty */
                dev_dbg(hcd->self.controller, "PCI legacy resume\n");
@@ -376,7 +390,7 @@ int usb_hcd_pci_resume (struct pci_dev *
                usb_hc_died (hcd);
        }
 
-       pci_enable_device(dev);
+       retval = pci_enable_device(dev);
        return retval;
 }
 EXPORT_SYMBOL (usb_hcd_pci_resume);
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -549,7 +549,9 @@ static int ehci_start (struct usb_hcd *h
                hcd->can_wakeup = (port_wake & 1) != 0;
 
                /* help hc dma work well with cachelines */
-               pci_set_mwi (pdev);
+               retval = pci_set_mwi(pdev);
+               if (retval)
+                       ehci_dbg(ehci, "unable to enable MWI - not fatal.\n");
        }
 #endif
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to