aboutsummaryrefslogtreecommitdiff
path: root/kernel/irq
diff options
context:
space:
mode:
authorThomas Gleixner2022-02-21 11:33:57 +0100
committerThomas Gleixner2022-02-21 11:33:57 +0100
commitd2206fcabdfaff3958ab67cc5b8f63257e57b889 (patch)
treef6bc697bb2d10e49e5123b4e0cc30c11aafc3120 /kernel/irq
parentfe13889c390e14205e064d7e159e61eb5da4b1c3 (diff)
parent509853f9e1e7b1490dc79f735a5dbafc9298f40d (diff)
Merge tag 'irq-api-2022-02-21' into irq/core
Merge the generic_handle_irq_safe() API back into irq/core.
Diffstat (limited to 'kernel/irq')
-rw-r--r--kernel/irq/irqdesc.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 6167d32e27da..939d21cd55c3 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -662,6 +662,29 @@ int generic_handle_irq(unsigned int irq)
}
EXPORT_SYMBOL_GPL(generic_handle_irq);
+/**
+ * generic_handle_irq_safe - Invoke the handler for a particular irq from any
+ * context.
+ * @irq: The irq number to handle
+ *
+ * Returns: 0 on success, a negative value on error.
+ *
+ * This function can be called from any context (IRQ or process context). It
+ * will report an error if not invoked from IRQ context and the irq has been
+ * marked to enforce IRQ-context only.
+ */
+int generic_handle_irq_safe(unsigned int irq)
+{
+ unsigned long flags;
+ int ret;
+
+ local_irq_save(flags);
+ ret = handle_irq_desc(irq_to_desc(irq));
+ local_irq_restore(flags);
+ return ret;
+}
+EXPORT_SYMBOL_GPL(generic_handle_irq_safe);
+
#ifdef CONFIG_IRQ_DOMAIN
/**
* generic_handle_domain_irq - Invoke the handler for a HW irq belonging