Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+26 −34
Original line number Diff line number Diff line
@@ -433,29 +433,24 @@ static int pseries_eeh_get_state(struct eeh_pe *pe, int *state)
		return ret;

	/* Parse the result out */
	result = 0;
	if (rets[1]) {
	if (!rets[1])
		return EEH_STATE_NOT_SUPPORT;

	switch(rets[0]) {
	case 0:
			result &= ~EEH_STATE_RESET_ACTIVE;
			result |= EEH_STATE_MMIO_ACTIVE;
			result |= EEH_STATE_DMA_ACTIVE;
		result = EEH_STATE_MMIO_ACTIVE |
			 EEH_STATE_DMA_ACTIVE;
		break;
	case 1:
			result |= EEH_STATE_RESET_ACTIVE;
			result |= EEH_STATE_MMIO_ACTIVE;
			result |= EEH_STATE_DMA_ACTIVE;
		result = EEH_STATE_RESET_ACTIVE |
			 EEH_STATE_MMIO_ACTIVE  |
			 EEH_STATE_DMA_ACTIVE;
		break;
	case 2:
			result &= ~EEH_STATE_RESET_ACTIVE;
			result &= ~EEH_STATE_MMIO_ACTIVE;
			result &= ~EEH_STATE_DMA_ACTIVE;
		result = 0;
		break;
	case 4:
			result &= ~EEH_STATE_RESET_ACTIVE;
			result &= ~EEH_STATE_MMIO_ACTIVE;
			result &= ~EEH_STATE_DMA_ACTIVE;
			result |= EEH_STATE_MMIO_ENABLED;
		result = EEH_STATE_MMIO_ENABLED;
		break;
	case 5:
		if (rets[2]) {
@@ -468,9 +463,6 @@ static int pseries_eeh_get_state(struct eeh_pe *pe, int *state)
	default:
		result = EEH_STATE_NOT_SUPPORT;
	}
	} else {
		result = EEH_STATE_NOT_SUPPORT;
	}

	return result;
}