Commit 81d79bec348ab06cba9ae9fc03eb015b6b83703a

Authored by Ahmed S. Darwish
Committed by Linus Torvalds
1 parent 6e6d74cfac

[PATCH] V850: user ARRAY_SIZE macro when appropriate

Use ARRAY_SIZE macro already defined in linux/kernel.h

Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
Cc: Miles Bader <uclinux-v850@lsi.nec.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 10 changed files with 13 additions and 15 deletions Side-by-side Diff

arch/v850/kernel/anna.c
... ... @@ -114,7 +114,7 @@
114 114 { "ST", IRQ_INTST(0), IRQ_INTST_NUM, 3, 5 },
115 115 { 0 }
116 116 };
117   -#define NUM_IRQ_INITS ((sizeof irq_inits / sizeof irq_inits[0]) - 1)
  117 +#define NUM_IRQ_INITS (ARRAY_SIZE(irq_inits) - 1)
118 118  
119 119 static struct hw_interrupt_type hw_itypes[NUM_IRQ_INITS];
120 120  
arch/v850/kernel/as85ep1.c
... ... @@ -142,7 +142,7 @@
142 142 { "ST", IRQ_INTST(0), IRQ_INTST_NUM, 3, 5 },
143 143 { 0 }
144 144 };
145   -#define NUM_IRQ_INITS ((sizeof irq_inits / sizeof irq_inits[0]) - 1)
  145 +#define NUM_IRQ_INITS (ARRAY_SIZE(irq_inits) - 1)
146 146  
147 147 static struct hw_interrupt_type hw_itypes[NUM_IRQ_INITS];
148 148  
arch/v850/kernel/fpga85e2c.c
... ... @@ -138,7 +138,7 @@
138 138 { "RPU", IRQ_RPU(0), IRQ_RPU_NUM, 1, 6 },
139 139 { 0 }
140 140 };
141   -#define NUM_IRQ_INITS ((sizeof irq_inits / sizeof irq_inits[0]) - 1)
  141 +#define NUM_IRQ_INITS (ARRAY_SIZE(irq_inits) - 1)
142 142  
143 143 struct hw_interrupt_type hw_itypes[NUM_IRQ_INITS];
144 144  
arch/v850/kernel/gbus_int.c
... ... @@ -16,6 +16,7 @@
16 16 #include <linux/irq.h>
17 17 #include <linux/interrupt.h>
18 18 #include <linux/signal.h>
  19 +#include <linux/kernel.h>
19 20  
20 21 #include <asm/machdep.h>
21 22  
... ... @@ -36,7 +37,7 @@
36 37 { 1, GBUS_INT_PRIORITY_HIGH },
37 38 { 3, GBUS_INT_PRIORITY_LOW }
38 39 };
39   -#define NUM_USED_GINTS (sizeof used_gint / sizeof used_gint[0])
  40 +#define NUM_USED_GINTS ARRAY_SIZE(used_gint)
40 41  
41 42 /* A table of which GINT is used by each GBUS interrupts (they are
42 43 assigned based on priority). */
... ... @@ -231,8 +232,7 @@
231 232 { "GBUS_INT", IRQ_GBUS_INT(0), IRQ_GBUS_INT_NUM, 1, 6},
232 233 { 0 }
233 234 };
234   -#define NUM_GBUS_IRQ_INITS \
235   - ((sizeof gbus_irq_inits / sizeof gbus_irq_inits[0]) - 1)
  235 +#define NUM_GBUS_IRQ_INITS (ARRAY_SIZE(gbus_irq_inits) - 1)
236 236  
237 237 static struct hw_interrupt_type gbus_hw_itypes[NUM_GBUS_IRQ_INITS];
238 238  
arch/v850/kernel/ma.c
... ... @@ -43,7 +43,7 @@
43 43 { "ST", IRQ_INTST(0), IRQ_INTST_NUM, 4, 5 },
44 44 { 0 }
45 45 };
46   -#define NUM_IRQ_INITS ((sizeof irq_inits / sizeof irq_inits[0]) - 1)
  46 +#define NUM_IRQ_INITS (ARRAY_SIZE(irq_inits) - 1)
47 47  
48 48 static struct hw_interrupt_type hw_itypes[NUM_IRQ_INITS];
49 49  
arch/v850/kernel/me2.c
... ... @@ -44,7 +44,7 @@
44 44 { "UBTITO", IRQ_INTUBTITO(0), IRQ_INTUBTITO_NUM, 5, 4 },
45 45 { 0 }
46 46 };
47   -#define NUM_IRQ_INITS ((sizeof irq_inits / sizeof irq_inits[0]) - 1)
  47 +#define NUM_IRQ_INITS (ARRAY_SIZE(irq_inits) - 1)
48 48  
49 49 static struct hw_interrupt_type hw_itypes[NUM_IRQ_INITS];
50 50  
arch/v850/kernel/rte_cb.c
... ... @@ -15,6 +15,7 @@
15 15 #include <linux/irq.h>
16 16 #include <linux/fs.h>
17 17 #include <linux/module.h>
  18 +#include <linux/kernel.h>
18 19  
19 20 #include <asm/machdep.h>
20 21 #include <asm/v850e_uart.h>
... ... @@ -176,8 +177,7 @@
176 177 #endif
177 178 { 0 }
178 179 };
179   -#define NUM_GBUS_IRQ_INITS \
180   - ((sizeof gbus_irq_inits / sizeof gbus_irq_inits[0]) - 1)
  180 +#define NUM_GBUS_IRQ_INITS (ARRAY_SIZE(gbus_irq_inits) - 1)
181 181  
182 182 static struct hw_interrupt_type gbus_hw_itypes[NUM_GBUS_IRQ_INITS];
183 183  
arch/v850/kernel/rte_mb_a_pci.c
... ... @@ -70,8 +70,7 @@
70 70 /* PCI slot 2 */
71 71 { 9, IRQ_MB_A_PCI2(0), 1 }
72 72 };
73   -#define NUM_MB_PCI_DEV_IRQS \
74   - (sizeof mb_pci_dev_irqs / sizeof mb_pci_dev_irqs[0])
  73 +#define NUM_MB_PCI_DEV_IRQS ARRAY_SIZE(mb_pci_dev_irqs)
75 74  
76 75  
77 76 /* PCI configuration primitives. */
arch/v850/kernel/rte_me2_cb.c
... ... @@ -170,8 +170,7 @@
170 170 { "CB_EXTTM2", IRQ_CB_EXTTM2, 1, 1, 6 },
171 171 { 0 }
172 172 };
173   -#define NUM_CB_PIC_IRQ_INITS \
174   - ((sizeof cb_pic_irq_inits / sizeof cb_pic_irq_inits[0]) - 1)
  173 +#define NUM_CB_PIC_IRQ_INITS (ARRAY_SIZE(cb_pic_irq_inits) - 1)
175 174  
176 175 static struct hw_interrupt_type cb_pic_hw_itypes[NUM_CB_PIC_IRQ_INITS];
177 176 static unsigned char cb_pic_active_irqs = 0;
arch/v850/kernel/teg.c
... ... @@ -43,7 +43,7 @@
43 43 { "ST", IRQ_INTST(0), IRQ_INTST_NUM, 1, 5 },
44 44 { 0 }
45 45 };
46   -#define NUM_IRQ_INITS ((sizeof irq_inits / sizeof irq_inits[0]) - 1)
  46 +#define NUM_IRQ_INITS (ARRAY_SIZE(irq_inits) - 1)
47 47  
48 48 static struct hw_interrupt_type hw_itypes[NUM_IRQ_INITS];
49 49