use array_size macro
Subsystems (7)
PATCH 1/1 use array_size macro
This patch changes code to use the ARRAY_SIZE macro. This patch is the result of:
find -name *.[chsS] | xargs sed -i "s/sizeof(\(\w*\))[ \t]*\/[ \t]*sizeof(\1\[0\])/ARRAY_SIZE(\1)/g"
---
arch/arm/kernel/dma-isa.c +1 -1
@@ -216,7 +216,7 @@ void __init isa_init_dma(dma_t *dma)request_dma (DMA_ISA_CASCADE ,"cascade" ); -for (i =0 ; i <sizeof (dma_resources) /sizeof (dma_resources[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (dma_resources); i++)request_resource (&ioport_resource, dma_resources + i); } }
arch/powerpc/platforms/celleb/scc_sio.c +1 -1
@@ -52,7 +52,7 @@ static int txx9_serial_init(void)if (!node)return 0 ; -for (i =0 ; i <sizeof (txx9_scc_tab)/sizeof (txx9_scc_tab[0 ]); i++) { +for (i =0 ; i <ARRAY_SIZE (txx9_scc_tab); i++) {if (!(txx9_serial_bitmap & (1 <<i)))continue ;
arch/um/kernel/tt/ptproxy/ptrace.c +6 -6
@@ -77,7 +77,7 @@ long proxy_ptrace(struct debugger *debugger, int arg1, pid_t arg2, result =ptrace (PTRACE_GETFPREGS , child,0 , regs);if (result ==-1 )return (-errno); -for (i =0 ; i <sizeof (regs)/sizeof (regs[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (regs); i++)ptrace (PTRACE_POKEDATA , debugger->pid, arg4 +4 * i, regs[i]);return (result);
@@ -93,7 +93,7 @@ long proxy_ptrace(struct debugger *debugger, int arg1, pid_t arg2, result =ptrace (PTRACE_GETFPXREGS , child,0 , regs);if (result ==-1 )return (-errno); -for (i =0 ; i <sizeof (regs)/sizeof (regs[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (regs); i++)ptrace (PTRACE_POKEDATA , debugger->pid, arg4 +4 * i, regs[i]);return (result);
@@ -109,7 +109,7 @@ long proxy_ptrace(struct debugger *debugger, int arg1, pid_t arg2, result =ptrace (PTRACE_GETREGS , child,0 , regs);if (result ==-1 )return (-errno); -for (i =0 ; i <sizeof (regs)/sizeof (regs[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (regs); i++)ptrace (PTRACE_POKEDATA , debugger->pid, arg4 +4 * i, regs[i]);return (result);
@@ -155,7 +155,7 @@ long proxy_ptrace(struct debugger *debugger, int arg1, pid_t arg2,long regs[FP_FRAME_SIZE ];int i; -for (i =0 ; i <sizeof (regs)/sizeof (regs[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (regs); i++) regs[i] =ptrace (PTRACE_PEEKDATA , debugger->pid, arg4 +4 * i,0 ); result =ptrace (PTRACE_SETFPREGS , child,0 , regs);
@@ -171,7 +171,7 @@ long proxy_ptrace(struct debugger *debugger, int arg1, pid_t arg2,long regs[FPX_FRAME_SIZE ];int i; -for (i =0 ; i <sizeof (regs)/sizeof (regs[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (regs); i++) regs[i] =ptrace (PTRACE_PEEKDATA , debugger->pid, arg4 +4 * i,0 ); result =ptrace (PTRACE_SETFPXREGS , child,0 , regs);
@@ -187,7 +187,7 @@ long proxy_ptrace(struct debugger *debugger, int arg1, pid_t arg2,long regs[FRAME_SIZE ];int i; -for (i =0 ; i <sizeof (regs)/sizeof (regs[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (regs); i++) regs[i] =ptrace (PTRACE_PEEKDATA , debugger->pid, arg4 +4 * i,0 ); result =ptrace (PTRACE_SETREGS , child,0 , regs);
drivers/char/synclink_gt.c +1 -1
@@ -4717,7 +4717,7 @@ static int register_test(struct slgt_info *info) {static unsigned short patterns[] = {0x0000 ,0xffff ,0xaaaa ,0x5555 ,0x6969 ,0x9696 }; -static unsigned int count =sizeof (patterns)/sizeof (patterns[0 ]); +static unsigned int count =ARRAY_SIZE (patterns);unsigned int i;int rc =0 ;
drivers/net/apne.c +1 -1
@@ -247,7 +247,7 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr) {0x00, NE_EN0_RSARHI}, {E8390_RREAD+E8390_START, NE_CMD}, }; -for (i =0 ; i <sizeof (program_seq)/sizeof (program_seq[0 ]); i++) { +for (i =0 ; i <ARRAY_SIZE (program_seq); i++) {outb (program_seq[i].value, ioaddr + program_seq[i].offset); }
drivers/net/arm/am79c961a.c +1 -1
@@ -414,7 +414,7 @@ static void am79c961_setmulticastlist (struct net_device *dev)/* * Update the multicast hash table */ -for (i =0 ; i <sizeof (multi_hash) /sizeof (multi_hash[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (multi_hash); i++)write_rreg (dev->base_addr, i +LADRL , multi_hash[i]);/*
drivers/net/atl1/atl1_hw.c +1 -1
@@ -603,7 +603,7 @@ static struct atl1_spi_flash_dev flash_table[] = {static void atl1_init_flash_opcode (struct atl1_hw *hw) { -if (hw->flash_vendor >=sizeof (flash_table) /sizeof (flash_table[0 ])) +if (hw->flash_vendor >=ARRAY_SIZE (flash_table)) hw->flash_vendor =0 ;/* ATMEL */ /* Init OP table */
drivers/net/cs89x0.c +3 -3
@@ -806,7 +806,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) i = cs8900_irq_map[0 ];#else /* Translate the IRQ using the IRQ mapping table. */ -if (i >=sizeof (cs8900_irq_map)/sizeof (cs8900_irq_map[0 ])) +if (i >=ARRAY_SIZE (cs8900_irq_map))printk ("\ncs89x0: invalid ISA interrupt number %d\n" , i);else i = cs8900_irq_map[i];
@@ -1247,11 +1247,11 @@ write_irq(struct net_device *dev, int chip_type, int irq)if (chip_type ==CS8900 ) {/* Search the mapping table for the corresponding IRQ pin. */ -for (i =0 ; i !=sizeof (cs8900_irq_map)/sizeof (cs8900_irq_map[0 ]); i++) +for (i =0 ; i !=ARRAY_SIZE (cs8900_irq_map); i++)if (cs8900_irq_map[i] == irq)break ;/* Not found */ -if (i ==sizeof (cs8900_irq_map)/sizeof (cs8900_irq_map[0 ])) +if (i ==ARRAY_SIZE (cs8900_irq_map)) i =3 ;writereg (dev,PP_CS8900_ISAINT , i); }else {
drivers/net/fec_8xx/fec_mii.c +2 -2
@@ -308,12 +308,12 @@ int fec_mii_phy_id_detect(struct net_device *dev)return -1 ; } -for (i =0 , phy = phy_info; i <sizeof (phy_info) /sizeof (phy_info[0 ]); +for (i =0 , phy = phy_info; i <ARRAY_SIZE (phy_info); i++, phy++)if (phy->id == (phy_hwid >>4 ) || phy->id ==0 )break ; -if (i >=sizeof (phy_info) /sizeof (phy_info[0 ])) { +if (i >=ARRAY_SIZE (phy_info)) { printk(KERN_ERR DRV_MODULE_NAME": %s PHY id 0x%08x is not supported!\n" , dev->name, phy_hwid);
drivers/net/ibm_emac/ibm_emac_debug.c +4 -4
@@ -132,7 +132,7 @@ void emac_dbg_register(int idx, struct ocp_enet_private *dev) {unsigned long flags; -if (idx >=sizeof (__emacs) /sizeof (__emacs[0 ])) { +if (idx >=ARRAY_SIZE (__emacs)) {printk (KERN_WARNING "invalid index %d when registering EMAC for debugging\n" , idx);
@@ -148,7 +148,7 @@ void mal_dbg_register(int idx, struct ibm_ocp_mal *mal) {unsigned long flags; -if (idx >=sizeof (__mals) /sizeof (__mals[0 ])) { +if (idx >=ARRAY_SIZE (__mals)) {printk (KERN_WARNING "invalid index %d when registering MAL for debugging\n" , idx);
@@ -167,11 +167,11 @@ void emac_dbg_dump_all(void)local_irq_save (flags); -for (i =0 ; i <sizeof (__mals) /sizeof (__mals[0 ]); ++i) +for (i =0 ; i <ARRAY_SIZE (__mals); ++i)if (__mals[i])emac_mal_dump (__mals[i]); -for (i =0 ; i <sizeof (__emacs) /sizeof (__emacs[0 ]); ++i) +for (i =0 ; i <ARRAY_SIZE (__emacs); ++i)if (__emacs[i])emac_mac_dump (i, __emacs[i]);
drivers/net/ne-h8300.c +1 -1
@@ -259,7 +259,7 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr) {E8390_RREAD+E8390_START, E8390_CMD}, }; -for (i =0 ; i <sizeof (program_seq)/sizeof (program_seq[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (program_seq); i++)outb_p (program_seq[i].value, ioaddr + program_seq[i].offset); }
drivers/net/ne.c +1 -1
@@ -377,7 +377,7 @@ static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr) {E8390_RREAD+E8390_START, E8390_CMD}, }; -for (i =0 ; i <sizeof (program_seq)/sizeof (program_seq[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (program_seq); i++)outb_p (program_seq[i].value, ioaddr + program_seq[i].offset); }
drivers/net/ne2.c +1 -1
@@ -432,7 +432,7 @@ static int __init ne2_probe1(struct net_device *dev, int slot) {E8390_RREAD+E8390_START, E8390_CMD}, }; -for (i =0 ; i <sizeof (program_seq)/sizeof (program_seq[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (program_seq); i++)outb_p (program_seq[i].value, base_addr + program_seq[i].offset);
drivers/net/ne2k-pci.c +1 -1
@@ -308,7 +308,7 @@ static int __devinit ne2k_pci_init_one (struct pci_dev *pdev, {0x00, EN0_RSARHI}, {E8390_RREAD+E8390_START, E8390_CMD}, }; -for (i =0 ; i <sizeof (program_seq)/sizeof (program_seq[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (program_seq); i++)outb (program_seq[i].value, ioaddr + program_seq[i].offset); }
drivers/net/netxen/netxen_nic_hw.c +1 -1
@@ -569,7 +569,7 @@ int netxen_is_flash_supported(struct netxen_adapter *adapter)/* if the flash size less than 4Mb, make huge war cry and die */ for (j =1 ; j <4 ; j++) { addr = j *NETXEN_NIC_WINDOW_MARGIN ; -for (i =0 ; i < (sizeof (locs) /sizeof (locs[0 ])); i++) { +for (i =0 ; i < (ARRAY_SIZE (locs)); i++) {if (netxen_rom_fast_read (adapter, locs[i], &val01) ==0 &&netxen_rom_fast_read (adapter, (addr + locs[i]), &val02) ==0 ) {
drivers/net/pcmcia/axnet_cs.c +1 -1
@@ -232,7 +232,7 @@ static int get_prom(struct pcmcia_device *link)axnet_reset_8390 (dev);mdelay (10 ); -for (i =0 ; i <sizeof (program_seq)/sizeof (program_seq[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (program_seq); i++)outb_p (program_seq[i].value, ioaddr + program_seq[i].offset);for (i =0 ; i <6 ; i +=2 ) {
drivers/net/pcmcia/pcnet_cs.c +1 -1
@@ -375,7 +375,7 @@ static hw_info_t *get_prom(struct pcmcia_device *link)pcnet_reset_8390 (dev);mdelay (10 ); -for (i =0 ; i <sizeof (program_seq)/sizeof (program_seq[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (program_seq); i++)outb_p (program_seq[i].value, ioaddr + program_seq[i].offset);for (i =0 ; i <32 ; i++)
drivers/net/sk98lin/skgesirq.c +1 -1
@@ -892,7 +892,7 @@ int Port) /* Which port should be checked */*/ RxCts =0 ; -for (i =0 ; i <sizeof (SkGeRxRegs)/sizeof (SkGeRxRegs[0 ]); i++) { +for (i =0 ; i <ARRAY_SIZE (SkGeRxRegs); i++) { (void )SkXmMacStatistic (pAC, IoC, Port, SkGeRxRegs[i], &RxTmp);
drivers/net/zorro8390.c +1 -1
@@ -191,7 +191,7 @@ static int __devinit zorro8390_init(struct net_device *dev, {0x00, NE_EN0_RSARHI}, {E8390_RREAD+E8390_START, NE_CMD}, }; -for (i =0 ; i <sizeof (program_seq)/sizeof (program_seq[0 ]); i++) { +for (i =0 ; i <ARRAY_SIZE (program_seq); i++) {z_writeb (program_seq[i].value, ioaddr + program_seq[i].offset); } }
drivers/serial/68328serial.c +2 -2
@@ -1429,10 +1429,10 @@ static void m68328_set_baud(void)USTCNT = ustcnt & ~USTCNT_TXEN ; again: -for (i =0 ; i <sizeof (baud_table) /sizeof (baud_table[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (baud_table); i++)if (baud_table[i] == m68328_console_baud)break ; -if (i >=sizeof (baud_table) /sizeof (baud_table[0 ])) { +if (i >=ARRAY_SIZE (baud_table)) { m68328_console_baud =9600 ; goto again; }
drivers/serial/mcfserial.c +1 -1
@@ -147,7 +147,7 @@ static int mcfrs_baud_table[] = { 9600, 19200, 38400, 57600, 115200, 230400, 460800, 0 };#define MCFRS_BAUD_TABLE_SIZE \ - (sizeof(mcfrs_baud_table)/sizeof(mcfrs_baud_table[0])) + (ARRAY_SIZE(mcfrs_baud_table))#ifdef CONFIG_MAGIC_SYSRQ
include/asm-parisc/mmzone.h +1 -1
@@ -51,7 +51,7 @@ static inline int pfn_to_nid(unsigned long pfn)return 0 ; i = pfn >>PFNNID_SHIFT ; -BUG_ON (i >=sizeof (pfnnid_map) /sizeof (pfnnid_map[0 ])); +BUG_ON (i >=ARRAY_SIZE (pfnnid_map)); r = pfnnid_map[i];BUG_ON (r ==0xff );
net/atm/proc.c +1 -1
@@ -175,7 +175,7 @@ static void pvc_info(struct seq_file *seq, struct atm_vcc *vcc)seq_printf (seq,"%3d %3d %5d %-3s %7d %-5s %7d %-6s" , vcc->dev->number,vcc->vpi,vcc->vci, - vcc->qos.aal >=sizeof (aal_name)/sizeof (aal_name[0 ]) ?"err" : + vcc->qos.aal >=ARRAY_SIZE (aal_name) ?"err" : aal_name[vcc->qos.aal],vcc->qos.rxtp.min_pcr, class_name[vcc->qos.rxtp.traffic_class],vcc->qos.txtp.min_pcr, class_name[vcc->qos.txtp.traffic_class]);
Please use this one instead. it also removes an unnecessary #define.
This patch changes code to use the ARRAY_SIZE macro. This patch is the result of:
find -name *.[chsS] | xargs sed -i "s/sizeof(\(\w*\))[ \t]*\/[ \t]*sizeof(\1\[0\])/ARRAY_SIZE(\1)/g"
arch/arm/kernel/dma-isa.c | 2 +- arch/powerpc/platforms/celleb/scc_sio.c | 2 +- arch/um/kernel/tt/ptproxy/ptrace.c | 12 ++++++------ drivers/char/synclink_gt.c | 2 +- drivers/net/apne.c | 2 +- drivers/net/arm/am79c961a.c | 2 +- drivers/net/atl1/atl1_hw.c | 2 +- drivers/net/cs89x0.c | 6 +++--- drivers/net/fec_8xx/fec_mii.c | 4 ++-- drivers/net/ibm_emac/ibm_emac_debug.c | 8 ++++---- drivers/net/ne-h8300.c | 2 +- drivers/net/ne.c | 2 +- drivers/net/ne2.c | 2 +- drivers/net/ne2k-pci.c | 2 +- drivers/net/netxen/netxen_nic_hw.c | 2 +- drivers/net/pcmcia/axnet_cs.c | 2 +- drivers/net/pcmcia/pcnet_cs.c | 2 +- drivers/net/sk98lin/skgesirq.c | 2 +- drivers/net/zorro8390.c | 2 +- drivers/serial/68328serial.c | 4 ++-- drivers/serial/mcfserial.c | 7 ++----- include/asm-parisc/mmzone.h | 2 +- net/atm/proc.c | 2 +- 23 files changed, 36 insertions(+), 39 deletions(-)
---
arch/arm/kernel/dma-isa.c +1 -1
@@ -216,7 +216,7 @@ void __init isa_init_dma(dma_t *dma)request_dma (DMA_ISA_CASCADE ,"cascade" ); -for (i =0 ; i <sizeof (dma_resources) /sizeof (dma_resources[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (dma_resources); i++)request_resource (&ioport_resource, dma_resources + i); } }
arch/powerpc/platforms/celleb/scc_sio.c +1 -1
@@ -52,7 +52,7 @@ static int txx9_serial_init(void)if (!node)return 0 ; -for (i =0 ; i <sizeof (txx9_scc_tab)/sizeof (txx9_scc_tab[0 ]); i++) { +for (i =0 ; i <ARRAY_SIZE (txx9_scc_tab); i++) {if (!(txx9_serial_bitmap & (1 <<i)))continue ;
arch/um/kernel/tt/ptproxy/ptrace.c +6 -6
@@ -77,7 +77,7 @@ long proxy_ptrace(struct debugger *debugger, int arg1, pid_t arg2, result =ptrace (PTRACE_GETFPREGS , child,0 , regs);if (result ==-1 )return (-errno); -for (i =0 ; i <sizeof (regs)/sizeof (regs[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (regs); i++)ptrace (PTRACE_POKEDATA , debugger->pid, arg4 +4 * i, regs[i]);return (result);
@@ -93,7 +93,7 @@ long proxy_ptrace(struct debugger *debugger, int arg1, pid_t arg2, result =ptrace (PTRACE_GETFPXREGS , child,0 , regs);if (result ==-1 )return (-errno); -for (i =0 ; i <sizeof (regs)/sizeof (regs[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (regs); i++)ptrace (PTRACE_POKEDATA , debugger->pid, arg4 +4 * i, regs[i]);return (result);
@@ -109,7 +109,7 @@ long proxy_ptrace(struct debugger *debugger, int arg1, pid_t arg2, result =ptrace (PTRACE_GETREGS , child,0 , regs);if (result ==-1 )return (-errno); -for (i =0 ; i <sizeof (regs)/sizeof (regs[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (regs); i++)ptrace (PTRACE_POKEDATA , debugger->pid, arg4 +4 * i, regs[i]);return (result);
@@ -155,7 +155,7 @@ long proxy_ptrace(struct debugger *debugger, int arg1, pid_t arg2,long regs[FP_FRAME_SIZE ];int i; -for (i =0 ; i <sizeof (regs)/sizeof (regs[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (regs); i++) regs[i] =ptrace (PTRACE_PEEKDATA , debugger->pid, arg4 +4 * i,0 ); result =ptrace (PTRACE_SETFPREGS , child,0 , regs);
@@ -171,7 +171,7 @@ long proxy_ptrace(struct debugger *debugger, int arg1, pid_t arg2,long regs[FPX_FRAME_SIZE ];int i; -for (i =0 ; i <sizeof (regs)/sizeof (regs[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (regs); i++) regs[i] =ptrace (PTRACE_PEEKDATA , debugger->pid, arg4 +4 * i,0 ); result =ptrace (PTRACE_SETFPXREGS , child,0 , regs);
@@ -187,7 +187,7 @@ long proxy_ptrace(struct debugger *debugger, int arg1, pid_t arg2,long regs[FRAME_SIZE ];int i; -for (i =0 ; i <sizeof (regs)/sizeof (regs[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (regs); i++) regs[i] =ptrace (PTRACE_PEEKDATA , debugger->pid, arg4 +4 * i,0 ); result =ptrace (PTRACE_SETREGS , child,0 , regs);
drivers/char/synclink_gt.c +1 -1
@@ -4717,7 +4717,7 @@ static int register_test(struct slgt_info *info) {static unsigned short patterns[] = {0x0000 ,0xffff ,0xaaaa ,0x5555 ,0x6969 ,0x9696 }; -static unsigned int count =sizeof (patterns)/sizeof (patterns[0 ]); +static unsigned int count =ARRAY_SIZE (patterns);unsigned int i;int rc =0 ;
drivers/net/apne.c +1 -1
@@ -247,7 +247,7 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr) {0x00, NE_EN0_RSARHI}, {E8390_RREAD+E8390_START, NE_CMD}, }; -for (i =0 ; i <sizeof (program_seq)/sizeof (program_seq[0 ]); i++) { +for (i =0 ; i <ARRAY_SIZE (program_seq); i++) {outb (program_seq[i].value, ioaddr + program_seq[i].offset); }
drivers/net/arm/am79c961a.c +1 -1
@@ -414,7 +414,7 @@ static void am79c961_setmulticastlist (struct net_device *dev)/* * Update the multicast hash table */ -for (i =0 ; i <sizeof (multi_hash) /sizeof (multi_hash[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (multi_hash); i++)write_rreg (dev->base_addr, i +LADRL , multi_hash[i]);/*
drivers/net/atl1/atl1_hw.c +1 -1
@@ -603,7 +603,7 @@ static struct atl1_spi_flash_dev flash_table[] = {static void atl1_init_flash_opcode (struct atl1_hw *hw) { -if (hw->flash_vendor >=sizeof (flash_table) /sizeof (flash_table[0 ])) +if (hw->flash_vendor >=ARRAY_SIZE (flash_table)) hw->flash_vendor =0 ;/* ATMEL */ /* Init OP table */
drivers/net/cs89x0.c +3 -3
@@ -806,7 +806,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) i = cs8900_irq_map[0 ];#else /* Translate the IRQ using the IRQ mapping table. */ -if (i >=sizeof (cs8900_irq_map)/sizeof (cs8900_irq_map[0 ])) +if (i >=ARRAY_SIZE (cs8900_irq_map))printk ("\ncs89x0: invalid ISA interrupt number %d\n" , i);else i = cs8900_irq_map[i];
@@ -1247,11 +1247,11 @@ write_irq(struct net_device *dev, int chip_type, int irq)if (chip_type ==CS8900 ) {/* Search the mapping table for the corresponding IRQ pin. */ -for (i =0 ; i !=sizeof (cs8900_irq_map)/sizeof (cs8900_irq_map[0 ]); i++) +for (i =0 ; i !=ARRAY_SIZE (cs8900_irq_map); i++)if (cs8900_irq_map[i] == irq)break ;/* Not found */ -if (i ==sizeof (cs8900_irq_map)/sizeof (cs8900_irq_map[0 ])) +if (i ==ARRAY_SIZE (cs8900_irq_map)) i =3 ;writereg (dev,PP_CS8900_ISAINT , i); }else {
drivers/net/fec_8xx/fec_mii.c +2 -2
@@ -308,12 +308,12 @@ int fec_mii_phy_id_detect(struct net_device *dev)return -1 ; } -for (i =0 , phy = phy_info; i <sizeof (phy_info) /sizeof (phy_info[0 ]); +for (i =0 , phy = phy_info; i <ARRAY_SIZE (phy_info); i++, phy++)if (phy->id == (phy_hwid >>4 ) || phy->id ==0 )break ; -if (i >=sizeof (phy_info) /sizeof (phy_info[0 ])) { +if (i >=ARRAY_SIZE (phy_info)) { printk(KERN_ERR DRV_MODULE_NAME": %s PHY id 0x%08x is not supported!\n" , dev->name, phy_hwid);
drivers/net/ibm_emac/ibm_emac_debug.c +4 -4
@@ -132,7 +132,7 @@ void emac_dbg_register(int idx, struct ocp_enet_private *dev) {unsigned long flags; -if (idx >=sizeof (__emacs) /sizeof (__emacs[0 ])) { +if (idx >=ARRAY_SIZE (__emacs)) {printk (KERN_WARNING "invalid index %d when registering EMAC for debugging\n" , idx);
@@ -148,7 +148,7 @@ void mal_dbg_register(int idx, struct ibm_ocp_mal *mal) {unsigned long flags; -if (idx >=sizeof (__mals) /sizeof (__mals[0 ])) { +if (idx >=ARRAY_SIZE (__mals)) {printk (KERN_WARNING "invalid index %d when registering MAL for debugging\n" , idx);
@@ -167,11 +167,11 @@ void emac_dbg_dump_all(void)local_irq_save (flags); -for (i =0 ; i <sizeof (__mals) /sizeof (__mals[0 ]); ++i) +for (i =0 ; i <ARRAY_SIZE (__mals); ++i)if (__mals[i])emac_mal_dump (__mals[i]); -for (i =0 ; i <sizeof (__emacs) /sizeof (__emacs[0 ]); ++i) +for (i =0 ; i <ARRAY_SIZE (__emacs); ++i)if (__emacs[i])emac_mac_dump (i, __emacs[i]);
drivers/net/ne-h8300.c +1 -1
@@ -259,7 +259,7 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr) {E8390_RREAD+E8390_START, E8390_CMD}, }; -for (i =0 ; i <sizeof (program_seq)/sizeof (program_seq[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (program_seq); i++)outb_p (program_seq[i].value, ioaddr + program_seq[i].offset); }
drivers/net/ne.c +1 -1
@@ -377,7 +377,7 @@ static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr) {E8390_RREAD+E8390_START, E8390_CMD}, }; -for (i =0 ; i <sizeof (program_seq)/sizeof (program_seq[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (program_seq); i++)outb_p (program_seq[i].value, ioaddr + program_seq[i].offset); }
drivers/net/ne2.c +1 -1
@@ -432,7 +432,7 @@ static int __init ne2_probe1(struct net_device *dev, int slot) {E8390_RREAD+E8390_START, E8390_CMD}, }; -for (i =0 ; i <sizeof (program_seq)/sizeof (program_seq[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (program_seq); i++)outb_p (program_seq[i].value, base_addr + program_seq[i].offset);
drivers/net/ne2k-pci.c +1 -1
@@ -308,7 +308,7 @@ static int __devinit ne2k_pci_init_one (struct pci_dev *pdev, {0x00, EN0_RSARHI}, {E8390_RREAD+E8390_START, E8390_CMD}, }; -for (i =0 ; i <sizeof (program_seq)/sizeof (program_seq[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (program_seq); i++)outb (program_seq[i].value, ioaddr + program_seq[i].offset); }
drivers/net/netxen/netxen_nic_hw.c +1 -1
@@ -569,7 +569,7 @@ int netxen_is_flash_supported(struct netxen_adapter *adapter)/* if the flash size less than 4Mb, make huge war cry and die */ for (j =1 ; j <4 ; j++) { addr = j *NETXEN_NIC_WINDOW_MARGIN ; -for (i =0 ; i < (sizeof (locs) /sizeof (locs[0 ])); i++) { +for (i =0 ; i < (ARRAY_SIZE (locs)); i++) {if (netxen_rom_fast_read (adapter, locs[i], &val01) ==0 &&netxen_rom_fast_read (adapter, (addr + locs[i]), &val02) ==0 ) {
drivers/net/pcmcia/axnet_cs.c +1 -1
@@ -232,7 +232,7 @@ static int get_prom(struct pcmcia_device *link)axnet_reset_8390 (dev);mdelay (10 ); -for (i =0 ; i <sizeof (program_seq)/sizeof (program_seq[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (program_seq); i++)outb_p (program_seq[i].value, ioaddr + program_seq[i].offset);for (i =0 ; i <6 ; i +=2 ) {
drivers/net/pcmcia/pcnet_cs.c +1 -1
@@ -375,7 +375,7 @@ static hw_info_t *get_prom(struct pcmcia_device *link)pcnet_reset_8390 (dev);mdelay (10 ); -for (i =0 ; i <sizeof (program_seq)/sizeof (program_seq[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (program_seq); i++)outb_p (program_seq[i].value, ioaddr + program_seq[i].offset);for (i =0 ; i <32 ; i++)
drivers/net/sk98lin/skgesirq.c +1 -1
@@ -892,7 +892,7 @@ int Port) /* Which port should be checked */*/ RxCts =0 ; -for (i =0 ; i <sizeof (SkGeRxRegs)/sizeof (SkGeRxRegs[0 ]); i++) { +for (i =0 ; i <ARRAY_SIZE (SkGeRxRegs); i++) { (void )SkXmMacStatistic (pAC, IoC, Port, SkGeRxRegs[i], &RxTmp);
drivers/net/zorro8390.c +1 -1
@@ -191,7 +191,7 @@ static int __devinit zorro8390_init(struct net_device *dev, {0x00, NE_EN0_RSARHI}, {E8390_RREAD+E8390_START, NE_CMD}, }; -for (i =0 ; i <sizeof (program_seq)/sizeof (program_seq[0 ]); i++) { +for (i =0 ; i <ARRAY_SIZE (program_seq); i++) {z_writeb (program_seq[i].value, ioaddr + program_seq[i].offset); } }
drivers/serial/68328serial.c +2 -2
@@ -1429,10 +1429,10 @@ static void m68328_set_baud(void)USTCNT = ustcnt & ~USTCNT_TXEN ; again: -for (i =0 ; i <sizeof (baud_table) /sizeof (baud_table[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (baud_table); i++)if (baud_table[i] == m68328_console_baud)break ; -if (i >=sizeof (baud_table) /sizeof (baud_table[0 ])) { +if (i >=ARRAY_SIZE (baud_table)) { m68328_console_baud =9600 ; goto again; }
drivers/serial/mcfserial.c +2 -5
@@ -146,9 +146,6 @@ static int mcfrs_baud_table[] = {0 ,50 ,75 ,110 ,134 ,150 ,200 ,300 ,600 ,1200 ,1800 ,2400 ,4800 ,9600 ,19200 ,38400 ,57600 ,115200 ,230400 ,460800 ,0 }; -#define MCFRS_BAUD_TABLE_SIZE \ - (sizeof(mcfrs_baud_table)/sizeof(mcfrs_baud_table[0])) -#ifdef CONFIG_MAGIC_SYSRQ /*
@@ -1879,10 +1876,10 @@ int mcfrs_console_setup(struct console *cp, char *arg)if (arg) n =simple_strtoul (arg,NULL ,0 ); -for (i =0 ; i <MCFRS_BAUD_TABLE_SIZE ; i++) +for (i =0 ; i <ARRAY_SIZE (mcfrs_baud_table); i++)if (mcfrs_baud_table[i] == n)break ; -if (i <MCFRS_BAUD_TABLE_SIZE ) { +if (i <ARRAY_SIZE (mcfrs_baud_table)) { mcfrs_console_baud = n; mcfrs_console_cbaud =0 ;if (i >15 ) {
include/asm-parisc/mmzone.h +1 -1
@@ -51,7 +51,7 @@ static inline int pfn_to_nid(unsigned long pfn)return 0 ; i = pfn >>PFNNID_SHIFT ; -BUG_ON (i >=sizeof (pfnnid_map) /sizeof (pfnnid_map[0 ])); +BUG_ON (i >=ARRAY_SIZE (pfnnid_map)); r = pfnnid_map[i];BUG_ON (r ==0xff );
net/atm/proc.c +1 -1
@@ -175,7 +175,7 @@ static void pvc_info(struct seq_file *seq, struct atm_vcc *vcc)seq_printf (seq,"%3d %3d %5d %-3s %7d %-5s %7d %-6s" , vcc->dev->number,vcc->vpi,vcc->vci, - vcc->qos.aal >=sizeof (aal_name)/sizeof (aal_name[0 ]) ?"err" : + vcc->qos.aal >=ARRAY_SIZE (aal_name) ?"err" : aal_name[vcc->qos.aal],vcc->qos.rxtp.min_pcr, class_name[vcc->qos.rxtp.traffic_class],vcc->qos.txtp.min_pcr, class_name[vcc->qos.txtp.traffic_class]);
Quoted 1 line · Roel Kluin
arch/um/kernel/tt/ptproxy/ptrace.c | 12 ++++++------
I don't know what you're diffing against, but this file is history in -mm, and will be gone in mainline after 2.6.23.
Jeff
Signature · 1 line
Work email - jdike at linux dot intel dot com
Quoted 8 lines · Jeff Dike
Quoted 1 line · Roel Kluin
arch/um/kernel/tt/ptproxy/ptrace.c| 12 ++++++------I don't know what you're diffing against, but this file is history in
-mm, and will be gone in mainline after 2.6.23.Jeff
Thanks for noting me. I usually pull the masters branch, so my previously submitted patches are against that. Apparently I have to apply the -mm patchset before sending patches. Is there a git branch to pull from for that?
Roel
Quoted 4 lines · On Fri, 28 Sep 2007 16:45:06 +0200 Roel Kluin wrote:
Quoted 3 lines · Jeff Dike
Quoted 1 line · Roel Kluin
arch/um/kernel/tt/ptproxy/ptrace.c| 12 ++++++------
Quoted 8 lines
Quoted 5 lines
I don't know what you're diffing against, but this file is history in
-mm, and will be gone in mainline after 2.6.23.Jeff
Thanks for noting me. I usually pull the masters branch, so my previously submitted patches are against that. Apparently I have to apply the -mm patchset before sending patches. Is there a git branch to pull from for that?
There's a git tree for -mm. See
http://git.kernel.org/?p=linux/kernel/git/smurf/linux-trees.git;a=summary
or use 'patch' to apply the patchset.
---
~Randy
Phaedrus says that Quality is about caring.
Quoted 4 lines · Roel Kluin
Thanks for noting me. I usually pull the masters branch, so my previously submitted patches are against that. Apparently I have to apply the -mm patchset before sending patches. Is there a git branch to pull from for that?
I have a lot of stuff in -mm, currently. So, if you're messing around inside UML, -mm is a good place to look.
Jeff
Signature · 1 line
Work email - jdike at linux dot intel dot com