mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
powerpc: Remove all usages of NO_IRQ
NO_IRQ has been == 0 on powerpc for just over ten years (since commit
0ebfff1491 ("[POWERPC] Add new interrupt mapping core and change
platforms to use it")). It's also 0 on most other arches.
Although it's fairly harmless, every now and then it causes confusion
when a driver is built on powerpc and another arch which doesn't define
NO_IRQ. There's at least 6 definitions of NO_IRQ in drivers/, at least
some of which are to work around that problem.
So we'd like to remove it. This is fairly trivial in the arch code, we
just convert:
if (irq == NO_IRQ) to if (!irq)
if (irq != NO_IRQ) to if (irq)
irq = NO_IRQ; to irq = 0;
return NO_IRQ; to return 0;
And a few other odd cases as well.
At least for now we keep the #define NO_IRQ, because there is driver
code that uses NO_IRQ and the fixes to remove those will go via other
trees.
Note we also change some occurrences in PPC sound drivers, drivers/ps3,
and drivers/macintosh.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
@@ -61,7 +61,7 @@ struct machdep_calls {
|
||||
|
||||
void (*init_IRQ)(void);
|
||||
|
||||
/* Return an irq, or NO_IRQ to indicate there are none pending. */
|
||||
/* Return an irq, or 0 to indicate there are none pending. */
|
||||
unsigned int (*get_irq)(void);
|
||||
|
||||
/* PCI stuff */
|
||||
|
||||
@@ -122,9 +122,9 @@ static inline void mpic_msgr_set_destination(struct mpic_msgr *msgr,
|
||||
* @msgr: the message register whose IRQ is to be returned
|
||||
*
|
||||
* Returns the IRQ number associated with the given message register.
|
||||
* NO_IRQ is returned if this message register is not capable of
|
||||
* receiving interrupts. What message register can and cannot receive
|
||||
* interrupts is specified in the device tree for the system.
|
||||
* 0 is returned if this message register is not capable of receiving
|
||||
* interrupts. What message register can and cannot receive interrupts is
|
||||
* specified in the device tree for the system.
|
||||
*/
|
||||
static inline int mpic_msgr_get_irq(struct mpic_msgr *msgr)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ static int parport_pc_find_nonpci_ports (int autoirq, int autodma)
|
||||
io1 = prop[1]; io2 = prop[2];
|
||||
|
||||
virq = irq_of_parse_and_map(np, 0);
|
||||
if (virq == NO_IRQ)
|
||||
if (!virq)
|
||||
continue;
|
||||
|
||||
if (parport_pc_probe_port(io1, io2, virq, autodma, NULL, 0)
|
||||
|
||||
@@ -227,7 +227,7 @@ int ibmebus_request_irq(u32 ist, irq_handler_t handler,
|
||||
{
|
||||
unsigned int irq = irq_create_mapping(NULL, ist);
|
||||
|
||||
if (irq == NO_IRQ)
|
||||
if (!irq)
|
||||
return -EINVAL;
|
||||
|
||||
return request_irq(irq, handler, irq_flags, devname, dev_id);
|
||||
|
||||
@@ -519,7 +519,7 @@ void __do_irq(struct pt_regs *regs)
|
||||
may_hard_irq_enable();
|
||||
|
||||
/* And finally process it */
|
||||
if (unlikely(irq == NO_IRQ))
|
||||
if (unlikely(!irq))
|
||||
__this_cpu_inc(irq_stat.spurious_irqs);
|
||||
else
|
||||
generic_handle_irq(irq);
|
||||
|
||||
@@ -193,10 +193,10 @@ static int __init add_legacy_soc_port(struct device_node *np,
|
||||
*/
|
||||
if (tsi && !strcmp(tsi->type, "tsi-bridge"))
|
||||
return add_legacy_port(np, -1, UPIO_TSI, addr, addr,
|
||||
NO_IRQ, legacy_port_flags, 0);
|
||||
0, legacy_port_flags, 0);
|
||||
else
|
||||
return add_legacy_port(np, -1, UPIO_MEM, addr, addr,
|
||||
NO_IRQ, legacy_port_flags, 0);
|
||||
0, legacy_port_flags, 0);
|
||||
}
|
||||
|
||||
static int __init add_legacy_isa_port(struct device_node *np,
|
||||
@@ -242,7 +242,7 @@ static int __init add_legacy_isa_port(struct device_node *np,
|
||||
|
||||
/* Add port, irq will be dealt with later */
|
||||
return add_legacy_port(np, index, UPIO_PORT, be32_to_cpu(reg[1]),
|
||||
taddr, NO_IRQ, legacy_port_flags, 0);
|
||||
taddr, 0, legacy_port_flags, 0);
|
||||
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ static int __init add_legacy_pci_port(struct device_node *np,
|
||||
/* Add port, irq will be dealt with later. We passed a translated
|
||||
* IO port value. It will be fixed up later along with the irq
|
||||
*/
|
||||
return add_legacy_port(np, index, iotype, base, addr, NO_IRQ,
|
||||
return add_legacy_port(np, index, iotype, base, addr, 0,
|
||||
legacy_port_flags, np != pci_dev);
|
||||
}
|
||||
#endif
|
||||
@@ -462,14 +462,14 @@ static void __init fixup_port_irq(int index,
|
||||
DBG("fixup_port_irq(%d)\n", index);
|
||||
|
||||
virq = irq_of_parse_and_map(np, 0);
|
||||
if (virq == NO_IRQ && legacy_serial_infos[index].irq_check_parent) {
|
||||
if (!virq && legacy_serial_infos[index].irq_check_parent) {
|
||||
np = of_get_parent(np);
|
||||
if (np == NULL)
|
||||
return;
|
||||
virq = irq_of_parse_and_map(np, 0);
|
||||
of_node_put(np);
|
||||
}
|
||||
if (virq == NO_IRQ)
|
||||
if (!virq)
|
||||
return;
|
||||
|
||||
port->irq = virq;
|
||||
@@ -543,7 +543,7 @@ static int __init serial_dev_init(void)
|
||||
struct plat_serial8250_port *port = &legacy_serial_ports[i];
|
||||
struct device_node *np = legacy_serial_infos[i].np;
|
||||
|
||||
if (port->irq == NO_IRQ)
|
||||
if (!port->irq)
|
||||
fixup_port_irq(i, np, port);
|
||||
if (port->iotype == UPIO_PORT)
|
||||
fixup_port_pio(i, np, port);
|
||||
|
||||
@@ -360,7 +360,7 @@ static 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",
|
||||
@@ -369,7 +369,8 @@ static int pci_read_irq_line(struct pci_dev *pci_dev)
|
||||
|
||||
virq = irq_create_of_mapping(&oirq);
|
||||
}
|
||||
if(virq == NO_IRQ) {
|
||||
|
||||
if (!virq) {
|
||||
pr_debug(" Failed to map !\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
|
||||
dev->hdr_type = PCI_HEADER_TYPE_NORMAL;
|
||||
dev->rom_base_reg = PCI_ROM_ADDRESS;
|
||||
/* Maybe do a default OF mapping here */
|
||||
dev->irq = NO_IRQ;
|
||||
dev->irq = 0;
|
||||
}
|
||||
|
||||
of_pci_parse_addrs(node, dev);
|
||||
|
||||
@@ -204,7 +204,7 @@ static void pika_setup_critical_temp(struct device_node *np,
|
||||
i2c_smbus_write_byte_data(client, 3, 0); /* Tlow */
|
||||
|
||||
irq = irq_of_parse_and_map(np, 0);
|
||||
if (irq == NO_IRQ) {
|
||||
if (!irq) {
|
||||
printk(KERN_ERR __FILE__ ": Unable to get ad7414 irq\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ cpld_pic_get_irq(int offset, u8 ignore, u8 __iomem *statusp,
|
||||
status |= (ignore | mask);
|
||||
|
||||
if (status == 0xff)
|
||||
return NO_IRQ;
|
||||
return 0;
|
||||
|
||||
cpld_irq = ffz(status) + offset;
|
||||
|
||||
@@ -110,14 +110,14 @@ static void cpld_pic_cascade(struct irq_desc *desc)
|
||||
|
||||
irq = cpld_pic_get_irq(0, PCI_IGNORE, &cpld_regs->pci_status,
|
||||
&cpld_regs->pci_mask);
|
||||
if (irq != NO_IRQ) {
|
||||
if (irq) {
|
||||
generic_handle_irq(irq);
|
||||
return;
|
||||
}
|
||||
|
||||
irq = cpld_pic_get_irq(8, MISC_IGNORE, &cpld_regs->misc_status,
|
||||
&cpld_regs->misc_mask);
|
||||
if (irq != NO_IRQ) {
|
||||
if (irq) {
|
||||
generic_handle_irq(irq);
|
||||
return;
|
||||
}
|
||||
@@ -177,7 +177,7 @@ mpc5121_ads_cpld_pic_init(void)
|
||||
goto end;
|
||||
|
||||
cascade_irq = irq_of_parse_and_map(np, 0);
|
||||
if (cascade_irq == NO_IRQ)
|
||||
if (!cascade_irq)
|
||||
goto end;
|
||||
|
||||
/*
|
||||
|
||||
@@ -473,7 +473,7 @@ static int mpc512x_lpbfifo_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
lpbfifo.irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
|
||||
if (lpbfifo.irq == NO_IRQ) {
|
||||
if (!lpbfifo.irq) {
|
||||
dev_err(&pdev->dev, "mapping irq failed\n");
|
||||
ret = -ENODEV;
|
||||
goto err0;
|
||||
|
||||
@@ -511,7 +511,7 @@ unsigned int mpc52xx_get_irq(void)
|
||||
irq |= (MPC52xx_IRQ_L1_PERP << MPC52xx_IRQ_L1_OFFSET);
|
||||
}
|
||||
} else {
|
||||
return NO_IRQ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return irq_linear_revmap(mpc52xx_irqhost, irq);
|
||||
|
||||
@@ -131,7 +131,7 @@ int __init pq2ads_pci_init_irq(void)
|
||||
}
|
||||
|
||||
irq = irq_of_parse_and_map(np, 0);
|
||||
if (irq == NO_IRQ) {
|
||||
if (!irq) {
|
||||
printk(KERN_ERR "No interrupt in pci pic node.\n");
|
||||
of_node_put(np);
|
||||
goto out;
|
||||
|
||||
@@ -89,7 +89,7 @@ static int __init of_fsl_spi_probe(char *type, char *compatible, u32 sysclk,
|
||||
goto err;
|
||||
|
||||
ret = of_irq_to_resource(np, 0, &res[1]);
|
||||
if (ret == NO_IRQ)
|
||||
if (!ret)
|
||||
goto err;
|
||||
|
||||
pdev = platform_device_alloc("mpc83xx_spi", i);
|
||||
|
||||
@@ -352,7 +352,7 @@ static int pmc_probe(struct platform_device *ofdev)
|
||||
return -ENODEV;
|
||||
|
||||
pmc_irq = irq_of_parse_and_map(np, 0);
|
||||
if (pmc_irq != NO_IRQ) {
|
||||
if (pmc_irq) {
|
||||
ret = request_irq(pmc_irq, pmc_irq_handler, IRQF_SHARED,
|
||||
"pmc", ofdev);
|
||||
|
||||
@@ -400,7 +400,7 @@ out_syscr:
|
||||
out_pmc:
|
||||
iounmap(pmc_regs);
|
||||
out:
|
||||
if (pmc_irq != NO_IRQ)
|
||||
if (pmc_irq)
|
||||
free_irq(pmc_irq, ofdev);
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -76,7 +76,7 @@ void __init mpc85xx_cpm2_pic_init(void)
|
||||
return;
|
||||
}
|
||||
irq = irq_of_parse_and_map(np, 0);
|
||||
if (irq == NO_IRQ) {
|
||||
if (!irq) {
|
||||
of_node_put(np);
|
||||
printk(KERN_ERR "PIC init: got no IRQ for cpm cascade\n");
|
||||
return;
|
||||
|
||||
@@ -196,7 +196,7 @@ static void mpc85xx_8259_cascade_handler(struct irq_desc *desc)
|
||||
{
|
||||
unsigned int cascade_irq = i8259_irq();
|
||||
|
||||
if (cascade_irq != NO_IRQ)
|
||||
if (cascade_irq)
|
||||
/* handle an interrupt from the 8259 */
|
||||
generic_handle_irq(cascade_irq);
|
||||
|
||||
@@ -247,7 +247,7 @@ static int mpc85xx_cds_8259_attach(void)
|
||||
}
|
||||
|
||||
cascade_irq = irq_of_parse_and_map(cascade_node, 0);
|
||||
if (cascade_irq == NO_IRQ) {
|
||||
if (!cascade_irq) {
|
||||
printk(KERN_ERR "Failed to map cascade interrupt\n");
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ static void mpc85xx_8259_cascade(struct irq_desc *desc)
|
||||
struct irq_chip *chip = irq_desc_get_chip(desc);
|
||||
unsigned int cascade_irq = i8259_irq();
|
||||
|
||||
if (cascade_irq != NO_IRQ) {
|
||||
if (cascade_irq) {
|
||||
generic_handle_irq(cascade_irq);
|
||||
}
|
||||
chip->irq_eoi(&desc->irq_data);
|
||||
@@ -96,7 +96,7 @@ void __init mpc85xx_ds_pic_init(void)
|
||||
}
|
||||
|
||||
cascade_irq = irq_of_parse_and_map(cascade_node, 0);
|
||||
if (cascade_irq == NO_IRQ) {
|
||||
if (!cascade_irq) {
|
||||
printk(KERN_ERR "Failed to map cascade interrupt\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ static inline unsigned int socrates_fpga_pic_get_irq(unsigned int irq)
|
||||
break;
|
||||
}
|
||||
if (i == 3)
|
||||
return NO_IRQ;
|
||||
return 0;
|
||||
|
||||
raw_spin_lock_irqsave(&socrates_fpga_pic_lock, flags);
|
||||
cause = socrates_fpga_pic_read(FPGA_PIC_IRQMASK(i));
|
||||
@@ -103,7 +103,7 @@ static void socrates_fpga_pic_cascade(struct irq_desc *desc)
|
||||
*/
|
||||
cascade_irq = socrates_fpga_pic_get_irq(irq);
|
||||
|
||||
if (cascade_irq != NO_IRQ)
|
||||
if (cascade_irq)
|
||||
generic_handle_irq(cascade_irq);
|
||||
chip->irq_eoi(&desc->irq_data);
|
||||
}
|
||||
@@ -292,7 +292,7 @@ void socrates_fpga_pic_init(struct device_node *pic)
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
socrates_fpga_irqs[i] = irq_of_parse_and_map(pic, i);
|
||||
if (socrates_fpga_irqs[i] == NO_IRQ) {
|
||||
if (!socrates_fpga_irqs[i]) {
|
||||
pr_warning("FPGA PIC: can't get irq%d.\n", i);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ static void mpc86xx_8259_cascade(struct irq_desc *desc)
|
||||
struct irq_chip *chip = irq_desc_get_chip(desc);
|
||||
unsigned int cascade_irq = i8259_irq();
|
||||
|
||||
if (cascade_irq != NO_IRQ)
|
||||
if (cascade_irq)
|
||||
generic_handle_irq(cascade_irq);
|
||||
|
||||
chip->irq_eoi(&desc->irq_data);
|
||||
@@ -58,7 +58,7 @@ void __init mpc86xx_init_irq(void)
|
||||
}
|
||||
|
||||
cascade_irq = irq_of_parse_and_map(cascade_node, 0);
|
||||
if (cascade_irq == NO_IRQ) {
|
||||
if (!cascade_irq) {
|
||||
printk(KERN_ERR "Failed to map cascade interrupt\n");
|
||||
return;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user