aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/irq/manage.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/irq/manage.c')
-rw-r--r--kernel/irq/manage.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 704e488730a5..84f32278ff1f 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1120,3 +1120,40 @@ int request_threaded_irq(unsigned int irq, irq_handler_t handler,
1120 return retval; 1120 return retval;
1121} 1121}
1122EXPORT_SYMBOL(request_threaded_irq); 1122EXPORT_SYMBOL(request_threaded_irq);
1123
1124/**
1125 * request_any_context_irq - allocate an interrupt line
1126 * @irq: Interrupt line to allocate
1127 * @handler: Function to be called when the IRQ occurs.
1128 * Threaded handler for threaded interrupts.
1129 * @flags: Interrupt type flags
1130 * @name: An ascii name for the claiming device
1131 * @dev_id: A cookie passed back to the handler function
1132 *
1133 * This call allocates interrupt resources and enables the
1134 * interrupt line and IRQ handling. It selects either a
1135 * hardirq or threaded handling method depending on the
1136 * context.
1137 *
1138 * On failure, it returns a negative value. On success,
1139 * it returns either IRQC_IS_HARDIRQ or IRQC_IS_NESTED.
1140 */
1141int request_any_context_irq(unsigned int irq, irq_handler_t handler,
1142 unsigned long flags, const char *name, void *dev_id)
1143{
1144 struct irq_desc *desc = irq_to_desc(irq);
1145 int ret;
1146
1147 if (!desc)
1148 return -EINVAL;
1149
1150 if (desc->status & IRQ_NESTED_THREAD) {
1151 ret = request_threaded_irq(irq, NULL, handler,
1152 flags, name, dev_id);
1153 return !ret ? IRQC_IS_NESTED : ret;
1154 }
1155
1156 ret = request_irq(irq, handler, flags, name, dev_id);
1157 return !ret ? IRQC_IS_HARDIRQ : ret;
1158}
1159EXPORT_SYMBOL_GPL(request_any_context_irq);