PCI: make pci_restore_state return void
authorJon Mason <jon.mason@exar.com>
Tue, 30 Nov 2010 23:43:26 +0000 (17:43 -0600)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Thu, 23 Dec 2010 20:53:09 +0000 (12:53 -0800)
pci_restore_state only ever returns 0, thus there is no benefit in
having it return any value.  Also, a large majority of the callers do
not check the return code of pci_restore_state.  Make the
pci_restore_state a void return and avoid the overhead.

Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Jon Mason <jon.mason@exar.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
13 files changed:
drivers/media/video/cafe_ccic.c
drivers/net/myri10ge/myri10ge.c
drivers/net/sfc/falcon.c
drivers/net/skge.c
drivers/net/sky2.c
drivers/net/wireless/rt2x00/rt2x00pci.c
drivers/pci/pci-driver.c
drivers/pci/pci.c
drivers/scsi/ipr.c
drivers/scsi/pmcraid.c
drivers/staging/sm7xx/smtcfb.c
include/linux/pci.h
sound/pci/cs5535audio/cs5535audio_pm.c

index 0dfff50891e404056059eaf18316bd81fed0824f..737bb877e962b080cfaeb0a54bdc34c0c8038a29 100644 (file)
@@ -2186,9 +2186,7 @@ static int cafe_pci_resume(struct pci_dev *pdev)
        struct cafe_camera *cam = to_cam(v4l2_dev);
        int ret = 0;
 
-       ret = pci_restore_state(pdev);
-       if (ret)
-               return ret;
+       pci_restore_state(pdev);
        ret = pci_enable_device(pdev);
 
        if (ret) {
index 8524cc40ec57b8beb86b1bed83b5e7677487172c..d3c4a374a92e5ab03fa24c6c74f3027b0165f635 100644 (file)
@@ -3403,9 +3403,7 @@ static int myri10ge_resume(struct pci_dev *pdev)
                return -EIO;
        }
 
-       status = pci_restore_state(pdev);
-       if (status)
-               return status;
+       pci_restore_state(pdev);
 
        status = pci_enable_device(pdev);
        if (status) {
index 267019bb2b156815f269a9ae4429ceec6d4e2d7a..1763b9a7fd8eac52052edfb778623368476729c4 100644 (file)
@@ -1066,22 +1066,9 @@ static int falcon_reset_hw(struct efx_nic *efx, enum reset_type method)
 
        /* Restore PCI configuration if needed */
        if (method == RESET_TYPE_WORLD) {
-               if (efx_nic_is_dual_func(efx)) {
-                       rc = pci_restore_state(nic_data->pci_dev2);
-                       if (rc) {
-                               netif_err(efx, drv, efx->net_dev,
-                                         "failed to restore PCI config for "
-                                         "the secondary function\n");
-                               goto fail3;
-                       }
-               }
-               rc = pci_restore_state(efx->pci_dev);
-               if (rc) {
-                       netif_err(efx, drv, efx->net_dev,
-                                 "failed to restore PCI config for the "
-                                 "primary function\n");
-                       goto fail4;
-               }
+               if (efx_nic_is_dual_func(efx))
+                       pci_restore_state(nic_data->pci_dev2);
+               pci_restore_state(efx->pci_dev);
                netif_dbg(efx, drv, efx->net_dev,
                          "successfully restored PCI config\n");
        }
@@ -1092,7 +1079,7 @@ static int falcon_reset_hw(struct efx_nic *efx, enum reset_type method)
                rc = -ETIMEDOUT;
                netif_err(efx, hw, efx->net_dev,
                          "timed out waiting for hardware reset\n");
-               goto fail5;
+               goto fail3;
        }
        netif_dbg(efx, hw, efx->net_dev, "hardware reset complete\n");
 
@@ -1100,11 +1087,9 @@ static int falcon_reset_hw(struct efx_nic *efx, enum reset_type method)
 
        /* pci_save_state() and pci_restore_state() MUST be called in pairs */
 fail2:
-fail3:
        pci_restore_state(efx->pci_dev);
 fail1:
-fail4:
-fail5:
+fail3:
        return rc;
 }
 
index 220e0398f1d519130c63628b3e0461c45227fa7c..61553af38e65a68ba74fb5a66dbb608ed5430164 100644 (file)
@@ -4087,9 +4087,7 @@ static int skge_resume(struct pci_dev *pdev)
        if (err)
                goto out;
 
-       err = pci_restore_state(pdev);
-       if (err)
-               goto out;
+       pci_restore_state(pdev);
 
        err = skge_reset(hw);
        if (err)
index d6577084ce70b79690e79aea191ac2b36240cbfb..be3aee7827608e36c2780397f185c54319d0c40d 100644 (file)
@@ -4969,10 +4969,7 @@ static int sky2_resume(struct pci_dev *pdev)
        if (err)
                goto out;
 
-       err = pci_restore_state(pdev);
-       if (err)
-               goto out;
-
+       pci_restore_state(pdev);
        pci_enable_wake(pdev, PCI_D0, 0);
 
        /* Re-enable all clocks */
index 2449d785cf8d5b4d9b5260a0a2e4f79d0506fdd9..4fd4c33de6aee83762c522feacc7b54ccd6864d0 100644 (file)
@@ -356,12 +356,12 @@ int rt2x00pci_resume(struct pci_dev *pci_dev)
        struct rt2x00_dev *rt2x00dev = hw->priv;
 
        if (pci_set_power_state(pci_dev, PCI_D0) ||
-           pci_enable_device(pci_dev) ||
-           pci_restore_state(pci_dev)) {
+           pci_enable_device(pci_dev)) {
                ERROR(rt2x00dev, "Failed to resume device.\n");
                return -EIO;
        }
 
