[MIPS] Use ARRAY_SIZE macro when appropriate

Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
Ahmed S. Darwish 2007-02-05 04:42:11 +02:00 committed by Ralf Baechle
parent 3e7f9b8254
commit 25b8ac3ba4
5 changed files with 10 additions and 7 deletions

View file

@ -77,7 +77,7 @@ static struct smatch * __init string_to_mach(const char *s)
{ {
int i; int i;
for (i = 0; i < (sizeof(mach_table) / sizeof (mach_table[0])); i++) { for (i = 0; i < ARRAY_SIZE(mach_table); i++) {
if (!strcmp(s, mach_table[i].arcname)) if (!strcmp(s, mach_table[i].arcname))
return &mach_table[i]; return &mach_table[i];
} }

View file

@ -434,7 +434,7 @@ void __init tx3927_setup(void)
/* DMA */ /* DMA */
tx3927_dmaptr->mcr = 0; tx3927_dmaptr->mcr = 0;
for (i = 0; i < sizeof(tx3927_dmaptr->ch) / sizeof(tx3927_dmaptr->ch[0]); i++) { for (i = 0; i < ARRAY_SIZE(tx3927_dmaptr->ch); i++) {
/* reset channel */ /* reset channel */
tx3927_dmaptr->ch[i].ccr = TX3927_DMA_CCR_CHRST; tx3927_dmaptr->ch[i].ccr = TX3927_DMA_CCR_CHRST;
tx3927_dmaptr->ch[i].ccr = 0; tx3927_dmaptr->ch[i].ccr = 0;

View file

@ -32,6 +32,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/kernel_stat.h> #include <linux/kernel_stat.h>
#include <linux/kernel.h>
#include <asm/gdb-stub.h> #include <asm/gdb-stub.h>
#include <asm/io.h> #include <asm/io.h>
@ -220,7 +221,7 @@ msc_irqmap_t __initdata msc_irqmap[] = {
{MSC01C_INT_TMR, MSC01_IRQ_EDGE, 0}, {MSC01C_INT_TMR, MSC01_IRQ_EDGE, 0},
{MSC01C_INT_PCI, MSC01_IRQ_LEVEL, 0}, {MSC01C_INT_PCI, MSC01_IRQ_LEVEL, 0},
}; };
int __initdata msc_nr_irqs = sizeof(msc_irqmap) / sizeof(*msc_irqmap); int __initdata msc_nr_irqs = ARRAY_SIZE(msc_irqmap);
msc_irqmap_t __initdata msc_eicirqmap[] = { msc_irqmap_t __initdata msc_eicirqmap[] = {
{MSC01E_INT_SW0, MSC01_IRQ_LEVEL, 0}, {MSC01E_INT_SW0, MSC01_IRQ_LEVEL, 0},
@ -231,7 +232,7 @@ msc_irqmap_t __initdata msc_eicirqmap[] = {
{MSC01E_INT_PERFCTR, MSC01_IRQ_LEVEL, 0}, {MSC01E_INT_PERFCTR, MSC01_IRQ_LEVEL, 0},
{MSC01E_INT_CPUCTR, MSC01_IRQ_LEVEL, 0} {MSC01E_INT_CPUCTR, MSC01_IRQ_LEVEL, 0}
}; };
int __initdata msc_nr_eicirqs = sizeof(msc_eicirqmap) / sizeof(*msc_eicirqmap); int __initdata msc_nr_eicirqs = ARRAY_SIZE(msc_eicirqmap);
void __init arch_init_irq(void) void __init arch_init_irq(void)
{ {

View file

@ -27,6 +27,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/kernel_stat.h> #include <linux/kernel_stat.h>
#include <linux/kernel.h>
#include <linux/random.h> #include <linux/random.h>
#include <asm/i8259.h> #include <asm/i8259.h>
@ -289,7 +290,7 @@ msc_irqmap_t __initdata msc_irqmap[] = {
{MSC01C_INT_TMR, MSC01_IRQ_EDGE, 0}, {MSC01C_INT_TMR, MSC01_IRQ_EDGE, 0},
{MSC01C_INT_PCI, MSC01_IRQ_LEVEL, 0}, {MSC01C_INT_PCI, MSC01_IRQ_LEVEL, 0},
}; };
int __initdata msc_nr_irqs = sizeof(msc_irqmap)/sizeof(msc_irqmap_t); int __initdata msc_nr_irqs = ARRAY_SIZE(msc_irqmap);
msc_irqmap_t __initdata msc_eicirqmap[] = { msc_irqmap_t __initdata msc_eicirqmap[] = {
{MSC01E_INT_SW0, MSC01_IRQ_LEVEL, 0}, {MSC01E_INT_SW0, MSC01_IRQ_LEVEL, 0},
@ -303,7 +304,7 @@ msc_irqmap_t __initdata msc_eicirqmap[] = {
{MSC01E_INT_PERFCTR, MSC01_IRQ_LEVEL, 0}, {MSC01E_INT_PERFCTR, MSC01_IRQ_LEVEL, 0},
{MSC01E_INT_CPUCTR, MSC01_IRQ_LEVEL, 0} {MSC01E_INT_CPUCTR, MSC01_IRQ_LEVEL, 0}
}; };
int __initdata msc_nr_eicirqs = sizeof(msc_eicirqmap)/sizeof(msc_irqmap_t); int __initdata msc_nr_eicirqs = ARRAY_SIZE(msc_eicirqmap);
void __init arch_init_irq(void) void __init arch_init_irq(void)
{ {

View file

@ -17,6 +17,7 @@
*/ */
#include <linux/init.h> #include <linux/init.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/kernel.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/i8259.h> #include <asm/i8259.h>
@ -143,7 +144,7 @@ int rockhopper_get_irq(struct pci_dev *dev, u8 pin, u8 slot)
if (bus == NULL) if (bus == NULL)
return -1; return -1;
for (i = 0; i < sizeof (int_map) / sizeof (int_map[0]); i++) { for (i = 0; i < ARRAY_SIZE(int_map); i++) {
if (int_map[i].bus == bus->number && int_map[i].slot == slot) { if (int_map[i].bus == bus->number && int_map[i].slot == slot) {
int line; int line;
for (line = 0; line < 4; line++) for (line = 0; line < 4; line++)