Skip to content

Commit

Permalink
ODROID C1/C2: Optimize I2C check code
Browse files Browse the repository at this point in the history
Change-Id: I13d4273b8eeee055bde280cd1a25ba6e82b38f28
  • Loading branch information
joshua-yang committed Sep 4, 2018
1 parent eb609f8 commit 175d1f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions wiringPi/odroidc1.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,12 @@ static int getModeToGpio (int mode, int pin)
}

/* To check I2C module loaded */
if (moduleLoaded(AML_MODULE_I2C) && (retPin == 74 || retPin == 75))
return -1;
else
return retPin;
if (retPin == 74 || retPin == 75) {
if (moduleLoaded(AML_MODULE_I2C))
return -1;
}

return retPin;
}

/*----------------------------------------------------------------------------*/
Expand Down
10 changes: 6 additions & 4 deletions wiringPi/odroidc2.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,12 @@ static int getModeToGpio (int mode, int pin)
}

/* To check I2C module loaded */
if (moduleLoaded(AML_MODULE_I2C) && (retPin == 205 || retPin == 206))
return -1;
else
return retPin;
if (retPin == 205 || retPin == 206) {
if (moduleLoaded(AML_MODULE_I2C))
return -1;
}

return retPin;
}

/*----------------------------------------------------------------------------*/
Expand Down

0 comments on commit 175d1f6

Please sign in to comment.