qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v4 2/2] QOM: object_property_add() performance i


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v4 2/2] QOM: object_property_add() performance improvement
Date: Mon, 27 Jul 2015 17:09:19 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1


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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]