aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
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
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')
-rw-r--r--drivers/char/amiserial.c2
-rw-r--r--drivers/char/cyclades.c2
-rw-r--r--drivers/char/hvsi.c2
-rw-r--r--drivers/char/istallion.c19
-rw-r--r--drivers/char/moxa.c2
-rw-r--r--drivers/char/mxser.c2
-rw-r--r--drivers/char/nvram.c12
-rw-r--r--drivers/char/pcmcia/synclink_cs.c4
-rw-r--r--drivers/char/rio/rio_linux.c2
-rw-r--r--drivers/char/riscom8.c8
-rw-r--r--drivers/char/serial167.c2
-rw-r--r--drivers/char/stallion.c15
-rw-r--r--drivers/char/sx.c6
-rw-r--r--drivers/char/synclink.c8
-rw-r--r--drivers/char/synclinkmp.c4
-rw-r--r--drivers/char/vme_scc.c4
-rw-r--r--drivers/char/vr41xx_rtc.c2
17 files changed, 45 insertions, 51 deletions
diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c
index a124f8c5d062..10c81ecdace8 100644
--- a/drivers/char/amiserial.c
+++ b/drivers/char/amiserial.c
@@ -116,7 +116,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout);
116 116
117static struct serial_state rs_table[1]; 117static struct serial_state rs_table[1];
118 118
119#define NR_PORTS (sizeof(rs_table)/sizeof(struct serial_state)) 119#define NR_PORTS ARRAY_SIZE(rs_table)
120 120
121/* 121/*
122 * tmp_buf is used as a temporary buffer by serial_write. We need to 122 * tmp_buf is used as a temporary buffer by serial_write. We need to
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index c7f818cd7b02..c8e7daecad72 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -723,7 +723,7 @@ static unsigned int cy_isa_addresses[] = {
723 0xDE000, 723 0xDE000,
724 0,0,0,0,0,0,0,0 724 0,0,0,0,0,0,0,0
725}; 725};
726#define NR_ISA_ADDRS (sizeof(cy_isa_addresses)/sizeof(unsigned char*)) 726#define NR_ISA_ADDRS ARRAY_SIZE(cy_isa_addresses)
727 727
728#ifdef MODULE 728#ifdef MODULE
729static long maddr[NR_CARDS] = { 0, }; 729static long maddr[NR_CARDS] = { 0, };
diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c
index a22aa940e01e..a9522189fc9e 100644
--- a/drivers/char/hvsi.c
+++ b/drivers/char/hvsi.c
@@ -197,7 +197,7 @@ static inline void print_state(struct hvsi_struct *hp)
197 }; 197 };
198 const char *name = state_names[hp->state]; 198 const char *name = state_names[hp->state];
199 199
200 if (hp->state > (sizeof(state_names)/sizeof(char*))) 200 if (hp->state > ARRAY_SIZE(state_names))
201 name = "UNKNOWN"; 201 name = "UNKNOWN";
202 202
203 pr_debug("hvsi%i: state = %s\n", hp->index, name); 203 pr_debug("hvsi%i: state = %s\n", hp->index, name);
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;
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c
index 79e490ef2cf2..46a3a8ccd65f 100644
--- a/drivers/char/moxa.c
+++ b/drivers/char/moxa.c
@@ -448,7 +448,7 @@ static int __init moxa_init(void)
448#ifdef CONFIG_PCI 448#ifdef CONFIG_PCI
449 { 449 {
450 struct pci_dev *p = NULL; 450 struct pci_dev *p = NULL;
451 int n = (sizeof(moxa_pcibrds) / sizeof(moxa_pcibrds[0])) - 1; 451 int n = ARRAY_SIZE(moxa_pcibrds) - 1;
452 i = 0; 452 i = 0;
453 while (i < n) { 453 while (i < n) {
454 while ((p = pci_get_device(moxa_pcibrds[i].vendor, moxa_pcibrds[i].device, p))!=NULL) 454 while ((p = pci_get_device(moxa_pcibrds[i].vendor, moxa_pcibrds[i].device, p))!=NULL)
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index 26448f176803..51bb2a3cf8b3 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -813,7 +813,7 @@ static int mxser_init(void)
813 813
814 /* start finding PCI board here */ 814 /* start finding PCI board here */
815#ifdef CONFIG_PCI 815#ifdef CONFIG_PCI
816 n = (sizeof(mxser_pcibrds) / sizeof(mxser_pcibrds[0])) - 1; 816 n = ARRAY_SIZE(mxser_pcibrds) - 1;
817 index = 0; 817 index = 0;
818 b = 0; 818 b = 0;
819 while (b < n) { 819 while (b < n) {
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c
index 1af733d07321..3556ccd77570 100644
--- a/drivers/char/nvram.c
+++ b/drivers/char/nvram.c
@@ -557,13 +557,13 @@ pc_proc_infos(unsigned char *nvram, char *buffer, int *len,
557 (nvram[6] & 1) ? (nvram[6] >> 6) + 1 : 0); 557 (nvram[6] & 1) ? (nvram[6] >> 6) + 1 : 0);
558 PRINT_PROC("Floppy 0 type : "); 558 PRINT_PROC("Floppy 0 type : ");
559 type = nvram[2] >> 4; 559 type = nvram[2] >> 4;
560 if (type < sizeof (floppy_types) / sizeof (*floppy_types)) 560 if (type < ARRAY_SIZE(floppy_types))
561 PRINT_PROC("%s\n", floppy_types[type]); 561 PRINT_PROC("%s\n", floppy_types[type]);
562 else 562 else
563 PRINT_PROC("%d (unknown)\n", type); 563 PRINT_PROC("%d (unknown)\n", type);
564 PRINT_PROC("Floppy 1 type : "); 564 PRINT_PROC("Floppy 1 type : ");
565 type = nvram[2] & 0x0f; 565 type = nvram[2] & 0x0f;
566 if (type < sizeof (floppy_types) / sizeof (*floppy_types)) 566 if (type < ARRAY_SIZE(floppy_types))
567 PRINT_PROC("%s\n", floppy_types[type]); 567 PRINT_PROC("%s\n", floppy_types[type]);
568 else 568 else
569 PRINT_PROC("%d (unknown)\n", type); 569 PRINT_PROC("%d (unknown)\n", type);
@@ -843,8 +843,6 @@ static char *colors[] = {
843 "2", "4", "16", "256", "65536", "??", "??", "??" 843 "2", "4", "16", "256", "65536", "??", "??", "??"
844}; 844};
845 845
846#define fieldsize(a) (sizeof(a)/sizeof(*a))
847
848static int 846static int
849atari_proc_infos(unsigned char *nvram, char *buffer, int *len, 847atari_proc_infos(unsigned char *nvram, char *buffer, int *len,
850 off_t *begin, off_t offset, int size) 848 off_t *begin, off_t offset, int size)
@@ -856,7 +854,7 @@ atari_proc_infos(unsigned char *nvram, char *buffer, int *len,
856 PRINT_PROC("Checksum status : %svalid\n", checksum ? "" : "not "); 854 PRINT_PROC("Checksum status : %svalid\n", checksum ? "" : "not ");
857 855
858 PRINT_PROC("Boot preference : "); 856 PRINT_PROC("Boot preference : ");
859 for (i = fieldsize(boot_prefs) - 1; i >= 0; --i) { 857 for (i = ARRAY_SIZE(boot_prefs) - 1; i >= 0; --i) {
860 if (nvram[1] == boot_prefs[i].val) { 858 if (nvram[1] == boot_prefs[i].val) {
861 PRINT_PROC("%s\n", boot_prefs[i].name); 859 PRINT_PROC("%s\n", boot_prefs[i].name);
862 break; 860 break;
@@ -878,12 +876,12 @@ atari_proc_infos(unsigned char *nvram, char *buffer, int *len,
878 return 1; 876 return 1;
879 877
880 PRINT_PROC("OS language : "); 878 PRINT_PROC("OS language : ");
881 if (nvram[6] < fieldsize(languages)) 879 if (nvram[6] < ARRAY_SIZE(languages))
882 PRINT_PROC("%s\n", languages[nvram[6]]); 880 PRINT_PROC("%s\n", languages[nvram[6]]);
883 else 881 else
884 PRINT_PROC("%u (undefined)\n", nvram[6]); 882 PRINT_PROC("%u (undefined)\n", nvram[6]);
885 PRINT_PROC("Keyboard language: "); 883 PRINT_PROC("Keyboard language: ");
886 if (nvram[7] < fieldsize(languages)) 884 if (nvram[7] < ARRAY_SIZE(languages))
887 PRINT_PROC("%s\n", languages[nvram[7]]); 885 PRINT_PROC("%s\n", languages[nvram[7]]);
888 else 886 else
889 PRINT_PROC("%u (undefined)\n", nvram[7]); 887 PRINT_PROC("%u (undefined)\n", nvram[7]);
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index cf45b100eff1..9fb10c9fec88 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -4005,7 +4005,7 @@ BOOLEAN register_test(MGSLPC_INFO *info)
4005{ 4005{
4006 static unsigned char patterns[] = 4006 static unsigned char patterns[] =
4007 { 0x00, 0xff, 0xaa, 0x55, 0x69, 0x96, 0x0f }; 4007 { 0x00, 0xff, 0xaa, 0x55, 0x69, 0x96, 0x0f };
4008 static unsigned int count = sizeof(patterns) / sizeof(patterns[0]); 4008 static unsigned int count = ARRAY_SIZE(patterns);
4009 unsigned int i; 4009 unsigned int i;
4010 BOOLEAN rc = TRUE; 4010 BOOLEAN rc = TRUE;
4011 unsigned long flags; 4011 unsigned long flags;
@@ -4016,7 +4016,7 @@ BOOLEAN register_test(MGSLPC_INFO *info)
4016 for (i = 0; i < count; i++) { 4016 for (i = 0; i < count; i++) {
4017 write_reg(info, XAD1, patterns[i]); 4017 write_reg(info, XAD1, patterns[i]);
4018 write_reg(info, XAD2, patterns[(i + 1) % count]); 4018 write_reg(info, XAD2, patterns[(i + 1) % count]);
4019 if ((read_reg(info, XAD1) != patterns[i]) || 4019 if ((read_reg(info, XAD1) != patterns[i]) ||
4020 (read_reg(info, XAD2) != patterns[(i + 1) % count])) { 4020 (read_reg(info, XAD2) != patterns[(i + 1) % count])) {
4021 rc = FALSE; 4021 rc = FALSE;
4022 break; 4022 break;
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c
index 2611b15b6bd1..7085a38532b3 100644
--- a/drivers/char/rio/rio_linux.c
+++ b/drivers/char/rio/rio_linux.c
@@ -211,7 +211,7 @@ static int rio_poll = 1;
211 or less.... */ 211 or less.... */
212static int rio_probe_addrs[]= {0xc0000, 0xd0000, 0xe0000}; 212static int rio_probe_addrs[]= {0xc0000, 0xd0000, 0xe0000};
213 213
214#define NR_RIO_ADDRS (sizeof(rio_probe_addrs)/sizeof (int)) 214#define NR_RIO_ADDRS ARRAY_SIZE(rio_probe_addrs)
215 215
216 216
217/* Set the mask to all-ones. This alas, only supports 32 interrupts. 217/* Set the mask to all-ones. This alas, only supports 32 interrupts.
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c
index 55a3a0188eda..5dae32521620 100644
--- a/drivers/char/riscom8.c
+++ b/drivers/char/riscom8.c
@@ -107,15 +107,15 @@ static struct riscom_port rc_port[RC_NBOARD * RC_NPORT];
107 107
108/* RISCom/8 I/O ports addresses (without address translation) */ 108/* RISCom/8 I/O ports addresses (without address translation) */
109static unsigned short rc_ioport[] = { 109static unsigned short rc_ioport[] = {
110#if 1 110#if 1
111 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x09, 0x0a, 0x0b, 0x0c, 111 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x09, 0x0a, 0x0b, 0x0c,
112#else 112#else
113 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x09, 0x0a, 0x0b, 0x0c, 0x10, 113 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x09, 0x0a, 0x0b, 0x0c, 0x10,
114 0x11, 0x12, 0x18, 0x28, 0x31, 0x32, 0x39, 0x3a, 0x40, 0x41, 0x61, 0x62, 114 0x11, 0x12, 0x18, 0x28, 0x31, 0x32, 0x39, 0x3a, 0x40, 0x41, 0x61, 0x62,
115 0x63, 0x64, 0x6b, 0x70, 0x71, 0x78, 0x7a, 0x7b, 0x7f, 0x100, 0x101 115 0x63, 0x64, 0x6b, 0x70, 0x71, 0x78, 0x7a, 0x7b, 0x7f, 0x100, 0x101
116#endif 116#endif
117}; 117};
118#define RC_NIOPORT (sizeof(rc_ioport) / sizeof(rc_ioport[0])) 118#define RC_NIOPORT ARRAY_SIZE(rc_ioport)
119 119
120 120
121static inline int rc_paranoia_check(struct riscom_port const * port, 121static inline int rc_paranoia_check(struct riscom_port const * port,
diff --git a/drivers/char/serial167.c b/drivers/char/serial167.c
index c2deac968bdd..a580748b92a1 100644
--- a/drivers/char/serial167.c
+++ b/drivers/char/serial167.c
@@ -117,7 +117,7 @@ struct cyclades_port cy_port[] = {
117 {-1 }, /* ttyS2 */ 117 {-1 }, /* ttyS2 */
118 {-1 }, /* ttyS3 */ 118 {-1 }, /* ttyS3 */
119}; 119};
120#define NR_PORTS (sizeof(cy_port)/sizeof(struct cyclades_port)) 120#define NR_PORTS ARRAY_SIZE(cy_port)
121 121
122/* 122/*
123 * tmp_buf is used as a temporary buffer by serial_write. We need to 123 * tmp_buf is used as a temporary buffer by serial_write. We need to
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;
diff --git a/drivers/char/sx.c b/drivers/char/sx.c
index 3ad758a9a1dc..564f31778eb3 100644
--- a/drivers/char/sx.c
+++ b/drivers/char/sx.c
@@ -345,9 +345,9 @@ static int si_probe_addrs[]= {0xc0000, 0xd0000, 0xe0000,
345 0xc8000, 0xd8000, 0xe8000, 0xa0000}; 345 0xc8000, 0xd8000, 0xe8000, 0xa0000};
346static int si1_probe_addrs[]= { 0xd0000}; 346static int si1_probe_addrs[]= { 0xd0000};
347 347
348#define NR_SX_ADDRS (sizeof(sx_probe_addrs)/sizeof (int)) 348#define NR_SX_ADDRS ARRAY_SIZE(sx_probe_addrs)
349#define NR_SI_ADDRS (sizeof(si_probe_addrs)/sizeof (int)) 349#define NR_SI_ADDRS ARRAY_SIZE(si_probe_addrs)
350#define NR_SI1_ADDRS (sizeof(si1_probe_addrs)/sizeof (int)) 350#define NR_SI1_ADDRS ARRAY_SIZE(si1_probe_addrs)
351 351
352 352
353/* Set the mask to all-ones. This alas, only supports 32 interrupts. 353/* Set the mask to all-ones. This alas, only supports 32 interrupts.
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index 62aa0e534a6d..789572fc002b 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -7058,7 +7058,7 @@ static BOOLEAN mgsl_register_test( struct mgsl_struct *info )
7058{ 7058{
7059 static unsigned short BitPatterns[] = 7059 static unsigned short BitPatterns[] =
7060 { 0x0000, 0xffff, 0xaaaa, 0x5555, 0x1234, 0x6969, 0x9696, 0x0f0f }; 7060 { 0x0000, 0xffff, 0xaaaa, 0x5555, 0x1234, 0x6969, 0x9696, 0x0f0f };
7061 static unsigned int Patterncount = sizeof(BitPatterns)/sizeof(unsigned short); 7061 static unsigned int Patterncount = ARRAY_SIZE(BitPatterns);
7062 unsigned int i; 7062 unsigned int i;
7063 BOOLEAN rc = TRUE; 7063 BOOLEAN rc = TRUE;
7064 unsigned long flags; 7064 unsigned long flags;
@@ -7501,9 +7501,9 @@ static int mgsl_adapter_test( struct mgsl_struct *info )
7501 */ 7501 */
7502static BOOLEAN mgsl_memory_test( struct mgsl_struct *info ) 7502static BOOLEAN mgsl_memory_test( struct mgsl_struct *info )
7503{ 7503{
7504 static unsigned long BitPatterns[] = { 0x0, 0x55555555, 0xaaaaaaaa, 7504 static unsigned long BitPatterns[] =
7505 0x66666666, 0x99999999, 0xffffffff, 0x12345678 }; 7505 { 0x0, 0x55555555, 0xaaaaaaaa, 0x66666666, 0x99999999, 0xffffffff, 0x12345678 };
7506 unsigned long Patterncount = sizeof(BitPatterns)/sizeof(unsigned long); 7506 unsigned long Patterncount = ARRAY_SIZE(BitPatterns);
7507 unsigned long i; 7507 unsigned long i;
7508 unsigned long TestLimit = SHARED_MEM_ADDRESS_SIZE/sizeof(unsigned long); 7508 unsigned long TestLimit = SHARED_MEM_ADDRESS_SIZE/sizeof(unsigned long);
7509 unsigned long * TestAddr; 7509 unsigned long * TestAddr;
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
index ee5a40be9f99..a9467e7d3747 100644
--- a/drivers/char/synclinkmp.c
+++ b/drivers/char/synclinkmp.c
@@ -5104,7 +5104,7 @@ void tx_load_dma_buffer(SLMP_INFO *info, const char *buf, unsigned int count)
5104int register_test(SLMP_INFO *info) 5104int register_test(SLMP_INFO *info)
5105{ 5105{
5106 static unsigned char testval[] = {0x00, 0xff, 0xaa, 0x55, 0x69, 0x96}; 5106 static unsigned char testval[] = {0x00, 0xff, 0xaa, 0x55, 0x69, 0x96};
5107 static unsigned int count = sizeof(testval)/sizeof(unsigned char); 5107 static unsigned int count = ARRAY_SIZE(testval);
5108 unsigned int i; 5108 unsigned int i;
5109 int rc = TRUE; 5109 int rc = TRUE;
5110 unsigned long flags; 5110 unsigned long flags;
@@ -5422,7 +5422,7 @@ int memory_test(SLMP_INFO *info)
5422{ 5422{
5423 static unsigned long testval[] = { 0x0, 0x55555555, 0xaaaaaaaa, 5423 static unsigned long testval[] = { 0x0, 0x55555555, 0xaaaaaaaa,
5424 0x66666666, 0x99999999, 0xffffffff, 0x12345678 }; 5424 0x66666666, 0x99999999, 0xffffffff, 0x12345678 };
5425 unsigned long count = sizeof(testval)/sizeof(unsigned long); 5425 unsigned long count = ARRAY_SIZE(testval);
5426 unsigned long i; 5426 unsigned long i;
5427 unsigned long limit = SCA_MEM_SIZE/sizeof(unsigned long); 5427 unsigned long limit = SCA_MEM_SIZE/sizeof(unsigned long);
5428 unsigned long * addr = (unsigned long *)info->memory_base; 5428 unsigned long * addr = (unsigned long *)info->memory_base;
diff --git a/drivers/char/vme_scc.c b/drivers/char/vme_scc.c
index 19ba83635dd7..33e71e23b212 100644
--- a/drivers/char/vme_scc.c
+++ b/drivers/char/vme_scc.c
@@ -875,13 +875,13 @@ static int scc_open (struct tty_struct * tty, struct file * filp)
875 local_irq_save(flags); 875 local_irq_save(flags);
876#if defined(CONFIG_MVME147_SCC) || defined(CONFIG_MVME162_SCC) 876#if defined(CONFIG_MVME147_SCC) || defined(CONFIG_MVME162_SCC)
877 if (MACH_IS_MVME147 || MACH_IS_MVME16x) { 877 if (MACH_IS_MVME147 || MACH_IS_MVME16x) {
878 for (i=0; i<sizeof(mvme_init_tab)/sizeof(*mvme_init_tab); ++i) 878 for (i = 0; i < ARRAY_SIZE(mvme_init_tab); ++i)
879 SCCwrite(mvme_init_tab[i].reg, mvme_init_tab[i].val); 879 SCCwrite(mvme_init_tab[i].reg, mvme_init_tab[i].val);
880 } 880 }
881#endif 881#endif
882#if defined(CONFIG_BVME6000_SCC) 882#if defined(CONFIG_BVME6000_SCC)
883 if (MACH_IS_BVME6000) { 883 if (MACH_IS_BVME6000) {
884 for (i=0; i<sizeof(bvme_init_tab)/sizeof(*bvme_init_tab); ++i) 884 for (i = 0; i < ARRAY_SIZE(bvme_init_tab); ++i)
885 SCCwrite(bvme_init_tab[i].reg, bvme_init_tab[i].val); 885 SCCwrite(bvme_init_tab[i].reg, bvme_init_tab[i].val);
886 } 886 }
887#endif 887#endif
diff --git a/drivers/char/vr41xx_rtc.c b/drivers/char/vr41xx_rtc.c
index 435b30748e23..05a3e3743c1d 100644
--- a/drivers/char/vr41xx_rtc.c
+++ b/drivers/char/vr41xx_rtc.c
@@ -127,7 +127,7 @@ struct resource rtc_resource[2] = {
127 .flags = IORESOURCE_MEM, }, 127 .flags = IORESOURCE_MEM, },
128}; 128};
129 129
130#define RTC_NUM_RESOURCES sizeof(rtc_resource) / sizeof(struct resource) 130#define RTC_NUM_RESOURCES ARRAY_SIZE(rtc_resource)
131 131
132static inline unsigned long read_elapsed_second(void) 132static inline unsigned long read_elapsed_second(void)
133{ 133{