提交 81d79bec 编写于 作者: A Ahmed S. Darwish 提交者: Linus Torvalds

[PATCH] V850: user ARRAY_SIZE macro when appropriate

Use ARRAY_SIZE macro already defined in linux/kernel.h
Signed-off-by: NAhmed S. Darwish <darwish.07@gmail.com>
Cc: Miles Bader <uclinux-v850@lsi.nec.co.jp>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 6e6d74cf
...@@ -114,7 +114,7 @@ static struct v850e_intc_irq_init irq_inits[] = { ...@@ -114,7 +114,7 @@ static struct v850e_intc_irq_init irq_inits[] = {
{ "ST", IRQ_INTST(0), IRQ_INTST_NUM, 3, 5 }, { "ST", IRQ_INTST(0), IRQ_INTST_NUM, 3, 5 },
{ 0 } { 0 }
}; };
#define NUM_IRQ_INITS ((sizeof irq_inits / sizeof irq_inits[0]) - 1) #define NUM_IRQ_INITS (ARRAY_SIZE(irq_inits) - 1)
static struct hw_interrupt_type hw_itypes[NUM_IRQ_INITS]; static struct hw_interrupt_type hw_itypes[NUM_IRQ_INITS];
......
...@@ -142,7 +142,7 @@ static struct v850e_intc_irq_init irq_inits[] = { ...@@ -142,7 +142,7 @@ static struct v850e_intc_irq_init irq_inits[] = {
{ "ST", IRQ_INTST(0), IRQ_INTST_NUM, 3, 5 }, { "ST", IRQ_INTST(0), IRQ_INTST_NUM, 3, 5 },
{ 0 } { 0 }
}; };
#define NUM_IRQ_INITS ((sizeof irq_inits / sizeof irq_inits[0]) - 1) #define NUM_IRQ_INITS (ARRAY_SIZE(irq_inits) - 1)
static struct hw_interrupt_type hw_itypes[NUM_IRQ_INITS]; static struct hw_interrupt_type hw_itypes[NUM_IRQ_INITS];
......
...@@ -138,7 +138,7 @@ struct v850e_intc_irq_init irq_inits[] = { ...@@ -138,7 +138,7 @@ struct v850e_intc_irq_init irq_inits[] = {
{ "RPU", IRQ_RPU(0), IRQ_RPU_NUM, 1, 6 }, { "RPU", IRQ_RPU(0), IRQ_RPU_NUM, 1, 6 },
{ 0 } { 0 }
}; };
#define NUM_IRQ_INITS ((sizeof irq_inits / sizeof irq_inits[0]) - 1) #define NUM_IRQ_INITS (ARRAY_SIZE(irq_inits) - 1)
struct hw_interrupt_type hw_itypes[NUM_IRQ_INITS]; struct hw_interrupt_type hw_itypes[NUM_IRQ_INITS];
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/signal.h> #include <linux/signal.h>
#include <linux/kernel.h>
#include <asm/machdep.h> #include <asm/machdep.h>
...@@ -36,7 +37,7 @@ struct used_gint { ...@@ -36,7 +37,7 @@ struct used_gint {
{ 1, GBUS_INT_PRIORITY_HIGH }, { 1, GBUS_INT_PRIORITY_HIGH },
{ 3, GBUS_INT_PRIORITY_LOW } { 3, GBUS_INT_PRIORITY_LOW }
}; };
#define NUM_USED_GINTS (sizeof used_gint / sizeof used_gint[0]) #define NUM_USED_GINTS ARRAY_SIZE(used_gint)
/* A table of which GINT is used by each GBUS interrupts (they are /* A table of which GINT is used by each GBUS interrupts (they are
assigned based on priority). */ assigned based on priority). */
...@@ -231,8 +232,7 @@ struct gbus_int_irq_init gbus_irq_inits[] __initdata = { ...@@ -231,8 +232,7 @@ struct gbus_int_irq_init gbus_irq_inits[] __initdata = {
{ "GBUS_INT", IRQ_GBUS_INT(0), IRQ_GBUS_INT_NUM, 1, 6}, { "GBUS_INT", IRQ_GBUS_INT(0), IRQ_GBUS_INT_NUM, 1, 6},
{ 0 } { 0 }
}; };
#define NUM_GBUS_IRQ_INITS \ #define NUM_GBUS_IRQ_INITS (ARRAY_SIZE(gbus_irq_inits) - 1)
((sizeof gbus_irq_inits / sizeof gbus_irq_inits[0]) - 1)
static struct hw_interrupt_type gbus_hw_itypes[NUM_GBUS_IRQ_INITS]; static struct hw_interrupt_type gbus_hw_itypes[NUM_GBUS_IRQ_INITS];
......
...@@ -43,7 +43,7 @@ static struct v850e_intc_irq_init irq_inits[] = { ...@@ -43,7 +43,7 @@ static struct v850e_intc_irq_init irq_inits[] = {
{ "ST", IRQ_INTST(0), IRQ_INTST_NUM, 4, 5 }, { "ST", IRQ_INTST(0), IRQ_INTST_NUM, 4, 5 },
{ 0 } { 0 }
}; };
#define NUM_IRQ_INITS ((sizeof irq_inits / sizeof irq_inits[0]) - 1) #define NUM_IRQ_INITS (ARRAY_SIZE(irq_inits) - 1)
static struct hw_interrupt_type hw_itypes[NUM_IRQ_INITS]; static struct hw_interrupt_type hw_itypes[NUM_IRQ_INITS];
......
...@@ -44,7 +44,7 @@ static struct v850e_intc_irq_init irq_inits[] = { ...@@ -44,7 +44,7 @@ static struct v850e_intc_irq_init irq_inits[] = {
{ "UBTITO", IRQ_INTUBTITO(0), IRQ_INTUBTITO_NUM, 5, 4 }, { "UBTITO", IRQ_INTUBTITO(0), IRQ_INTUBTITO_NUM, 5, 4 },
{ 0 } { 0 }
}; };
#define NUM_IRQ_INITS ((sizeof irq_inits / sizeof irq_inits[0]) - 1) #define NUM_IRQ_INITS (ARRAY_SIZE(irq_inits) - 1)
static struct hw_interrupt_type hw_itypes[NUM_IRQ_INITS]; static struct hw_interrupt_type hw_itypes[NUM_IRQ_INITS];
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h>
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/v850e_uart.h> #include <asm/v850e_uart.h>
...@@ -176,8 +177,7 @@ static struct gbus_int_irq_init gbus_irq_inits[] = { ...@@ -176,8 +177,7 @@ static struct gbus_int_irq_init gbus_irq_inits[] = {
#endif #endif
{ 0 } { 0 }
}; };
#define NUM_GBUS_IRQ_INITS \ #define NUM_GBUS_IRQ_INITS (ARRAY_SIZE(gbus_irq_inits) - 1)
((sizeof gbus_irq_inits / sizeof gbus_irq_inits[0]) - 1)
static struct hw_interrupt_type gbus_hw_itypes[NUM_GBUS_IRQ_INITS]; static struct hw_interrupt_type gbus_hw_itypes[NUM_GBUS_IRQ_INITS];
......
...@@ -70,8 +70,7 @@ static struct mb_pci_dev_irq mb_pci_dev_irqs[] = { ...@@ -70,8 +70,7 @@ static struct mb_pci_dev_irq mb_pci_dev_irqs[] = {
/* PCI slot 2 */ /* PCI slot 2 */
{ 9, IRQ_MB_A_PCI2(0), 1 } { 9, IRQ_MB_A_PCI2(0), 1 }
}; };
#define NUM_MB_PCI_DEV_IRQS \ #define NUM_MB_PCI_DEV_IRQS ARRAY_SIZE(mb_pci_dev_irqs)
(sizeof mb_pci_dev_irqs / sizeof mb_pci_dev_irqs[0])
/* PCI configuration primitives. */ /* PCI configuration primitives. */
......
...@@ -170,8 +170,7 @@ static struct cb_pic_irq_init cb_pic_irq_inits[] = { ...@@ -170,8 +170,7 @@ static struct cb_pic_irq_init cb_pic_irq_inits[] = {
{ "CB_EXTTM2", IRQ_CB_EXTTM2, 1, 1, 6 }, { "CB_EXTTM2", IRQ_CB_EXTTM2, 1, 1, 6 },
{ 0 } { 0 }
}; };
#define NUM_CB_PIC_IRQ_INITS \ #define NUM_CB_PIC_IRQ_INITS (ARRAY_SIZE(cb_pic_irq_inits) - 1)
((sizeof cb_pic_irq_inits / sizeof cb_pic_irq_inits[0]) - 1)
static struct hw_interrupt_type cb_pic_hw_itypes[NUM_CB_PIC_IRQ_INITS]; static struct hw_interrupt_type cb_pic_hw_itypes[NUM_CB_PIC_IRQ_INITS];
static unsigned char cb_pic_active_irqs = 0; static unsigned char cb_pic_active_irqs = 0;
......
...@@ -43,7 +43,7 @@ static struct v850e_intc_irq_init irq_inits[] = { ...@@ -43,7 +43,7 @@ static struct v850e_intc_irq_init irq_inits[] = {
{ "ST", IRQ_INTST(0), IRQ_INTST_NUM, 1, 5 }, { "ST", IRQ_INTST(0), IRQ_INTST_NUM, 1, 5 },
{ 0 } { 0 }
}; };
#define NUM_IRQ_INITS ((sizeof irq_inits / sizeof irq_inits[0]) - 1) #define NUM_IRQ_INITS (ARRAY_SIZE(irq_inits) - 1)
static struct hw_interrupt_type hw_itypes[NUM_IRQ_INITS]; static struct hw_interrupt_type hw_itypes[NUM_IRQ_INITS];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册