Skip to content

Commit 1e7c5fd

Browse files
Marc ZyngierKAGA-KOKO
authored andcommitted
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 <[email protected]> Cc: Abhijeet Dharmapurikar <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]>
1 parent 31d9d9b commit 1e7c5fd

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

include/linux/interrupt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ extern void disable_irq_nosync(unsigned int irq);
223223
extern void disable_irq(unsigned int irq);
224224
extern void disable_percpu_irq(unsigned int irq);
225225
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);
227227

228228
/* The following three functions are for the core kernel use only. */
229229
#ifdef CONFIG_GENERIC_HARDIRQS

kernel/irq/manage.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1419,7 +1419,7 @@ int request_any_context_irq(unsigned int irq, irq_handler_t handler,
14191419
}
14201420
EXPORT_SYMBOL_GPL(request_any_context_irq);
14211421

1422-
void enable_percpu_irq(unsigned int irq)
1422+
void enable_percpu_irq(unsigned int irq, unsigned int type)
14231423
{
14241424
unsigned int cpu = smp_processor_id();
14251425
unsigned long flags;
@@ -1428,7 +1428,20 @@ void enable_percpu_irq(unsigned int irq)
14281428
if (!desc)
14291429
return;
14301430

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+
14311443
irq_percpu_enable(desc, cpu);
1444+
out:
14321445
irq_put_desc_unlock(desc, flags);
14331446
}
14341447

0 commit comments

Comments
 (0)