summaryrefslogtreecommitdiff
path: root/hw/core
diff options
context:
space:
mode:
authorPeter Crosthwaite <peter.crosthwaite@xilinx.com>2014-09-25 22:17:41 -0700
committerAndreas Färber <afaerber@suse.de>2014-10-13 16:39:26 +0200
commita69bef1cf12159233b0ba193bd9dc9b173cea453 (patch)
tree69c465eef7da677ff2ff372e3fc08de55653036c /hw/core
parentb235a71f52f60d42dd69c4ac2e41fa5a5861cf85 (diff)
downloadqemu-a69bef1cf12159233b0ba193bd9dc9b173cea453.tar.gz
qdev: gpio: Register GPIO inputs as child objects
To the device that contains them. This will allow for referencing a GPIO input from it's canonical path (exciting for dynamic machine generation!) 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')
-rw-r--r--hw/core/qdev.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 976e20861a..a140c79757 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -337,11 +337,20 @@ static NamedGPIOList *qdev_get_named_gpio_list(DeviceState *dev,
void qdev_init_gpio_in_named(DeviceState *dev, qemu_irq_handler handler,
const char *name, int n)
{
+ int i;
NamedGPIOList *gpio_list = qdev_get_named_gpio_list(dev, name);
+ char *propname = g_strdup_printf("%s[*]", name ? name : "unnamed-gpio-in");
assert(gpio_list->num_out == 0 || !name);
gpio_list->in = qemu_extend_irqs(gpio_list->in, gpio_list->num_in, handler,
dev, n);
+
+ for (i = gpio_list->num_in; i < gpio_list->num_in + n; i++) {
+ object_property_add_child(OBJECT(dev), propname,
+ OBJECT(gpio_list->in[i]), &error_abort);
+ }
+ g_free(propname);
+
gpio_list->num_in += n;
}