提交 1d3c16a8 编写于 作者: J Jon Mason 提交者: Jesse Barnes

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: NMauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: NJon Mason <jon.mason@exar.com>
Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
上级 2f671e2d
......@@ -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) {
......
......@@ -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) {
......
......@@ -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;
}
......
......@@ -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)
......
......@@ -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 */
......
......@@ -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);
......
......@@ -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)
......
......@@ -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)
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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)
{
......
......@@ -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");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册