From 1e5b31e6bd4fa8a9c679a18388d2219feece275a Mon Sep 17 00:00:00 2001 From: "Peter A. G. Crosthwaite" Date: Tue, 31 Jul 2012 12:24:06 +1000 Subject: qdev: allow multiple qdev_init_gpio_in() calls Allow multiple qdev_init_gpio_in() calls for the one device. The first call will define GPIOs 0-N-1, the next GPIOs N- ... . Allows different GPIOs to be handled with different handlers. Needed when two levels of the QOM class heirachy both define GPIO functionality, as a single GPIO handler with an index selecter is not possible. Signed-off-by: Peter A. G. Crosthwaite Reviewed-by: Peter Maydell --- hw/qdev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'hw/qdev.c') diff --git a/hw/qdev.c b/hw/qdev.c index b6e9207ede..9b9aba376b 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -285,9 +285,9 @@ BusState *qdev_get_parent_bus(DeviceState *dev) void qdev_init_gpio_in(DeviceState *dev, qemu_irq_handler handler, int n) { - assert(dev->num_gpio_in == 0); - dev->num_gpio_in = n; - dev->gpio_in = qemu_allocate_irqs(handler, dev, n); + dev->gpio_in = qemu_extend_irqs(dev->gpio_in, dev->num_gpio_in, handler, + dev, n); + dev->num_gpio_in += n; } void qdev_init_gpio_out(DeviceState *dev, qemu_irq *pins, int n) -- cgit v1.2.3