Add two functions one to get the irq handler function and another to get the
opaque data from a qemu_irq.

Signed-off-by: Alistair Francis <alist...@alistair23.me>
---

 hw/core/irq.c    | 10 ++++++++++
 include/hw/irq.h |  4 ++++
 2 files changed, 14 insertions(+)

diff --git a/hw/core/irq.c b/hw/core/irq.c
index 49ff2e6..026200e 100644
--- a/hw/core/irq.c
+++ b/hw/core/irq.c
@@ -91,6 +91,16 @@ void qemu_free_irq(qemu_irq irq)
     object_unref(OBJECT(irq));
 }
 
+qemu_irq_handler qemu_irq_get_handler(qemu_irq irq)
+{
+    return irq->handler;
+}
+
+void *qemu_irq_get_opaque(qemu_irq irq)
+{
+    return irq->opaque;
+}
+
 static void qemu_notirq(void *opaque, int line, int level)
 {
     struct IRQState *irq = opaque;
diff --git a/include/hw/irq.h b/include/hw/irq.h
index 4c4c2ea..934a8f5 100644
--- a/include/hw/irq.h
+++ b/include/hw/irq.h
@@ -27,6 +27,10 @@ static inline void qemu_irq_pulse(qemu_irq irq)
     qemu_set_irq(irq, 0);
 }
 
+qemu_irq_handler qemu_irq_get_handler(qemu_irq irq);
+
+void *qemu_irq_get_opaque(qemu_irq irq);
+
 /* Returns an array of N IRQs. Each IRQ is assigned the argument handler and
  * opaque data.
  */
-- 
2.7.4


Reply via email to