qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 07/11] qemu-char: Move incrementing of avail_con


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 07/11] qemu-char: Move incrementing of avail_connections to qdev-properties-system
Date: Tue, 26 Mar 2013 14:07:50 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4

Il 26/03/2013 11:07, Hans de Goede ha scritto:
> The decrement of avail_connections is done in qdev-properties-system move
> the increment there too for proper balancing of the calls.
> 
> Signed-off-by: Hans de Goede <address@hidden>
> ---
>  hw/qdev-properties-system.c | 6 ++++--
>  qemu-char.c                 | 2 --
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/qdev-properties-system.c b/hw/qdev-properties-system.c
> index 8795144..12a87d5 100644
> --- a/hw/qdev-properties-system.c
> +++ b/hw/qdev-properties-system.c
> @@ -136,9 +136,11 @@ static void release_chr(Object *obj, const char *name, 
> void *opaque)
>      DeviceState *dev = DEVICE(obj);
>      Property *prop = opaque;
>      CharDriverState **ptr = qdev_get_prop_ptr(dev, prop);
> +    CharDriverState *chr = *ptr;
>  
> -    if (*ptr) {
> -        qemu_chr_add_handlers(*ptr, NULL, NULL, NULL, NULL);
> +    if (chr) {
> +        qemu_chr_add_handlers(chr, NULL, NULL, NULL, NULL);
> +        ++chr->avail_connections;
>      }
>  }
>  
> diff --git a/qemu-char.c b/qemu-char.c
> index 8a66627..368e7f5 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -197,8 +197,6 @@ void qemu_chr_add_handlers(CharDriverState *s,
>      int fe_open;
>  
>      if (!opaque && !fd_can_read && !fd_read && !fd_event) {
> -        /* chr driver being released. */
> -        ++s->avail_connections;
>          fe_open = 0;
>      } else {
>          fe_open = 1;
> 

I think this is still wrong (though better than before this patch).
This is still not giving an error:

   qemu-kvm \
      -chardev stdio,id=foo -device isa-serial,chardev=foo \
      -mon chardev=foo

because other users of -chardev (monitor and rng-egd), are not
decrementing avail_connections.  Can you look at it in a follow-up?

Paolo



reply via email to

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