Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

genirq: percpu: allow interrupt type to be set at enable time

As request_percpu_irq() doesn't allow for a percpu interrupt to have
its type configured (it is generally impossible to configure it on all
CPUs at once), add a 'type' argument to enable_percpu_irq().

This allows some low-level, board specific init code to be switched to
a generic API.

[ tglx: Added WARN_ON argument ]

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Cc: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

authored by

Marc Zyngier and committed by
Thomas Gleixner
1e7c5fd2 31d9d9b6

+15 -2
+1 -1
include/linux/interrupt.h
··· 223 223 extern void disable_irq(unsigned int irq); 224 224 extern void disable_percpu_irq(unsigned int irq); 225 225 extern void enable_irq(unsigned int irq); 226 - extern void enable_percpu_irq(unsigned int irq); 226 + extern void enable_percpu_irq(unsigned int irq, unsigned int type); 227 227 228 228 /* The following three functions are for the core kernel use only. */ 229 229 #ifdef CONFIG_GENERIC_HARDIRQS
+14 -1
kernel/irq/manage.c
··· 1419 1419 } 1420 1420 EXPORT_SYMBOL_GPL(request_any_context_irq); 1421 1421 1422 - void enable_percpu_irq(unsigned int irq) 1422 + void enable_percpu_irq(unsigned int irq, unsigned int type) 1423 1423 { 1424 1424 unsigned int cpu = smp_processor_id(); 1425 1425 unsigned long flags; ··· 1428 1428 if (!desc) 1429 1429 return; 1430 1430 1431 + type &= IRQ_TYPE_SENSE_MASK; 1432 + if (type != IRQ_TYPE_NONE) { 1433 + int ret; 1434 + 1435 + ret = __irq_set_trigger(desc, irq, type); 1436 + 1437 + if (ret) { 1438 + WARN(1, "failed to set type for IRQ%d\n, irq"); 1439 + goto out; 1440 + } 1441 + } 1442 + 1431 1443 irq_percpu_enable(desc, cpu); 1444 + out: 1432 1445 irq_put_desc_unlock(desc, flags); 1433 1446 } 1434 1447