From 6c7a2676f594ca9a30203b4fd5dc26b53682cffe Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Fri, 9 Dec 2011 10:45:20 +0100 Subject: microblaze: Change NO_IRQ to 0 As has been discussed many times[1], Using NO_IRQ set to anything other than 0 is bug waiting to happen since many drivers follow the pattern "if (!irq)" for testing whether or not an irq has been set. This patch changes the Microblaze NO_IRQ setting from -1 to 0 to bring it in line with most of the rest of the kernel. It also prepares for Microblaze eventually supporting multiple interrupt controllers by breaking the assumption that hwirq# == Linux IRQ#. The Linux IRQ number is just a cookie with no guarantee of a direct relationship with the hardware irq arrangement. At this point, Microblaze interrupt handling only supports only one instance of one kind of interrupt controller (xilinx_intc). This change shouldn't affect any architecture code outside of the interrupt controller driver and the irq_of mapping. Updated to 3.2 and to use irq_data.hwirq by Rob Herring. Tested and fixed by Michal Simek. [1] http://lkml.org/lkml/2005/11/21/221 Signed-off-by: Grant Likely Signed-off-by: Rob Herring Signed-off-by: Michal Simek --- arch/microblaze/include/asm/irq.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'arch/microblaze/include/asm/irq.h') diff --git a/arch/microblaze/include/asm/irq.h b/arch/microblaze/include/asm/irq.h index cc54187f3d3..b116a825de7 100644 --- a/arch/microblaze/include/asm/irq.h +++ b/arch/microblaze/include/asm/irq.h @@ -9,7 +9,14 @@ #ifndef _ASM_MICROBLAZE_IRQ_H #define _ASM_MICROBLAZE_IRQ_H -#define NR_IRQS 32 + +/* + * Linux IRQ# is currently offset by one to map to the hardware + * irq number. So hardware IRQ0 maps to Linux irq 1. + */ +#define NO_IRQ_OFFSET 1 +#define IRQ_OFFSET NO_IRQ_OFFSET +#define NR_IRQS (32 + IRQ_OFFSET) #include /* This type is the placeholder for a hardware interrupt number. It has to @@ -20,7 +27,7 @@ typedef unsigned long irq_hw_number_t; extern unsigned int nr_irq; -#define NO_IRQ (-1) +#define NO_IRQ 0 struct pt_regs; extern void do_IRQ(struct pt_regs *regs); -- cgit v1.2.3-70-g09d2 From 18e3b1075b1bc4a6027a6612fe70a5c81c209ec7 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Wed, 21 Dec 2011 13:10:24 +0100 Subject: microblaze: Remove NO_IRQ from architecture NO_IRQ shouldn't be used by any driver. All Microblaze drivers are fixed that's why NO_IRQ can be removed. Also fix pci-common.c which has references to NO_IRQ removed. Signed-off-by: Michal Simek Reviewed-by: Ryan Mallon Acked-by: Grant Likely CC: Benjamin Herrenschmidt --- arch/microblaze/include/asm/irq.h | 2 -- arch/microblaze/pci/pci-common.c | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'arch/microblaze/include/asm/irq.h') diff --git a/arch/microblaze/include/asm/irq.h b/arch/microblaze/include/asm/irq.h index b116a825de7..a175132e449 100644 --- a/arch/microblaze/include/asm/irq.h +++ b/arch/microblaze/include/asm/irq.h @@ -27,8 +27,6 @@ typedef unsigned long irq_hw_number_t; extern unsigned int nr_irq; -#define NO_IRQ 0 - struct pt_regs; extern void do_IRQ(struct pt_regs *regs); diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c index db841c7b9d5..0d71b2ed810 100644 --- a/arch/microblaze/pci/pci-common.c +++ b/arch/microblaze/pci/pci-common.c @@ -242,7 +242,7 @@ int pci_read_irq_line(struct pci_dev *pci_dev) line, pin); virq = irq_create_mapping(NULL, line); - if (virq != NO_IRQ) + if (virq) irq_set_irq_type(virq, IRQ_TYPE_LEVEL_LOW); } else { pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n", @@ -253,7 +253,7 @@ int pci_read_irq_line(struct pci_dev *pci_dev) virq = irq_create_of_mapping(oirq.controller, oirq.specifier, oirq.size); } - if (virq == NO_IRQ) { + if (!virq) { pr_debug(" Failed to map !\n"); return -1; } -- cgit v1.2.3-70-g09d2