public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@ingics.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] cmd_i2c: Use ARRAY_SIZE instead of reinventing it
Date: Sat, 22 Jun 2013 21:56:35 +0800	[thread overview]
Message-ID: <1371909395.8977.0.camel@phoenix> (raw)

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 common/cmd_i2c.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
index 4380794..3215644 100644
--- a/common/cmd_i2c.c
+++ b/common/cmd_i2c.c
@@ -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));
 	}
-- 
1.8.1.2

             reply	other threads:[~2013-06-22 13:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-22 13:56 Axel Lin [this message]
2013-06-25  0:54 ` [U-Boot] [PATCH] cmd_i2c: Use ARRAY_SIZE instead of reinventing it Simon Glass
2013-06-25  1:15   ` Axel Lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1371909395.8977.0.camel@phoenix \
    --to=axel.lin@ingics.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox