summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2013-06-23 00:46:41 +0800
committerTom Rini <trini@ti.com>2013-06-26 10:26:06 -0400
commit9935175f50398929d83f4af98a7491fcdcbd46c9 (patch)
treeb69f61f72578210bcc79dda06a88116a692d0b8d
parent4d98b5c8a51d2bdbb49aaa0189a47ab050c678b3 (diff)
downloadu-boot-imx-9935175f50398929d83f4af98a7491fcdcbd46c9.zip
u-boot-imx-9935175f50398929d83f4af98a7491fcdcbd46c9.tar.gz
u-boot-imx-9935175f50398929d83f4af98a7491fcdcbd46c9.tar.bz2
serial: Use ARRAY_SIZE instead of reinventing it
Signed-off-by: Axel Lin <axel.lin@ingics.com>
-rw-r--r--drivers/serial/serial.c5
1 files 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);