From d2397817f12d246cfd88caefd6f12dfd3e2d2c17 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 10 May 2011 07:28:35 +0000 Subject: post: use ARRAY_SIZE We've got a handy dandy macro already for calculating the number of elements in an array, so use it. Signed-off-by: Mike Frysinger --- post/cpu/mpc8xx/ether.c | 4 +--- post/cpu/mpc8xx/spr.c | 3 +-- post/cpu/mpc8xx/uart.c | 4 +--- 3 files changed, 3 insertions(+), 8 deletions(-) (limited to 'post/cpu/mpc8xx') diff --git a/post/cpu/mpc8xx/ether.c b/post/cpu/mpc8xx/ether.c index 43ea817..fcbb300 100644 --- a/post/cpu/mpc8xx/ether.c +++ b/post/cpu/mpc8xx/ether.c @@ -67,8 +67,6 @@ static int ctlr_list[][2] = { {CTLR_SCC, 1} }; static int ctlr_list[][2] = { }; #endif -#define CTRL_LIST_SIZE (sizeof(ctlr_list) / sizeof(ctlr_list[0])) - static struct { void (*init) (int index); void (*halt) (int index); @@ -618,7 +616,7 @@ int ether_post_test (int flags) ctlr_proc[CTLR_SCC].send = scc_send; ctlr_proc[CTLR_SCC].recv = scc_recv; - for (i = 0; i < CTRL_LIST_SIZE; i++) { + for (i = 0; i < ARRAY_SIZE(ctlr_list); i++) { if (test_ctlr (ctlr_list[i][0], ctlr_list[i][1]) != 0) { res = -1; } diff --git a/post/cpu/mpc8xx/spr.c b/post/cpu/mpc8xx/spr.c index db84dbe..4c1e2af 100644 --- a/post/cpu/mpc8xx/spr.c +++ b/post/cpu/mpc8xx/spr.c @@ -108,8 +108,7 @@ static struct {826, "MD_DBRAM1", 0x00000000, 0x00000000}, }; -static int spr_test_list_size = - sizeof (spr_test_list) / sizeof (spr_test_list[0]); +static int spr_test_list_size = ARRAY_SIZE(spr_test_list); int spr_post_test (int flags) { diff --git a/post/cpu/mpc8xx/uart.c b/post/cpu/mpc8xx/uart.c index f351ac0..7a7a62a 100644 --- a/post/cpu/mpc8xx/uart.c +++ b/post/cpu/mpc8xx/uart.c @@ -61,8 +61,6 @@ static int ctlr_list[][2] = static int ctlr_list[][2] = { }; #endif -#define CTRL_LIST_SIZE (sizeof(ctlr_list) / sizeof(ctlr_list[0])) - static struct { void (*init) (int index); void (*halt) (int index); @@ -540,7 +538,7 @@ int uart_post_test (int flags) ctlr_proc[CTLR_SCC].putc = scc_putc; ctlr_proc[CTLR_SCC].getc = scc_getc; - for (i = 0; i < CTRL_LIST_SIZE; i++) { + for (i = 0; i < ARRAY_SIZE(ctlr_list); i++) { if (test_ctlr (ctlr_list[i][0], ctlr_list[i][1]) != 0) { res = -1; } -- cgit v1.1