diff mbox

[1/2] hw: irq: Add API to get irq number from qemu_irq

Message ID 1429260911-24021-2-git-send-email-pranavkumar@linaro.org
State New
Headers show

Commit Message

PranavkumarSawargaonkar April 17, 2015, 8:55 a.m. UTC
This patch adds a new function to get irq number from qemu irq.

Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Signed-off-by: Tushar Jagad <tushar.jagad@linaro.org>
---
 hw/core/irq.c    | 9 +++++++++
 include/hw/irq.h | 1 +
 2 files changed, 10 insertions(+)
diff mbox

Patch

diff --git a/hw/core/irq.c b/hw/core/irq.c
index 8a62a36..0eeffdf 100644
--- a/hw/core/irq.c
+++ b/hw/core/irq.c
@@ -35,6 +35,15 @@  struct IRQState {
     int n;
 };
 
+int qemu_get_irq_num(qemu_irq irq)
+{
+    if (!irq) {
+        return -1;
+    }
+
+    return irq->n;
+}
+
 void qemu_set_irq(qemu_irq irq, int level)
 {
     if (!irq)
diff --git a/include/hw/irq.h b/include/hw/irq.h
index 4c4c2ea..dd5220c 100644
--- a/include/hw/irq.h
+++ b/include/hw/irq.h
@@ -9,6 +9,7 @@  typedef struct IRQState *qemu_irq;
 
 typedef void (*qemu_irq_handler)(void *opaque, int n, int level);
 
+int qemu_get_irq_num(qemu_irq irq);
 void qemu_set_irq(qemu_irq irq, int level);
 
 static inline void qemu_irq_raise(qemu_irq irq)