提交 b85743ee 编写于 作者: G Gavin Shan 提交者: Benjamin Herrenschmidt

powerpc/eeh: Refactor eeh_reset_pe()

The patch refactors eeh_reset_pe() in order for:

   * Varied return values for different failure cases.
   * Replace pr_err() with pr_warn() and print function name.
   * Coding style cleanup.
Signed-off-by: NGavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
上级 35891d40
...@@ -758,30 +758,37 @@ static void eeh_reset_pe_once(struct eeh_pe *pe) ...@@ -758,30 +758,37 @@ static void eeh_reset_pe_once(struct eeh_pe *pe)
int eeh_reset_pe(struct eeh_pe *pe) int eeh_reset_pe(struct eeh_pe *pe)
{ {
int flags = (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE); int flags = (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE);
int i, rc; int i, state, ret;
/* Take three shots at resetting the bus */ /* Take three shots at resetting the bus */
for (i=0; i<3; i++) { for (i = 0; i < 3; i++) {
eeh_reset_pe_once(pe); eeh_reset_pe_once(pe);
/* /*
* EEH_PE_ISOLATED is expected to be removed after * EEH_PE_ISOLATED is expected to be removed after
* BAR restore. * BAR restore.
*/ */
rc = eeh_ops->wait_state(pe, PCI_BUS_RESET_WAIT_MSEC); state = eeh_ops->wait_state(pe, PCI_BUS_RESET_WAIT_MSEC);
if ((rc & flags) == flags) if ((state & flags) == flags) {
return 0; ret = 0;
goto out;
}
if (rc < 0) { if (state < 0) {
pr_err("%s: Unrecoverable slot failure on PHB#%d-PE#%x", pr_warn("%s: Unrecoverable slot failure on PHB#%d-PE#%x",
__func__, pe->phb->global_number, pe->addr); __func__, pe->phb->global_number, pe->addr);
return -1; ret = -ENOTRECOVERABLE;
goto out;
} }
pr_err("EEH: bus reset %d failed on PHB#%d-PE#%x, rc=%d\n",
i+1, pe->phb->global_number, pe->addr, rc); /* We might run out of credits */
ret = -EIO;
pr_warn("%s: Failure %d resetting PHB#%x-PE#%x\n (%d)\n",
__func__, state, pe->phb->global_number, pe->addr, (i + 1));
} }
return -1; out:
return ret;
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册