summaryrefslogtreecommitdiff
path: root/hw/core/qdev.c
diff options
context:
space:
mode:
authorPeter Crosthwaite <peter.crosthwaite@xilinx.com>2014-09-25 22:17:08 -0700
committerAndreas Färber <afaerber@suse.de>2014-10-13 16:39:26 +0200
commitb235a71f52f60d42dd69c4ac2e41fa5a5861cf85 (patch)
tree0ee0f6bb7693014ffc20118a2f90fde661b13cd6 /hw/core/qdev.c
parentb1d28ec6a7dbdaadda39d29322f0de694aeb0b74 (diff)
downloadqemu-b235a71f52f60d42dd69c4ac2e41fa5a5861cf85.tar.gz
qdev: gpio: Don't allow name share between I and O
Only allow a GPIO name to be one or the other. Inputs and outputs are functionally different and should be in different namespaces. Prepares support for the QOMification of IRQs as Links or Child objects. The alternative is to munge names .e.g. with "-in" or "-out" suffixes when giving QOM names. But that reduces clarity and if there are cases out there where users want I and O with same name they can manually add their own suffixes. Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/core/qdev.c')
-rw-r--r--hw/core/qdev.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index fcb16383a1..976e20861a 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -339,6 +339,7 @@ void qdev_init_gpio_in_named(DeviceState *dev, qemu_irq_handler handler,
{
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);
gpio_list->num_in += n;
@@ -354,6 +355,7 @@ void qdev_init_gpio_out_named(DeviceState *dev, qemu_irq *pins,
{
NamedGPIOList *gpio_list = qdev_get_named_gpio_list(dev, name);
+ assert(gpio_list->num_in == 0 || !name);
assert(gpio_list->num_out == 0);
gpio_list->num_out = n;
gpio_list->out = pins;