aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/stallion.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@nuerscht.ch>2006-01-09 23:54:02 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-10 11:01:56 -0500
commitfe971071a89c5c5184fc9f3482c7a8e997cf0520 (patch)
tree74a29e80d5636255f33c750482497a32d8d3491f /drivers/char/stallion.c
parent3c6bee1d4037a5c569f30d40bd852a57ba250912 (diff)
[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.c15
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[] = {
103 /*{ BRD_EASYIO, 0x2a0, 0, 0, 10, 0 },*/ 103 /*{ BRD_EASYIO, 0x2a0, 0, 0, 10, 0 },*/
104}; 104};
105 105
106static int stl_nrbrds = sizeof(stl_brdconf) / sizeof(stlconf_t); 106static int stl_nrbrds = ARRAY_SIZE(stl_brdconf);
107 107
108/*****************************************************************************/ 108/*****************************************************************************/
109 109
@@ -424,7 +424,7 @@ static stlpcibrd_t stl_pcibrds[] = {
424 { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87410, BRD_ECHPCI }, 424 { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87410, BRD_ECHPCI },
425}; 425};
426 426
427static int stl_nrpcibrds = sizeof(stl_pcibrds) / sizeof(stlpcibrd_t); 427static int stl_nrpcibrds = ARRAY_SIZE(stl_pcibrds);
428 428
429#endif 429#endif
430 430
@@ -704,7 +704,7 @@ static unsigned int sc26198_baudtable[] = {
704 230400, 460800, 921600 704 230400, 460800, 921600
705}; 705};
706 706
707#define SC26198_NRBAUDS (sizeof(sc26198_baudtable) / sizeof(unsigned int)) 707#define SC26198_NRBAUDS ARRAY_SIZE(sc26198_baudtable)
708 708
709/*****************************************************************************/ 709/*****************************************************************************/
710 710
@@ -901,7 +901,7 @@ static unsigned long stl_atol(char *str)
901static int stl_parsebrd(stlconf_t *confp, char **argp) 901static int stl_parsebrd(stlconf_t *confp, char **argp)
902{ 902{
903 char *sp; 903 char *sp;
904 int nrbrdnames, i; 904 int i;
905 905
906#ifdef DEBUG 906#ifdef DEBUG
907 printk("stl_parsebrd(confp=%x,argp=%x)\n", (int) confp, (int) argp); 907 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)
913 for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++) 913 for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++)
914 *sp = TOLOWER(*sp); 914 *sp = TOLOWER(*sp);
915 915
916 nrbrdnames = sizeof(stl_brdstr) / sizeof(stlbrdtype_t); 916 for (i = 0; i < ARRAY_SIZE(stl_brdstr); i++) {
917 for (i = 0; (i < nrbrdnames); i++) {
918 if (strcmp(stl_brdstr[i].name, argp[0]) == 0) 917 if (strcmp(stl_brdstr[i].name, argp[0]) == 0)
919 break; 918 break;
920 } 919 }
921 if (i >= nrbrdnames) { 920 if (i == ARRAY_SIZE(stl_brdstr)) {
922 printk("STALLION: unknown board name, %s?\n", argp[0]); 921 printk("STALLION: unknown board name, %s?\n", argp[0]);
923 return(0); 922 return 0;
924 } 923 }
925 924
926 confp->brdtype = stl_brdstr[i].type; 925 confp->brdtype = stl_brdstr[i].type;