diff mbox

[v2] qdev: Reset hot-plugged devices

Message ID 4E2C589C.8040101@web.de
State New
Headers show

Commit Message

Jan Kiszka July 24, 2011, 5:38 p.m. UTC
From: Jan Kiszka <jan.kiszka@siemens.com>

Device models rely on the core invoking their reset handlers after init.
We do this in the cold-plug case, but so far we miss this step after
hot-plug.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

Changes in v2:
 - move reset to qdev_init in case the device is created by the
   hot-plugged one (composed devices)

 hw/qdev.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Comments

Anthony Liguori July 29, 2011, 2:17 p.m. UTC | #1
On 07/24/2011 12:38 PM, Jan Kiszka wrote:
> From: Jan Kiszka<jan.kiszka@siemens.com>
>
> Device models rely on the core invoking their reset handlers after init.
> We do this in the cold-plug case, but so far we miss this step after
> hot-plug.
>
> Signed-off-by: Jan Kiszka<jan.kiszka@siemens.com>

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
>
> Changes in v2:
>   - move reset to qdev_init in case the device is created by the
>     hot-plugged one (composed devices)
>
>   hw/qdev.c |    3 +++
>   1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/hw/qdev.c b/hw/qdev.c
> index a0fcd06..b4ea8e1 100644
> --- a/hw/qdev.c
> +++ b/hw/qdev.c
> @@ -289,6 +289,9 @@ int qdev_init(DeviceState *dev)
>                                          dev->alias_required_for_version);
>       }
>       dev->state = DEV_STATE_INITIALIZED;
> +    if (dev->hotplugged&&  dev->info->reset) {
> +        dev->info->reset(dev);
> +    }
>       return 0;
>   }
>
diff mbox

Patch

diff --git a/hw/qdev.c b/hw/qdev.c
index a0fcd06..b4ea8e1 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -289,6 +289,9 @@  int qdev_init(DeviceState *dev)
                                        dev->alias_required_for_version);
     }
     dev->state = DEV_STATE_INITIALIZED;
+    if (dev->hotplugged && dev->info->reset) {
+        dev->info->reset(dev);
+    }
     return 0;
 }