You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
netdev: convert non-obvious instances to use ARRAY_SIZE()
This will convert remaining non-obvious or naive calculations of array sizes to use ARRAY_SIZE() macro. Signed-off-by: Alejandro Martinez Ruiz <alex@flawedcode.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
committed by
Jeff Garzik
parent
88a15f2e28
commit
e9edda697e
@@ -93,7 +93,7 @@ static int __init init_reg_offset(struct net_device *dev,unsigned long base_addr
|
||||
bus_width = *(volatile unsigned char *)ABWCR;
|
||||
bus_width &= 1 << ((base_addr >> 21) & 7);
|
||||
|
||||
for (i = 0; i < sizeof(reg_offset) / sizeof(u32); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(reg_offset); i++)
|
||||
if (bus_width == 0)
|
||||
reg_offset[i] = i * 2 + 1;
|
||||
else
|
||||
@@ -115,7 +115,7 @@ static int h8300_ne_irq[] = {EXT_IRQ5};
|
||||
|
||||
static inline int init_dev(struct net_device *dev)
|
||||
{
|
||||
if (h8300_ne_count < (sizeof(h8300_ne_base) / sizeof(unsigned long))) {
|
||||
if (h8300_ne_count < ARRAY_SIZE(h8300_ne_base)) {
|
||||
dev->base_addr = h8300_ne_base[h8300_ne_count];
|
||||
dev->irq = h8300_ne_irq[h8300_ne_count];
|
||||
h8300_ne_count++;
|
||||
|
||||
Reference in New Issue
Block a user