public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] serial: Use ARRAY_SIZE instead of reinventing it
@ 2013-06-22 16:46 Axel Lin
  2013-06-26 20:25 ` [U-Boot] " Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2013-06-22 16:46 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/serial/serial.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index daa8003..a19cec5 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -37,7 +37,6 @@ static struct serial_device *serial_current;
  * Table with supported baudrates (defined in config_xyz.h)
  */
 static const unsigned long baudrate_table[] = CONFIG_SYS_BAUDRATE_TABLE;
-#define	N_BAUDRATES (sizeof(baudrate_table) / sizeof(baudrate_table[0]))
 
 /**
  * serial_null() - Void registration routine of a serial driver
@@ -74,11 +73,11 @@ static int on_baudrate(const char *name, const char *value, enum env_op op,
 		if (gd->baudrate == baudrate)
 			return 0;
 
-		for (i = 0; i < N_BAUDRATES; ++i) {
+		for (i = 0; i < ARRAY_SIZE(baudrate_table); ++i) {
 			if (baudrate == baudrate_table[i])
 				break;
 		}
-		if (i == N_BAUDRATES) {
+		if (i == ARRAY_SIZE(baudrate_table)) {
 			if ((flags & H_FORCE) == 0)
 				printf("## Baudrate %d bps not supported\n",
 					baudrate);
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-26 20:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-22 16:46 [U-Boot] [PATCH] serial: Use ARRAY_SIZE instead of reinventing it Axel Lin
2013-06-26 20:25 ` [U-Boot] " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox