qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 07/12] qdev-core: isolate reset register/unregis


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH 07/12] qdev-core: isolate reset register/unregister code
Date: Wed, 17 Oct 2012 13:08:23 -0500
User-agent: Notmuch/0.13.2+93~ged93d79 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu)

Eduardo Habkost <address@hidden> writes:

> The reset register/unregister code is specific to qemu-system-*, so
> isolate it so it can be moved to qdev-system.c.
>
> Signed-off-by: Eduardo Habkost <address@hidden>
> ---
>  hw/qdev-core.c | 24 ++++++++++++++++++------
>  1 file changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/hw/qdev-core.c b/hw/qdev-core.c
> index af0af52..a105679 100644
> --- a/hw/qdev-core.c
> +++ b/hw/qdev-core.c
> @@ -47,6 +47,21 @@ void GCC_WEAK qdev_finalize_vmstate(DeviceState *dev)
>  {
>  }
>  
> +static void qbus_register_reset(BusState *bus)
> +{
> +    if (bus != sysbus_get_default()) {
> +        /* TODO: once all bus devices are qdevified,
> +           only reset handler for main_system_bus should be registered here. 
> */
> +        qemu_register_reset(qbus_reset_all_fn, bus);
> +    }
> +}
> +
> +static void qbus_unregister_reset(BusState *bus)
> +{
> +    assert(bus != sysbus_get_default()); /* main_system_bus is never freed */
> +    qemu_unregister_reset(qbus_reset_all_fn, bus);
> +}
> +

Again, I'd suggest stubbing out qemu_[un]register_reset instead of
trying to cope with it's users.

Regards,

Anthony Liguori

>  const char *qdev_fw_name(DeviceState *dev)
>  {
>      DeviceClass *dc = DEVICE_GET_CLASS(dev);
> @@ -355,10 +370,8 @@ static void qbus_realize(BusState *bus)
>          QLIST_INSERT_HEAD(&bus->parent->child_bus, bus, sibling);
>          bus->parent->num_child_bus++;
>          object_property_add_child(OBJECT(bus->parent), bus->name, 
> OBJECT(bus), NULL);
> -    } else if (bus != sysbus_get_default()) {
> -        /* TODO: once all bus devices are qdevified,
> -           only reset handler for main_system_bus should be registered here. 
> */
> -        qemu_register_reset(qbus_reset_all_fn, bus);
> +    } else {
> +        qbus_register_reset(bus);
>      }
>  }
>  
> @@ -692,8 +705,7 @@ static void qbus_finalize(Object *obj)
>          QLIST_REMOVE(bus, sibling);
>          bus->parent->num_child_bus--;
>      } else {
> -        assert(bus != sysbus_get_default()); /* main_system_bus is never 
> freed */
> -        qemu_unregister_reset(qbus_reset_all_fn, bus);
> +        qbus_unregister_reset(bus);
>      }
>      g_free((char *)bus->name);
>  }
> -- 
> 1.7.11.7



reply via email to

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