qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 25/25] qdev: split part of device_finalize to de


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 25/25] qdev: split part of device_finalize to device_unrealize
Date: Mon, 23 Apr 2012 10:26:21 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1

Il 20/04/2012 19:56, Anthony Liguori ha scritto:
> On 04/03/2012 06:15 AM, Paolo Bonzini wrote:
>> Signed-off-by: Paolo Bonzini<address@hidden>
>> ---
>>   hw/qdev.c |   35 ++++++++++++++++++++---------------
>>   1 file changed, 20 insertions(+), 15 deletions(-)
>>
>> diff --git a/hw/qdev.c b/hw/qdev.c
>> index e674248..45f1133 100644
>> --- a/hw/qdev.c
>> +++ b/hw/qdev.c
>> @@ -601,27 +601,31 @@ static void device_initfn(Object *obj)
>>   }
>>
>>   /* Unlink device from bus and free the structure.  */
>> -static void device_finalize(Object *obj)
>> +static void device_unrealize(Object *obj)
>>   {
>>       DeviceState *dev = DEVICE(obj);
>>       BusState *bus;
>>       DeviceClass *dc = DEVICE_GET_CLASS(dev);
>>
>> -    if (object_is_realized(obj)) {
>> -        while (dev->num_child_bus) {
>> -            bus = QLIST_FIRST(&dev->child_bus);
>> -            qbus_free(bus);
>> -        }
>> -        if (qdev_get_vmsd(dev)) {
>> -            vmstate_unregister(dev, qdev_get_vmsd(dev), dev);
>> -        }
>> -        if (dc->exit) {
>> -            dc->exit(dev);
>> -        }
>> -        if (dev->opts) {
>> -            qemu_opts_del(dev->opts);
>> -        }
>> +    while (dev->num_child_bus) {
>> +        bus = QLIST_FIRST(&dev->child_bus);
>> +        qbus_free(bus);
>> +    }
> 
> This doesn't seem symmetric to me.  We don't create busses in realize(),
> or at least we shouldn't IMHO.  We should create child busses in
> instance_init(). Should be remove them in finalize?

Perhaps yes, I'll split the patch in two.

Paolo



reply via email to

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