From: Peter Crosthwaite <peter.crosthwa...@xilinx.com> Add a routine to set or override the opaque data of an IRQ.
Qdev currently always initialises IRQ opaque as the device itself. This allows you to override to a custom opaque in the case where there is extra or different data needed. Signed-off-by: Peter Crosthwaite <peter.crosthwa...@xilinx.com> Signed-off-by: Alistair Francis <alistair.fran...@xilinx.com> --- hw/core/irq.c | 5 +++++ include/hw/irq.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/hw/core/irq.c b/hw/core/irq.c index 49ff2e6..9d125fb 100644 --- a/hw/core/irq.c +++ b/hw/core/irq.c @@ -77,6 +77,11 @@ qemu_irq qemu_allocate_irq(qemu_irq_handler handler, void *opaque, int n) return irq; } +void qemu_irq_set_opaque(qemu_irq irq, void *opaque) +{ + irq->opaque = opaque; +} + void qemu_free_irqs(qemu_irq *s, int n) { int i; diff --git a/include/hw/irq.h b/include/hw/irq.h index 4c4c2ea..edad0fc 100644 --- a/include/hw/irq.h +++ b/include/hw/irq.h @@ -44,6 +44,8 @@ qemu_irq qemu_allocate_irq(qemu_irq_handler handler, void *opaque, int n); qemu_irq *qemu_extend_irqs(qemu_irq *old, int n_old, qemu_irq_handler handler, void *opaque, int n); +void qemu_irq_set_opaque(qemu_irq irq, void *opaque); + void qemu_free_irqs(qemu_irq *s, int n); void qemu_free_irq(qemu_irq irq); -- 2.5.0