aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJon Mason <jon.mason@exar.com>2010-11-30 18:43:26 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2010-12-23 15:53:09 -0500
commit1d3c16a818e992c199844954d95c17fd7ce6cbba (patch)
tree6f54b4153b8f7e54bdb5a8abc3ceffa7b4eec0e2 /drivers
parent2f671e2dbff6eb5ef4e2600adbec550c13b8fe72 (diff)
PCI: make pci_restore_state return void
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/cafe_ccic.c4
-rw-r--r--drivers/net/myri10ge/myri10ge.c4
-rw-r--r--drivers/net/sfc/falcon.c25
-rw-r--r--drivers/net/skge.c4
-rw-r--r--drivers/net/sky2.c5
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00pci.c4
-rw-r--r--drivers/pci/pci-driver.c3
-rw-r--r--drivers/pci/pci.c7
-rw-r--r--drivers/scsi/ipr.c8
-rw-r--r--drivers/scsi/pmcraid.c7
-rw-r--r--drivers/staging/sm7xx/smtcfb.c2
11 files changed, 18 insertions, 55 deletions
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c
index 0dfff50891e4..737bb877e962 100644
--- a/drivers/media/video/cafe_ccic.c
+++ b/drivers/media/video/cafe_ccic.c
@@ -2186,9 +2186,7 @@ static int cafe_pci_resume(struct pci_dev *pdev)
2186 struct cafe_camera *cam = to_cam(v4l2_dev); 2186 struct cafe_camera *cam = to_cam(v4l2_dev);
2187 int ret = 0; 2187 int ret = 0;
2188 2188
2189 ret = pci_restore_state(pdev); 2189 pci_restore_state(pdev);
2190 if (ret)
2191 return ret;
2192 ret = pci_enable_device(pdev); 2190 ret = pci_enable_device(pdev);
2193 2191
2194 if (ret) { 2192 if (ret) {
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 8524cc40ec57..d3c4a374a92e 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -3403,9 +3403,7 @@ static int myri10ge_resume(struct pci_dev *pdev)
3403 return -EIO; 3403 return -EIO;
3404 } 3404 }
3405 3405
3406 status = pci_restore_state(pdev); 3406 pci_restore_state(pdev);
3407 if (status)
3408 return status;
3409 3407
3410 status = pci_enable_device(pdev); 3408 status = pci_enable_device(pdev);
3411 if (status) { 3409 if (status) {
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
index 267019bb2b15..1763b9a7fd8e 100644
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -1066,22 +1066,9 @@ static int falcon_reset_hw(struct efx_nic *efx, enum reset_type method)
1066 1066
1067 /* Restore PCI configuration if needed */ 1067 /* Restore PCI configuration if needed */
1068 if (method == RESET_TYPE_WORLD) { 1068 if (method == RESET_TYPE_WORLD) {
1069 if (efx_nic_is_dual_func(efx)) { 1069 if (efx_nic_is_dual_func(efx))
1070 rc = pci_restore_state(nic_data->pci_dev2); 1070 pci_restore_state(nic_data->pci_dev2);
1071 if (rc) { 1071 pci_restore_state(efx->pci_dev);
1072 netif_err(efx, drv, efx->net_dev,
1073 "failed to restore PCI config for "
1074 "the secondary function\n");
1075 goto fail3;
1076 }
1077 }
1078 rc = pci_restore_state(efx->pci_dev);
1079 if (rc) {
1080 netif_err(efx, drv, efx->net_dev,
1081 "failed to restore PCI config for the "
1082 "primary function\n");
1083 goto fail4;
1084 }
1085 netif_dbg(efx, drv, efx->net_dev, 1072 netif_dbg(efx, drv, efx->net_dev,
1086 "successfully restored PCI config\n"); 1073 "successfully restored PCI config\n");
1087 } 1074 }
@@ -1092,7 +1079,7 @@ static int falcon_reset_hw(struct efx_nic *efx, enum reset_type method)
1092 rc = -ETIMEDOUT; 1079 rc = -ETIMEDOUT;
1093 netif_err(efx, hw, efx->net_dev, 1080 netif_err(efx, hw, efx->net_dev,
1094 "timed out waiting for hardware reset\n"); 1081 "timed out waiting for hardware reset\n");
1095 goto fail5; 1082 goto fail3;
1096 } 1083 }
1097 netif_dbg(efx, hw, efx->net_dev, "hardware reset complete\n"); 1084 netif_dbg(efx, hw, efx->net_dev, "hardware reset complete\n");
1098 1085
@@ -1100,11 +1087,9 @@ static int falcon_reset_hw(struct efx_nic *efx, enum reset_type method)
1100 1087
1101 /* pci_save_state() and pci_restore_state() MUST be called in pairs */ 1088 /* pci_save_state() and pci_restore_state() MUST be called in pairs */
1102fail2: 1089fail2:
1103fail3:
1104 pci_restore_state(efx->pci_dev); 1090 pci_restore_state(efx->pci_dev);
1105fail1: 1091fail1:
1106fail4: 1092fail3:
1107fail5:
1108 return rc; 1093 return rc;
1109} 1094}
1110 1095
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 220e0398f1d5..61553af38e65 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -4087,9 +4087,7 @@ static int skge_resume(struct pci_dev *pdev)
4087 if (err) 4087 if (err)
4088 goto out; 4088 goto out;
4089 4089
4090 err = pci_restore_state(pdev); 4090 pci_restore_state(pdev);
4091 if (err)
4092 goto out;
4093 4091
4094 err = skge_reset(hw); 4092 err = skge_reset(hw);
4095 if (err) 4093 if (err)
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index d6577084ce70..be3aee782760 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -4969,10 +4969,7 @@ static int sky2_resume(struct pci_dev *pdev)
4969 if (err) 4969 if (err)
4970 goto out; 4970 goto out;
4971 4971
4972 err = pci_restore_state(pdev); 4972 pci_restore_state(pdev);
4973 if (err)
4974 goto out;
4975
4976 pci_enable_wake(pdev, PCI_D0, 0); 4973 pci_enable_wake(pdev, PCI_D0, 0);
4977 4974
4978 /* Re-enable all clocks */ 4975 /* Re-enable all clocks */
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
index 2449d785cf8d..4fd4c33de6ae 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -356,12 +356,12 @@ int rt2x00pci_resume(struct pci_dev *pci_dev)
356 struct rt2x00_dev *rt2x00dev = hw->priv; 356 struct rt2x00_dev *rt2x00dev = hw->priv;
357 357
358 if (pci_set_power_state(pci_dev, PCI_D0) || 358 if (pci_set_power_state(pci_dev, PCI_D0) ||
359 pci_enable_device(pci_dev) || 359 pci_enable_device(pci_dev)) {
360 pci_restore_state(pci_dev)) {
361 ERROR(rt2x00dev, "Failed to resume device.\n"); 360 ERROR(rt2x00dev, "Failed to resume device.\n");
362 return -EIO; 361 return -EIO;
363 } 362 }
364 363
364 pci_restore_state(pci_dev);
365 return rt2x00lib_resume(rt2x00dev); 365 return rt2x00lib_resume(rt2x00dev);
366} 366}
367EXPORT_SYMBOL_GPL(rt2x00pci_resume); 367EXPORT_SYMBOL_GPL(rt2x00pci_resume);
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 8a6f797de8e5..80e551ee640b 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -449,7 +449,8 @@ static int pci_restore_standard_config(struct pci_dev *pci_dev)
449 return error; 449 return error;
450 } 450 }
451 451
452 return pci_restore_state(pci_dev); 452 pci_restore_state(pci_dev);
453 return 0;
453} 454}
454 455
455static void pci_pm_default_resume_early(struct pci_dev *pci_dev) 456static void pci_pm_default_resume_early(struct pci_dev *pci_dev)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 710c8a29be0d..6762dcae90ab 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -937,14 +937,13 @@ pci_save_state(struct pci_dev *dev)
937 * pci_restore_state - Restore the saved state of a PCI device 937 * pci_restore_state - Restore the saved state of a PCI device
938 * @dev: - PCI device that we're dealing with 938 * @dev: - PCI device that we're dealing with
939 */ 939 */
940int 940void pci_restore_state(struct pci_dev *dev)
941pci_restore_state(struct pci_dev *dev)
942{ 941{
943 int i; 942 int i;
944 u32 val; 943 u32 val;
945 944
946 if (!dev->state_saved) 945 if (!dev->state_saved)
947 return 0; 946 return;
948 947
949 /* PCI Express register must be restored first */ 948 /* PCI Express register must be restored first */
950 pci_restore_pcie_state(dev); 949 pci_restore_pcie_state(dev);
@@ -968,8 +967,6 @@ pci_restore_state(struct pci_dev *dev)
968 pci_restore_iov_state(dev); 967 pci_restore_iov_state(dev);
969 968
970 dev->state_saved = false; 969 dev->state_saved = false;
971
972 return 0;
973} 970}
974 971
975static int do_pci_enable_device(struct pci_dev *dev, int bars) 972static int do_pci_enable_device(struct pci_dev *dev, int bars)
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 5bbaee597e88..524d586c3147 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -7487,16 +7487,10 @@ static int ipr_reset_restore_cfg_space(struct ipr_cmnd *ipr_cmd)
7487{ 7487{
7488 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; 7488 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
7489 volatile u32 int_reg; 7489 volatile u32 int_reg;
7490 int rc;
7491 7490
7492 ENTER; 7491 ENTER;
7493 ioa_cfg->pdev->state_saved = true; 7492 ioa_cfg->pdev->state_saved = true;
7494 rc = pci_restore_state(ioa_cfg->pdev); 7493 pci_restore_state(ioa_cfg->pdev);
7495
7496 if (rc != PCIBIOS_SUCCESSFUL) {
7497 ipr_cmd->s.ioasa.hdr.ioasc = cpu_to_be32(IPR_IOASC_PCI_ACCESS_ERROR);
7498 return IPR_RC_JOB_CONTINUE;
7499 }
7500 7494
7501 if (ipr_set_pcix_cmd_reg(ioa_cfg)) { 7495 if (ipr_set_pcix_cmd_reg(ioa_cfg)) {
7502 ipr_cmd->s.ioasa.hdr.ioasc = cpu_to_be32(IPR_IOASC_PCI_ACCESS_ERROR); 7496 ipr_cmd->s.ioasa.hdr.ioasc = cpu_to_be32(IPR_IOASC_PCI_ACCESS_ERROR);
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 300d59f389da..321cf3ae8630 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -2228,12 +2228,7 @@ static void pmcraid_ioa_reset(struct pmcraid_cmd *cmd)
2228 /* Once either bist or pci reset is done, restore PCI config 2228 /* Once either bist or pci reset is done, restore PCI config
2229 * space. If this fails, proceed with hard reset again 2229 * space. If this fails, proceed with hard reset again
2230 */ 2230 */
2231 if (pci_restore_state(pinstance->pdev)) { 2231 pci_restore_state(pinstance->pdev);
2232 pmcraid_info("config-space error resetting again\n");
2233 pinstance->ioa_state = IOA_STATE_IN_RESET_ALERT;
2234 pmcraid_reset_alert(cmd);
2235 break;
2236 }
2237 2232
2238 /* fail all pending commands */ 2233 /* fail all pending commands */
2239 pmcraid_fail_outstanding_cmds(pinstance); 2234 pmcraid_fail_outstanding_cmds(pinstance);
diff --git a/drivers/staging/sm7xx/smtcfb.c b/drivers/staging/sm7xx/smtcfb.c
index 24f47d6388f4..7162dee3b0d8 100644
--- a/drivers/staging/sm7xx/smtcfb.c
+++ b/drivers/staging/sm7xx/smtcfb.c
@@ -1071,7 +1071,7 @@ static int __maybe_unused smtcfb_resume(struct pci_dev *pdev)
1071 /* when resuming, restore pci data and fb cursor */ 1071 /* when resuming, restore pci data and fb cursor */
1072 if (pdev->dev.power.power_state.event != PM_EVENT_FREEZE) { 1072 if (pdev->dev.power.power_state.event != PM_EVENT_FREEZE) {
1073 retv = pci_set_power_state(pdev, PCI_D0); 1073 retv = pci_set_power_state(pdev, PCI_D0);
1074 retv = pci_restore_state(pdev); 1074 pci_restore_state(pdev);
1075 if (pci_enable_device(pdev)) 1075 if (pci_enable_device(pdev))
1076 return -1; 1076 return -1;
1077 pci_set_master(pdev); 1077 pci_set_master(pdev);