[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <164544238423.16921.14685093775166733539.tip-bot2@tip-bot2>
Date: Mon, 21 Feb 2022 11:19:44 -0000
From: "tip-bot2 for Sebastian Andrzej Siewior" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Thomas Gleixner <tglx@...utronix.de>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Hans de Goede <hdegoede@...hat.com>,
Oleksandr Natalenko <oleksandr@...alenko.name>,
Wolfram Sang <wsa+renesas@...g-engineering.com>,
x86@...nel.org, linux-kernel@...r.kernel.org, maz@...nel.org
Subject: [tip: irq/core] genirq: Provide generic_handle_irq_safe()
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 509853f9e1e7b1490dc79f735a5dbafc9298f40d
Gitweb: https://git.kernel.org/tip/509853f9e1e7b1490dc79f735a5dbafc9298f40d
Author: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
AuthorDate: Fri, 11 Feb 2022 19:14:54 +01:00
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Mon, 21 Feb 2022 11:31:06 +01:00
genirq: Provide generic_handle_irq_safe()
Provide generic_handle_irq_safe() which can used from any context.
Suggested-by: Thomas Gleixner <tglx@...utronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Reviewed-by: Hans de Goede <hdegoede@...hat.com>
Reviewed-by: Oleksandr Natalenko <oleksandr@...alenko.name>
Reviewed-by: Wolfram Sang <wsa+renesas@...g-engineering.com>
Link: https://lore.kernel.org/r/20220211181500.1856198-2-bigeasy@linutronix.de
---
include/linux/irqdesc.h | 1 +
kernel/irq/irqdesc.c | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 93d270c..a775845 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -160,6 +160,7 @@ static inline void generic_handle_irq_desc(struct irq_desc *desc)
int handle_irq_desc(struct irq_desc *desc);
int generic_handle_irq(unsigned int irq);
+int generic_handle_irq_safe(unsigned int irq);
#ifdef CONFIG_IRQ_DOMAIN
/*
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 2267e65..346d283 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
Powered by blists - more mailing lists