diff options
author | Tobias Klauser <tklauser@nuerscht.ch> | 2006-01-10 05:54:02 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-10 17:01:56 +0100 |
commit | fe971071a89c5c5184fc9f3482c7a8e997cf0520 (patch) | |
tree | 74a29e80d5636255f33c750482497a32d8d3491f /drivers/char/stallion.c | |
parent | [PATCH] turn "const static" into "static const" (diff) | |
download | linux-fe971071a89c5c5184fc9f3482c7a8e997cf0520.tar.xz linux-fe971071a89c5c5184fc9f3482c7a8e997cf0520.zip |
[PATCH] drivers/char: Use ARRAY_SIZE macro
Use ARRAY_SIZE macro instead of sizeof(x)/sizeof(x[0]) and remove
duplicates of ARRAY_SIZE.
Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/stallion.c')
-rw-r--r-- | drivers/char/stallion.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index 95af2a941595..acef2abf3f0d 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c @@ -103,7 +103,7 @@ static stlconf_t stl_brdconf[] = { /*{ BRD_EASYIO, 0x2a0, 0, 0, 10, 0 },*/ }; -static int stl_nrbrds = sizeof(stl_brdconf) / sizeof(stlconf_t); +static int stl_nrbrds = ARRAY_SIZE(stl_brdconf); /*****************************************************************************/ @@ -424,7 +424,7 @@ static stlpcibrd_t stl_pcibrds[] = { { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87410, BRD_ECHPCI }, }; -static int stl_nrpcibrds = sizeof(stl_pcibrds) / sizeof(stlpcibrd_t); +static int stl_nrpcibrds = ARRAY_SIZE(stl_pcibrds); #endif @@ -704,7 +704,7 @@ static unsigned int sc26198_baudtable[] = { 230400, 460800, 921600 }; -#define SC26198_NRBAUDS (sizeof(sc26198_baudtable) / sizeof(unsigned int)) +#define SC26198_NRBAUDS ARRAY_SIZE(sc26198_baudtable) /*****************************************************************************/ @@ -901,7 +901,7 @@ static unsigned long stl_atol(char *str) static int stl_parsebrd(stlconf_t *confp, char **argp) { char *sp; - int nrbrdnames, i; + int i; #ifdef DEBUG printk("stl_parsebrd(confp=%x,argp=%x)\n", (int) confp, (int) argp); @@ -913,14 +913,13 @@ static int stl_parsebrd(stlconf_t *confp, char **argp) for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++) *sp = TOLOWER(*sp); - nrbrdnames = sizeof(stl_brdstr) / sizeof(stlbrdtype_t); - for (i = 0; (i < nrbrdnames); i++) { + for (i = 0; i < ARRAY_SIZE(stl_brdstr); i++) { if (strcmp(stl_brdstr[i].name, argp[0]) == 0) break; } - if (i >= nrbrdnames) { + if (i == ARRAY_SIZE(stl_brdstr)) { printk("STALLION: unknown board name, %s?\n", argp[0]); - return(0); + return 0; } confp->brdtype = stl_brdstr[i].type; |