On 27/07/2015 17:06, Paolo Bonzini wrote: > > > On 27/07/2015 16:57, Andreas Färber wrote: >>>> I am absolutely fine with absolutely anything. Suggest what you like and >>>> i'll change it. >> Paolo suggested ...-count on #qemu, but I would prefer ...-max or so, as >> the number could differ when some property gets deleted. > > Yes, I agree -max is better. > > I'm just asking myself whether this is really necessary. Is the > automagic [*] really needed in this case? Can it just do: > > diff --git a/hw/core/qdev.c b/hw/core/qdev.c > index b2f404a..19bfee1 100644 > --- a/hw/core/qdev.c > +++ b/hw/core/qdev.c > @@ -415,19 +415,19 @@ 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; > + int i, j; > 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++) { > + char *propname = g_strdup_printf("%s[%d]", name ? name : > "unnamed-gpio-in", j++); > object_property_add_child(OBJECT(dev), propname, > OBJECT(gpio_list->in[i]), &error_abort); > + g_free(propname); > } > - g_free(propname); > > gpio_list->num_in += n; > } > > ?
... and the same in qdev_init_gpio_out_named. Paolo