qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 3/5] qdev: export the bus reset interface


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 3/5] qdev: export the bus reset interface
Date: Tue, 10 Jul 2012 10:40:25 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0

Il 10/07/2012 08:16, Liu Ping Fan ha scritto:
> Signed-off-by: Liu Ping Fan <address@hidden>
> ---
>  hw/qdev.c |   17 ++++++++++++-----
>  hw/qdev.h |    2 ++
>  2 files changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/qdev.c b/hw/qdev.c
> index d2100a1..f7983e4 100644
> --- a/hw/qdev.c
> +++ b/hw/qdev.c
> @@ -249,11 +249,9 @@ static int qdev_reset_one(DeviceState *dev, void *opaque)
>  
>  static int qbus_reset_one(BusState *bus, void *opaque)
>  {
> -    BusClass *bc = BUS_GET_CLASS(bus);
> -    if (bc->reset) {
> -        return bc->reset(bus);
> -    }
> -    return 0;
> +    int ret;
> +    ret = bus_reset(bus);
> +    return ret;
>  }
>  
>  void qdev_reset_all(DeviceState *dev)
> @@ -766,6 +764,15 @@ void device_reset(DeviceState *dev)
>      }
>  }
>  
> +int bus_reset(BusState *bus)
> +{
> +    BusClass *bc = BUS_GET_CLASS(bus);
> +    if (bc->reset) {
> +        return bc->reset(bus);
> +    }
> +    return 0;
> +}

Two comments:

1) Is this correct? Resetting a bus should reset all the children before
resetting the bus itself.

2) Does it make sense to export it, since we're going towards removing
unnecessary buses?

Paolo

> +
>  Object *qdev_get_machine(void)
>  {
>      static Object *dev;
> diff --git a/hw/qdev.h b/hw/qdev.h
> index aecc69e..5f88b4b 100644
> --- a/hw/qdev.h
> +++ b/hw/qdev.h
> @@ -356,6 +356,8 @@ void qdev_machine_init(void);
>   */
>  void device_reset(DeviceState *dev);
>  
> +int bus_reset(BusState *bus);
> +
>  const VMStateDescription *qdev_get_vmsd(DeviceState *dev);
>  
>  const char *qdev_fw_name(DeviceState *dev);
> 





reply via email to

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