diff options
author | Axel Lin <axel.lin@ingics.com> | 2013-06-22 21:56:35 +0800 |
---|---|---|
committer | Heiko Schocher <hs@denx.de> | 2013-07-23 08:34:57 +0200 |
commit | cfb25cc40e6cb0f59f751bfb452bba8be8873ee7 (patch) | |
tree | c140240300de2c9a3503665d4f4b85ccdbb3b234 /common | |
parent | 67bfae36fa365f911fa258b44eb65ca29d1bad03 (diff) | |
download | u-boot-imx-cfb25cc40e6cb0f59f751bfb452bba8be8873ee7.zip u-boot-imx-cfb25cc40e6cb0f59f751bfb452bba8be8873ee7.tar.gz u-boot-imx-cfb25cc40e6cb0f59f751bfb452bba8be8873ee7.tar.bz2 |
cmd_i2c: Use ARRAY_SIZE instead of reinventing it
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/cmd_i2c.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index 5c60d31..0a583c2 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -127,8 +127,6 @@ static uchar i2c_no_probes[] = CONFIG_SYS_I2C_NOPROBES; #define COMPARE_ADDR(a,i) (i2c_no_probes[(i)] == (a)) #define NO_PROBE_ADDR(i) i2c_no_probes[(i)] #endif /* defined(CONFIG_SYS_I2C) */ - -#define NUM_ELEMENTS_NOPROBE (sizeof(i2c_no_probes)/sizeof(i2c_no_probes[0])) #endif #define DISP_LINE_LEN 16 @@ -717,7 +715,7 @@ static int do_i2c_probe (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv #if defined(CONFIG_SYS_I2C_NOPROBES) skip = 0; - for (k=0; k < NUM_ELEMENTS_NOPROBE; k++) { + for (k = 0; k < ARRAY_SIZE(i2c_no_probes); k++) { if (COMPARE_BUS(bus, k) && COMPARE_ADDR(j, k)) { skip = 1; break; @@ -735,7 +733,7 @@ static int do_i2c_probe (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv #if defined(CONFIG_SYS_I2C_NOPROBES) puts ("Excluded chip addresses:"); - for (k=0; k < NUM_ELEMENTS_NOPROBE; k++) { + for (k = 0; k < ARRAY_SIZE(i2c_no_probes); k++) { if (COMPARE_BUS(bus,k)) printf(" %02X", NO_PROBE_ADDR(k)); } |