+       pci_restore_state(pci_dev);
        return rt2x00lib_resume(rt2x00dev);
 }
 EXPORT_SYMBOL_GPL(rt2x00pci_resume);
index 8a6f797de8e55af1b3d0380aefb2173b58ab9fa5..80e551ee640b5c57012793b5986de75f920476e5 100644 (file)
@@ -449,7 +449,8 @@ static int pci_restore_standard_config(struct pci_dev *pci_dev)
                        return error;
        }
 
-       return pci_restore_state(pci_dev);
+       pci_restore_state(pci_dev);
+       return 0;
 }
 
 static void pci_pm_default_resume_early(struct pci_dev *pci_dev)
index 710c8a29be0d5b8028eafb239bde42ae5d5934b6..6762dcae90ab7de29eba38ac5ab75b4b8963163d 100644 (file)
@@ -937,14 +937,13 @@ pci_save_state(struct pci_dev *dev)
  * pci_restore_state - Restore the saved state of a PCI device
  * @dev: - PCI device that we're dealing with
  */
-int 
-pci_restore_state(struct pci_dev *dev)
+void pci_restore_state(struct pci_dev *dev)
 {
        int i;
        u32 val;
 
        if (!dev->state_saved)
-               return 0;
+               return;
 
        /* PCI Express register must be restored first */
        pci_restore_pcie_state(dev);
@@ -968,8 +967,6 @@ pci_restore_state(struct pci_dev *dev)
        pci_restore_iov_state(dev);
 
        dev->state_saved = false;
-
-       return 0;
 }
 
 static int do_pci_enable_device(struct pci_dev *dev, int bars)
index 5bbaee597e8857cbb2c09e66f06a278f2fb46353..524d586c3147fcaeb4fbdb85ff5956b307a9c1e9 100644 (file)
@@ -7487,16 +7487,10 @@ static int ipr_reset_restore_cfg_space(struct ipr_cmnd *ipr_cmd)
 {
        struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
        volatile u32 int_reg;
-       int rc;
 
        ENTER;
        ioa_cfg->pdev->state_saved = true;
-       rc = pci_restore_state(ioa_cfg->pdev);
-
-       if (rc != PCIBIOS_SUCCESSFUL) {
-               ipr_cmd->s.ioasa.hdr.ioasc = cpu_to_be32(IPR_IOASC_PCI_ACCESS_ERROR);
-               return IPR_RC_JOB_CONTINUE;
-       }
+       pci_restore_state(ioa_cfg->pdev);
 
        if (ipr_set_pcix_cmd_reg(ioa_cfg)) {
                ipr_cmd->s.ioasa.hdr.ioasc = cpu_to_be32(IPR_IOASC_PCI_ACCESS_ERROR);
index 300d59f389da76175ac4720fc2d9a69b0a16b163..321cf3ae863084d5f655f1dbe410fbca4c9ce75c 100644 (file)
@@ -2228,12 +2228,7 @@ static void pmcraid_ioa_reset(struct pmcraid_cmd *cmd)
                /* Once either bist or pci reset is done, restore PCI config
                 * space. If this fails, proceed with hard reset again
                 */
-               if (pci_restore_state(pinstance->pdev)) {
-                       pmcraid_info("config-space error resetting again\n");
-                       pinstance->ioa_state = IOA_STATE_IN_RESET_ALERT;
-                       pmcraid_reset_alert(cmd);
-                       break;
-               }
+               pci_restore_state(pinstance->pdev);
 
                /* fail all pending commands */
                pmcraid_fail_outstanding_cmds(pinstance);
index 24f47d6388f4076d9e99d02ef5c69f09750a4ce3..7162dee3b0d89357d7f04c4da57831644ff8b8ae 100644 (file)
@@ -1071,7 +1071,7 @@ static int __maybe_unused smtcfb_resume(struct pci_dev *pdev)
        /* when resuming, restore pci data and fb cursor */
        if (pdev->dev.power.power_state.event != PM_EVENT_FREEZE) {
                retv = pci_set_power_state(pdev, PCI_D0);
-               retv = pci_restore_state(pdev);
+               pci_restore_state(pdev);
                if (pci_enable_device(pdev))
                        return -1;
                pci_set_master(pdev);
index 7454408c41b6fb57cf6f29913cb5be32374b377f..63cbadce337e315dca870101cdc55e84b76fbb98 100644 (file)
@@ -806,7 +806,7 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size);
 
 /* Power management related routines */
 int pci_save_state(struct pci_dev *dev);
-int pci_restore_state(struct pci_dev *dev);
+void pci_restore_state(struct pci_dev *dev);
 int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state);
 int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
 pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
@@ -1168,10 +1168,8 @@ static inline int pci_save_state(struct pci_dev *dev)
        return 0;
 }
 
-static inline int pci_restore_state(struct pci_dev *dev)
-{
-       return 0;
-}
+static inline void pci_restore_state(struct pci_dev *dev)
+{ }
 
 static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
 {
index a3301cc4ab822e640a30d80dee10e9222adb66a3..185b00088320415191dafec55a5611dd3eaa5bb5 100644 (file)
@@ -90,12 +90,7 @@ int snd_cs5535audio_resume(struct pci_dev *pci)
        int i;
 
        pci_set_power_state(pci, PCI_D0);
-       if (pci_restore_state(pci) < 0) {
-               printk(KERN_ERR "cs5535audio: pci_restore_state failed, "
-                      "disabling device\n");
-               snd_card_disconnect(card);
-               return -EIO;
-       }
+       pci_restore_state(pci);
        if (pci_enable_device(pci) < 0) {
                printk(KERN_ERR "cs5535audio: pci_enable_device failed, "
                       "disabling device\n");