aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/istallion.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/istallion.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/istallion.c')
-rw-r--r--drivers/char/istallion.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c
index ce3bc0d45f1f..24435f8daa68 100644
--- a/drivers/char/istallion.c
+++ b/drivers/char/istallion.c
@@ -135,7 +135,7 @@ static stlconf_t stli_brdconf[] = {
135 /*{ BRD_ECP, 0x2a0, 0, 0xcc000, 0, 0 },*/ 135 /*{ BRD_ECP, 0x2a0, 0, 0xcc000, 0, 0 },*/
136}; 136};
137 137
138static int stli_nrbrds = sizeof(stli_brdconf) / sizeof(stlconf_t); 138static int stli_nrbrds = ARRAY_SIZE(stli_brdconf);
139 139
140/* 140/*
141 * There is some experimental EISA board detection code in this driver. 141 * There is some experimental EISA board detection code in this driver.
@@ -406,7 +406,7 @@ static unsigned long stli_eisamemprobeaddrs[] = {
406 0xff000000, 0xff010000, 0xff020000, 0xff030000, 406 0xff000000, 0xff010000, 0xff020000, 0xff030000,
407}; 407};
408 408
409static int stli_eisamempsize = sizeof(stli_eisamemprobeaddrs) / sizeof(unsigned long); 409static int stli_eisamempsize = ARRAY_SIZE(stli_eisamemprobeaddrs);
410 410
411/* 411/*
412 * Define the Stallion PCI vendor and device IDs. 412 * Define the Stallion PCI vendor and device IDs.
@@ -899,15 +899,13 @@ static void stli_argbrds(void)
899{ 899{
900 stlconf_t conf; 900 stlconf_t conf;
901 stlibrd_t *brdp; 901 stlibrd_t *brdp;
902 int nrargs, i; 902 int i;
903 903
904#ifdef DEBUG 904#ifdef DEBUG
905 printk("stli_argbrds()\n"); 905 printk("stli_argbrds()\n");
906#endif 906#endif
907 907
908 nrargs = sizeof(stli_brdsp) / sizeof(char **); 908 for (i = stli_nrbrds; i < ARRAY_SIZE(stli_brdsp); i++) {
909
910 for (i = stli_nrbrds; (i < nrargs); i++) {
911 memset(&conf, 0, sizeof(conf)); 909 memset(&conf, 0, sizeof(conf));
912 if (stli_parsebrd(&conf, stli_brdsp[i]) == 0) 910 if (stli_parsebrd(&conf, stli_brdsp[i]) == 0)
913 continue; 911 continue;
@@ -967,7 +965,7 @@ static unsigned long stli_atol(char *str)
967static int stli_parsebrd(stlconf_t *confp, char **argp) 965static int stli_parsebrd(stlconf_t *confp, char **argp)
968{ 966{
969 char *sp; 967 char *sp;
970 int nrbrdnames, i; 968 int i;
971 969
972#ifdef DEBUG 970#ifdef DEBUG
973 printk("stli_parsebrd(confp=%x,argp=%x)\n", (int) confp, (int) argp); 971 printk("stli_parsebrd(confp=%x,argp=%x)\n", (int) confp, (int) argp);
@@ -979,14 +977,13 @@ static int stli_parsebrd(stlconf_t *confp, char **argp)
979 for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++) 977 for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++)
980 *sp = TOLOWER(*sp); 978 *sp = TOLOWER(*sp);
981 979
982 nrbrdnames = sizeof(stli_brdstr) / sizeof(stlibrdtype_t); 980 for (i = 0; i < ARRAY_SIZE(stli_brdstr); i++) {
983 for (i = 0; (i < nrbrdnames); i++) {
984 if (strcmp(stli_brdstr[i].name, argp[0]) == 0) 981 if (strcmp(stli_brdstr[i].name, argp[0]) == 0)
985 break; 982 break;
986 } 983 }
987 if (i >= nrbrdnames) { 984 if (i == ARRAY_SIZE(stli_brdstr)) {
988 printk("STALLION: unknown board name, %s?\n", argp[0]); 985 printk("STALLION: unknown board name, %s?\n", argp[0]);
989 return(0); 986 return 0;
990 } 987 }
991 988
992 confp->brdtype = stli_brdstr[i].type; 989 confp->brdtype = stli_brdstr[i].type;