Luiz Capitulino <lcapitul...@redhat.com> writes:

> On Wed,  3 Aug 2011 15:07:59 +0200
> Markus Armbruster <arm...@redhat.com> wrote:
>
>> 
>> Signed-off-by: Markus Armbruster <arm...@redhat.com>
>> ---
>>  hw/ide/internal.h |    1 +
>>  hw/ide/qdev.c     |   12 ++++++++++++
>>  2 files changed, 13 insertions(+), 0 deletions(-)
>> 
>> diff --git a/hw/ide/internal.h b/hw/ide/internal.h
>> index 3e56b45..0b0b8a7 100644
>> --- a/hw/ide/internal.h
>> +++ b/hw/ide/internal.h
>> @@ -529,6 +529,7 @@ typedef int (*ide_qdev_initfn)(IDEDevice *dev);
>>  struct IDEDeviceInfo {
>>      DeviceInfo qdev;
>>      ide_qdev_initfn init;
>> +    ide_qdev_initfn exit;
>>  };
>>  
>>  #define BM_STATUS_DMAING 0x01
>> diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
>> index 6bd8d20..3b7b306 100644
>> --- a/hw/ide/qdev.c
>> +++ b/hw/ide/qdev.c
>> @@ -91,9 +91,21 @@ err:
>>      return -1;
>>  }
>>  
>> +static int ide_qdev_exit(DeviceState *qdev)
>> +{
>> +    IDEDevice *dev = DO_UPCAST(IDEDevice, qdev, qdev);
>> +    IDEDeviceInfo *info = DO_UPCAST(IDEDeviceInfo, qdev, qdev->info);
>> +
>> +    if (info->exit) {
>> +        return info->exit(dev);
>> +    }
>> +    return 0;
>
> return info->exit ? info->exit(dev) : 0;

Matter of taste.  I'll consider it when I respin.

>
>> +}
>> +
>>  static void ide_qdev_register(IDEDeviceInfo *info)
>>  {
>>      info->qdev.init = ide_qdev_init;
>> +    info->qdev.exit = ide_qdev_exit;
>>      info->qdev.bus_info = &ide_bus_info;
>>      qdev_register(&info->qdev);
>>  }

Reply via email to