summaryrefslogtreecommitdiffstats
path: root/hw/core
diff options
context:
space:
mode:
authorPeter Maydell2018-03-02 11:45:38 +0100
committerPeter Maydell2018-03-02 12:03:45 +0100
commit4a151677a8ea80e65f519fed1df92c0db6350a02 (patch)
treed71ca52ab8a8959e337819e7ffdf27696e9e26fe /hw/core
parentinclude/hw/or-irq.h: Add missing include guard (diff)
downloadqemu-4a151677a8ea80e65f519fed1df92c0db6350a02.tar.gz
qemu-4a151677a8ea80e65f519fed1df92c0db6350a02.tar.xz
qemu-4a151677a8ea80e65f519fed1df92c0db6350a02.zip
qdev: Add new qdev_init_gpio_in_named_with_opaque()
The function qdev_init_gpio_in_named() passes the DeviceState pointer as the opaque data pointor for the irq handler function. Usually this is what you want, but in some cases it would be helpful to use some other data pointer. Add a new function qdev_init_gpio_in_named_with_opaque() which allows the caller to specify the data pointer they want. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20180220180325.29818-12-peter.maydell@linaro.org
Diffstat (limited to 'hw/core')
-rw-r--r--hw/core/qdev.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 7ed1f431f0..f3754ee606 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -385,15 +385,17 @@ static NamedGPIOList *qdev_get_named_gpio_list(DeviceState *dev,
return ngl;
}
-void qdev_init_gpio_in_named(DeviceState *dev, qemu_irq_handler handler,
- const char *name, int n)
+void qdev_init_gpio_in_named_with_opaque(DeviceState *dev,
+ qemu_irq_handler handler,
+ void *opaque,
+ const char *name, int n)
{
int i;
NamedGPIOList *gpio_list = qdev_get_named_gpio_list(dev, name);
assert(gpio_list->num_out == 0 || !name);
gpio_list->in = qemu_extend_irqs(gpio_list->in, gpio_list->num_in, handler,
- dev, n);
+ opaque, n);
if (!name) {
name = "unnamed-gpio-in";