Commit 00ba05a1 authored by Gavin Shan's avatar Gavin Shan Committed by Michael Ellerman

powerpc/pseries: Cleanup on pseries_eeh_get_state()

This cleans up pseries_eeh_get_state(), no functional changes:

   * Return EEH_STATE_NOT_SUPPORT early when the 2nd RTAS output
     argument is zero to avoid nested if statements.
   * Skip clearing bits in the PE state represented by variable
     "result" to simplify the code.
Signed-off-by: default avatarGavin Shan <gwshan@linux.vnet.ibm.com>
Reviewed-by: default avatarAndrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 872ee2d6
...@@ -433,29 +433,24 @@ static int pseries_eeh_get_state(struct eeh_pe *pe, int *state) ...@@ -433,29 +433,24 @@ static int pseries_eeh_get_state(struct eeh_pe *pe, int *state)
return ret; return ret;
/* Parse the result out */ /* Parse the result out */
result = 0; if (!rets[1])
if (rets[1]) { return EEH_STATE_NOT_SUPPORT;
switch(rets[0]) { switch(rets[0]) {
case 0: case 0:
result &= ~EEH_STATE_RESET_ACTIVE; result = EEH_STATE_MMIO_ACTIVE |
result |= EEH_STATE_MMIO_ACTIVE; EEH_STATE_DMA_ACTIVE;
result |= EEH_STATE_DMA_ACTIVE;
break; break;
case 1: case 1:
result |= EEH_STATE_RESET_ACTIVE; result = EEH_STATE_RESET_ACTIVE |
result |= EEH_STATE_MMIO_ACTIVE; EEH_STATE_MMIO_ACTIVE |
result |= EEH_STATE_DMA_ACTIVE; EEH_STATE_DMA_ACTIVE;
break; break;
case 2: case 2:
result &= ~EEH_STATE_RESET_ACTIVE; result = 0;
result &= ~EEH_STATE_MMIO_ACTIVE;
result &= ~EEH_STATE_DMA_ACTIVE;
break; break;
case 4: case 4:
result &= ~EEH_STATE_RESET_ACTIVE; result = EEH_STATE_MMIO_ENABLED;
result &= ~EEH_STATE_MMIO_ACTIVE;
result &= ~EEH_STATE_DMA_ACTIVE;
result |= EEH_STATE_MMIO_ENABLED;
break; break;
case 5: case 5:
if (rets[2]) { if (rets[2]) {
...@@ -468,9 +463,6 @@ static int pseries_eeh_get_state(struct eeh_pe *pe, int *state) ...@@ -468,9 +463,6 @@ static int pseries_eeh_get_state(struct eeh_pe *pe, int *state)
default: default:
result = EEH_STATE_NOT_SUPPORT; result = EEH_STATE_NOT_SUPPORT;
} }
} else {
result = EEH_STATE_NOT_SUPPORT;
}
return result; return result;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment