Skip to content

Commit 175d1f6

Browse files
committed
ODROID C1/C2: Optimize I2C check code
Change-Id: I13d4273b8eeee055bde280cd1a25ba6e82b38f28
1 parent eb609f8 commit 175d1f6

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

wiringPi/odroidc1.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,12 @@ static int getModeToGpio (int mode, int pin)
247247
}
248248

249249
/* To check I2C module loaded */
250-
if (moduleLoaded(AML_MODULE_I2C) && (retPin == 74 || retPin == 75))
251-
return -1;
252-
else
253-
return retPin;
250+
if (retPin == 74 || retPin == 75) {
251+
if (moduleLoaded(AML_MODULE_I2C))
252+
return -1;
253+
}
254+
255+
return retPin;
254256
}
255257

256258
/*----------------------------------------------------------------------------*/

wiringPi/odroidc2.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,12 @@ static int getModeToGpio (int mode, int pin)
302302
}
303303

304304
/* To check I2C module loaded */
305-
if (moduleLoaded(AML_MODULE_I2C) && (retPin == 205 || retPin == 206))
306-
return -1;
307-
else
308-
return retPin;
305+
if (retPin == 205 || retPin == 206) {
306+
if (moduleLoaded(AML_MODULE_I2C))
307+
return -1;
308+
}
309+
310+
return retPin;
309311
}
310312

311313
/*----------------------------------------------------------------------------*/

0 commit comments

Comments
 (0)