Skip to content

Commit ef24ba7

Browse files
committed
powerpc: Remove all usages of NO_IRQ
NO_IRQ has been == 0 on powerpc for just over ten years (since commit 0ebfff1 ("[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>
1 parent 9d82fd2 commit ef24ba7

80 files changed

Lines changed: 204 additions & 200 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎arch/powerpc/include/asm/machdep.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ struct machdep_calls {
6161

6262
void (*init_IRQ)(void);
6363

64-
/* Return an irq, or NO_IRQ to indicate there are none pending. */
64+
/* Return an irq, or 0 to indicate there are none pending. */
6565
unsigned int (*get_irq)(void);
6666

6767
/* PCI stuff */

‎arch/powerpc/include/asm/mpic_msgr.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ static inline void mpic_msgr_set_destination(struct mpic_msgr *msgr,
122122
* @msgr: the message register whose IRQ is to be returned
123123
*
124124
* Returns the IRQ number associated with the given message register.
125-
* NO_IRQ is returned if this message register is not capable of
126-
* receiving interrupts. What message register can and cannot receive
127-
* interrupts is specified in the device tree for the system.
125+
* 0 is returned if this message register is not capable of receiving
126+
* interrupts. What message register can and cannot receive interrupts is
127+
* specified in the device tree for the system.
128128
*/
129129
static inline int mpic_msgr_get_irq(struct mpic_msgr *msgr)
130130
{

‎arch/powerpc/include/asm/parport.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static int parport_pc_find_nonpci_ports (int autoirq, int autodma)
2828
io1 = prop[1]; io2 = prop[2];
2929

3030
virq = irq_of_parse_and_map(np, 0);
31-
if (virq == NO_IRQ)
31+
if (!virq)
3232
continue;
3333

3434
if (parport_pc_probe_port(io1, io2, virq, autodma, NULL, 0)

‎arch/powerpc/kernel/ibmebus.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ int ibmebus_request_irq(u32 ist, irq_handler_t handler,
227227
{
228228
unsigned int irq = irq_create_mapping(NULL, ist);
229229

230-
if (irq == NO_IRQ)
230+
if (!irq)
231231
return -EINVAL;
232232

233233
return request_irq(irq, handler, irq_flags, devname, dev_id);

‎arch/powerpc/kernel/irq.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ void __do_irq(struct pt_regs *regs)
519519
may_hard_irq_enable();
520520

521521
/* And finally process it */
522-
if (unlikely(irq == NO_IRQ))
522+
if (unlikely(!irq))
523523
__this_cpu_inc(irq_stat.spurious_irqs);
524524
else
525525
generic_handle_irq(irq);

‎arch/powerpc/kernel/legacy_serial.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@ static int __init add_legacy_soc_port(struct device_node *np,
193193
*/
194194
if (tsi && !strcmp(tsi->type, "tsi-bridge"))
195195
return add_legacy_port(np, -1, UPIO_TSI, addr, addr,
196-
NO_IRQ, legacy_port_flags, 0);
196+
0, legacy_port_flags, 0);
197197
else
198198
return add_legacy_port(np, -1, UPIO_MEM, addr, addr,
199-
NO_IRQ, legacy_port_flags, 0);
199+
0, legacy_port_flags, 0);
200200
}
201201

202202
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,
242242

243243
/* Add port, irq will be dealt with later */
244244
return add_legacy_port(np, index, UPIO_PORT, be32_to_cpu(reg[1]),
245-
taddr, NO_IRQ, legacy_port_flags, 0);
245+
taddr, 0, legacy_port_flags, 0);
246246

247247
}
248248

@@ -314,7 +314,7 @@ static int __init add_legacy_pci_port(struct device_node *np,
314314
/* Add port, irq will be dealt with later. We passed a translated
315315
* IO port value. It will be fixed up later along with the irq
316316
*/
317-
return add_legacy_port(np, index, iotype, base, addr, NO_IRQ,
317+
return add_legacy_port(np, index, iotype, base, addr, 0,
318318
legacy_port_flags, np != pci_dev);
319319
}
320320
#endif
@@ -462,14 +462,14 @@ static void __init fixup_port_irq(int index,
462462
DBG("fixup_port_irq(%d)\n", index);
463463

464464
virq = irq_of_parse_and_map(np, 0);
465-
if (virq == NO_IRQ && legacy_serial_infos[index].irq_check_parent) {
465+
if (!virq && legacy_serial_infos[index].irq_check_parent) {
466466
np = of_get_parent(np);
467467
if (np == NULL)
468468
return;
469469
virq = irq_of_parse_and_map(np, 0);
470470
of_node_put(np);
471471
}
472-
if (virq == NO_IRQ)
472+
if (!virq)
473473
return;
474474

475475
port->irq = virq;
@@ -543,7 +543,7 @@ static int __init serial_dev_init(void)
543543
struct plat_serial8250_port *port = &legacy_serial_ports[i];
544544
struct device_node *np = legacy_serial_infos[i].np;
545545

546-
if (port->irq == NO_IRQ)
546+
if (!port->irq)
547547
fixup_port_irq(i, np, port);
548548
if (port->iotype == UPIO_PORT)
549549
fixup_port_pio(i, np, port);

‎arch/powerpc/kernel/pci-common.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ static int pci_read_irq_line(struct pci_dev *pci_dev)
360360
line, pin);
361361

362362
virq = irq_create_mapping(NULL, line);
363-
if (virq != NO_IRQ)
363+
if (virq)
364364
irq_set_irq_type(virq, IRQ_TYPE_LEVEL_LOW);
365365
} else {
366366
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)
369369

370370
virq = irq_create_of_mapping(&oirq);
371371
}
372-
if(virq == NO_IRQ) {
372+
373+
if (!virq) {
373374
pr_debug(" Failed to map !\n");
374375
return -1;
375376
}

‎arch/powerpc/kernel/pci_of_scan.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
178178
dev->hdr_type = PCI_HEADER_TYPE_NORMAL;
179179
dev->rom_base_reg = PCI_ROM_ADDRESS;
180180
/* Maybe do a default OF mapping here */
181-
dev->irq = NO_IRQ;
181+
dev->irq = 0;
182182
}
183183

184184
of_pci_parse_addrs(node, dev);

‎arch/powerpc/platforms/44x/warp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ static void pika_setup_critical_temp(struct device_node *np,
204204
i2c_smbus_write_byte_data(client, 3, 0); /* Tlow */
205205

206206
irq = irq_of_parse_and_map(np, 0);
207-
if (irq == NO_IRQ) {
207+
if (!irq) {
208208
printk(KERN_ERR __FILE__ ": Unable to get ad7414 irq\n");
209209
return;
210210
}

‎arch/powerpc/platforms/512x/mpc5121_ads_cpld.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ cpld_pic_get_irq(int offset, u8 ignore, u8 __iomem *statusp,
9797
status |= (ignore | mask);
9898

9999
if (status == 0xff)
100-
return NO_IRQ;
100+
return 0;
101101

102102
cpld_irq = ffz(status) + offset;
103103

@@ -110,14 +110,14 @@ static void cpld_pic_cascade(struct irq_desc *desc)
110110

111111
irq = cpld_pic_get_irq(0, PCI_IGNORE, &cpld_regs->pci_status,
112112
&cpld_regs->pci_mask);
113-
if (irq != NO_IRQ) {
113+
if (irq) {
114114
generic_handle_irq(irq);
115115
return;
116116
}
117117

118118
irq = cpld_pic_get_irq(8, MISC_IGNORE, &cpld_regs->misc_status,
119119
&cpld_regs->misc_mask);
120-
if (irq != NO_IRQ) {
120+
if (irq) {
121121
generic_handle_irq(irq);
122122
return;
123123
}
@@ -177,7 +177,7 @@ mpc5121_ads_cpld_pic_init(void)
177177
goto end;
178178

179179
cascade_irq = irq_of_parse_and_map(np, 0);
180-
if (cascade_irq == NO_IRQ)
180+
if (!cascade_irq)
181181
goto end;
182182

183183
/*

0 commit comments

Comments
 (0)