Commit 0a92dd0a authored by Ahmed S. Darwish's avatar Ahmed S. Darwish Committed by John W. Linville

[PATCH] wavelan: Use ARRAY_SIZE macro when appropriate

A patch to use ARRAY_SIZE macro when appropriate.
Signed-off-by: default avatarAhmed S. Darwish <darwish.07@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 51471d35
......@@ -28,7 +28,7 @@
*/
static u8 wv_irq_to_psa(int irq)
{
if (irq < 0 || irq >= NELS(irqvals))
if (irq < 0 || irq >= ARRAY_SIZE(irqvals))
return 0;
return irqvals[irq];
......@@ -42,7 +42,7 @@ static int __init wv_psa_to_irq(u8 irqval)
{
int irq;
for (irq = 0; irq < NELS(irqvals); irq++)
for (irq = 0; irq < ARRAY_SIZE(irqvals); irq++)
if (irqvals[irq] == irqval)
return irq;
......@@ -1695,7 +1695,7 @@ static int wv_frequency_list(unsigned long ioaddr, /* I/O port of the card */
/* Look in the table if the frequency is allowed */
if (table[9 - (freq / 16)] & (1 << (freq % 16))) {
/* Compute approximate channel number */
while ((c < NELS(channel_bands)) &&
while ((c < ARRAY_SIZE(channel_bands)) &&
(((channel_bands[c] >> 1) - 24) < freq))
c++;
list[i].i = c; /* Set the list index */
......@@ -4269,7 +4269,7 @@ struct net_device * __init wavelan_probe(int unit)
printk(KERN_DEBUG "%s: <-wavelan_probe()\n", dev->name);
#endif
} else { /* Scan all possible addresses of the WaveLAN hardware. */
for (i = 0; i < NELS(iobase); i++) {
for (i = 0; i < ARRAY_SIZE(iobase); i++) {
dev->irq = def_irq;
if (wavelan_config(dev, iobase[i]) == 0) {
#ifdef DEBUG_CALLBACK_TRACE
......@@ -4280,7 +4280,7 @@ struct net_device * __init wavelan_probe(int unit)
break;
}
}
if (i == NELS(iobase))
if (i == ARRAY_SIZE(iobase))
r = -ENODEV;
}
if (r)
......@@ -4327,14 +4327,14 @@ int __init init_module(void)
#endif
/* Copy the basic set of address to be probed. */
for (i = 0; i < NELS(iobase); i++)
for (i = 0; i < ARRAY_SIZE(iobase); i++)
io[i] = iobase[i];
}
/* Loop on all possible base addresses. */
i = -1;
while ((io[++i] != 0) && (i < NELS(io))) {
while ((io[++i] != 0) && (i < ARRAY_SIZE(io))) {
struct net_device *dev = alloc_etherdev(sizeof(net_local));
if (!dev)
break;
......
......@@ -449,9 +449,6 @@ static const char *version = "wavelan.c : v24 (SMP + wireless extensions) 11/12/
/* Watchdog temporisation */
#define WATCHDOG_JIFFIES (512*HZ/100)
/* Macro to get the number of elements in an array */
#define NELS(a) (sizeof(a) / sizeof(a[0]))
/* ------------------------ PRIVATE IOCTL ------------------------ */
#define SIOCSIPQTHR SIOCIWFIRSTPRIV /* Set quality threshold */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment