diff options
author | Ahmed S. Darwish <darwish.07@gmail.com> | 2007-02-06 04:34:54 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2007-02-14 15:45:04 -0500 |
commit | 0a92dd0a70a030a7c2b58937740f26537246d5b0 (patch) | |
tree | 315b0a22f81dab02871e4c5aa95b76e5cd6c2aa1 /drivers/net/wireless | |
parent | 51471d35cafd8b793c835f1627d6a8c53d360e1f (diff) |
[PATCH] wavelan: Use ARRAY_SIZE macro when appropriate
A patch to use ARRAY_SIZE macro when appropriate.
Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/wavelan.c | 14 | ||||
-rw-r--r-- | drivers/net/wireless/wavelan.p.h | 3 |
2 files changed, 7 insertions, 10 deletions
diff --git a/drivers/net/wireless/wavelan.c b/drivers/net/wireless/wavelan.c index 24221e476cd3..2aa3c761dd83 100644 --- a/drivers/net/wireless/wavelan.c +++ b/drivers/net/wireless/wavelan.c | |||
@@ -28,7 +28,7 @@ | |||
28 | */ | 28 | */ |
29 | static u8 wv_irq_to_psa(int irq) | 29 | static u8 wv_irq_to_psa(int irq) |
30 | { | 30 | { |
31 | if (irq < 0 || irq >= NELS(irqvals)) | 31 | if (irq < 0 || irq >= ARRAY_SIZE(irqvals)) |
32 | return 0; | 32 | return 0; |
33 | 33 | ||
34 | return irqvals[irq]; | 34 | return irqvals[irq]; |
@@ -42,7 +42,7 @@ static int __init wv_psa_to_irq(u8 irqval) | |||
42 | { | 42 | { |
43 | int irq; | 43 | int irq; |
44 | 44 | ||
45 | for (irq = 0; irq < NELS(irqvals); irq++) | 45 | for (irq = 0; irq < ARRAY_SIZE(irqvals); irq++) |
46 | if (irqvals[irq] == irqval) | 46 | if (irqvals[irq] == irqval) |
47 | return irq; | 47 | return irq; |
48 | 48 | ||
@@ -1695,7 +1695,7 @@ static int wv_frequency_list(unsigned long ioaddr, /* I/O port of the card */ | |||
1695 | /* Look in the table if the frequency is allowed */ | 1695 | /* Look in the table if the frequency is allowed */ |
1696 | if (table[9 - (freq / 16)] & (1 << (freq % 16))) { | 1696 | if (table[9 - (freq / 16)] & (1 << (freq % 16))) { |
1697 | /* Compute approximate channel number */ | 1697 | /* Compute approximate channel number */ |
1698 | while ((c < NELS(channel_bands)) && | 1698 | while ((c < ARRAY_SIZE(channel_bands)) && |
1699 | (((channel_bands[c] >> 1) - 24) < freq)) | 1699 | (((channel_bands[c] >> 1) - 24) < freq)) |
1700 | c++; | 1700 | c++; |
1701 | list[i].i = c; /* Set the list index */ | 1701 | list[i].i = c; /* Set the list index */ |
@@ -4269,7 +4269,7 @@ struct net_device * __init wavelan_probe(int unit) | |||
4269 | printk(KERN_DEBUG "%s: <-wavelan_probe()\n", dev->name); | 4269 | printk(KERN_DEBUG "%s: <-wavelan_probe()\n", dev->name); |
4270 | #endif | 4270 | #endif |
4271 | } else { /* Scan all possible addresses of the WaveLAN hardware. */ | 4271 | } else { /* Scan all possible addresses of the WaveLAN hardware. */ |
4272 | for (i = 0; i < NELS(iobase); i++) { | 4272 | for (i = 0; i < ARRAY_SIZE(iobase); i++) { |
4273 | dev->irq = def_irq; | 4273 | dev->irq = def_irq; |
4274 | if (wavelan_config(dev, iobase[i]) == 0) { | 4274 | if (wavelan_config(dev, iobase[i]) == 0) { |
4275 | #ifdef DEBUG_CALLBACK_TRACE | 4275 | #ifdef DEBUG_CALLBACK_TRACE |
@@ -4280,7 +4280,7 @@ struct net_device * __init wavelan_probe(int unit) | |||
4280 | break; | 4280 | break; |
4281 | } | 4281 | } |
4282 | } | 4282 | } |
4283 | if (i == NELS(iobase)) | 4283 | if (i == ARRAY_SIZE(iobase)) |
4284 | r = -ENODEV; | 4284 | r = -ENODEV; |
4285 | } | 4285 | } |
4286 | if (r) | 4286 | if (r) |
@@ -4327,14 +4327,14 @@ int __init init_module(void) | |||
4327 | #endif | 4327 | #endif |
4328 | 4328 | ||
4329 | /* Copy the basic set of address to be probed. */ | 4329 | /* Copy the basic set of address to be probed. */ |
4330 | for (i = 0; i < NELS(iobase); i++) | 4330 | for (i = 0; i < ARRAY_SIZE(iobase); i++) |
4331 | io[i] = iobase[i]; | 4331 | io[i] = iobase[i]; |
4332 | } | 4332 | } |
4333 | 4333 | ||
4334 | 4334 | ||
4335 | /* Loop on all possible base addresses. */ | 4335 | /* Loop on all possible base addresses. */ |
4336 | i = -1; | 4336 | i = -1; |
4337 | while ((io[++i] != 0) && (i < NELS(io))) { | 4337 | while ((io[++i] != 0) && (i < ARRAY_SIZE(io))) { |
4338 | struct net_device *dev = alloc_etherdev(sizeof(net_local)); | 4338 | struct net_device *dev = alloc_etherdev(sizeof(net_local)); |
4339 | if (!dev) | 4339 | if (!dev) |
4340 | break; | 4340 | break; |
diff --git a/drivers/net/wireless/wavelan.p.h b/drivers/net/wireless/wavelan.p.h index 72b646c77d5a..fe242812d858 100644 --- a/drivers/net/wireless/wavelan.p.h +++ b/drivers/net/wireless/wavelan.p.h | |||
@@ -449,9 +449,6 @@ static const char *version = "wavelan.c : v24 (SMP + wireless extensions) 11/12/ | |||
449 | /* Watchdog temporisation */ | 449 | /* Watchdog temporisation */ |
450 | #define WATCHDOG_JIFFIES (512*HZ/100) | 450 | #define WATCHDOG_JIFFIES (512*HZ/100) |
451 | 451 | ||
452 | /* Macro to get the number of elements in an array */ | ||
453 | #define NELS(a) (sizeof(a) / sizeof(a[0])) | ||
454 | |||
455 | /* ------------------------ PRIVATE IOCTL ------------------------ */ | 452 | /* ------------------------ PRIVATE IOCTL ------------------------ */ |
456 | 453 | ||
457 | #define SIOCSIPQTHR SIOCIWFIRSTPRIV /* Set quality threshold */ | 454 | #define SIOCSIPQTHR SIOCIWFIRSTPRIV /* Set quality threshold */ |