cmd_i2c: Use ARRAY_SIZE instead of reinventing it
PATCH 1/1 cmd_i2c: Use ARRAY_SIZE instead of reinventing it
Signed-off-by Axel Lin <[email protected]>
--- common/cmd_i2c.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
common/cmd_i2c.c +2 -4
@@ -120,8 +120,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 /* CONFIG_MULTI_BUS */ - -#define NUM_ELEMENTS_NOPROBE (sizeof(i2c_no_probes)/sizeof(i2c_no_probes[0]))#endif #if defined(CONFIG_I2C_MUX )
@@ -713,7 +711,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 ;
@@ -731,7 +729,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)); }
Signature · 1 line
1.8.1.2
PATCH 1/1 cmd_i2c: Use ARRAY_SIZE instead of reinventing it
Quoted 2 lines · Axel Lin
Signed-off-by Axel Lin <[email protected]>
Missing commit message?
Otherwise:
Acked-by Simon Glass <[email protected]>
PATCH 1/1 cmd_i2c: Use ARRAY_SIZE instead of reinventing it
2013/6/25 Simon Glass <[email protected]>:
Quoted 6 lines · Axel Lin
Quoted 2 lines
Signed-off-by Axel Lin <[email protected]>Missing commit message?
Because the subject line is already very clear.
And tools/checkpatch.pl does not complaint.
Quoted 6 lines
Otherwise:
Acked-by Simon Glass <[email protected]>