[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 3/4] qdev: Simplify the SysBusDeviceClass::in
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v3 3/4] qdev: Simplify the SysBusDeviceClass::init path |
Date: |
Fri, 20 Apr 2018 09:22:55 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) |
Philippe Mathieu-Daudé <address@hidden> writes:
> On 04/19/2018 06:27 PM, Philippe Mathieu-Daudé wrote:
>> The SysBusDevice is the last DeviceClass::init user.
>>
>> Instead of using
>> SysBusDeviceClass::realize
>> -> DeviceClass::realize
>> -> DeviceClass::init
>> -> sysbus_device_init
>> -> SysBusDeviceClass::init
>>
>> Simplify the path by directly calling SysBusDeviceClass::init
>> in SysBusDeviceClass::realize:
>>
>> SysBusDeviceClass::realize
>> -> SysBusDeviceClass::init
>>
>> Finally, remove the DeviceClass::init, there are no more users.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
>> ---
>> include/hw/qdev-core.h | 2 --
>> hw/core/qdev.c | 14 --------------
>> hw/core/sysbus.c | 15 ++++++++++-----
>> 3 files changed, 10 insertions(+), 21 deletions(-)
>>
>> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
>> index 9453588160..6f60748043 100644
>> --- a/include/hw/qdev-core.h
>> +++ b/include/hw/qdev-core.h
>> @@ -29,7 +29,6 @@ typedef enum DeviceCategory {
>> DEVICE_CATEGORY_MAX
>> } DeviceCategory;
>>
>> -typedef int (*qdev_initfn)(DeviceState *dev);
>> typedef int (*qdev_event)(DeviceState *dev);
>> typedef void (*DeviceRealize)(DeviceState *dev, Error **errp);
>> typedef void (*DeviceUnrealize)(DeviceState *dev, Error **errp);
>> @@ -124,7 +123,6 @@ typedef struct DeviceClass {
>> const struct VMStateDescription *vmsd;
>>
>> /* Private to qdev / bus. */
>> - qdev_initfn init; /* TODO remove, once users are converted to realize */
>
> The DeviceClass documentation (top of this file) is now out of date :(
>
> If the maintainer taking this series prefer a respin, I plan to only
> remove the 'init' references in the big comment.
I'd move the actual removal into the next and final patch. Lets us fix
up the comment in one go.
>> qdev_event exit; /* TODO remove, once users are converted to unrealize
>> */
>> const char *bus_type;
>> } DeviceClass;
[...]
- [Qemu-devel] [PATCH v3 0/4] qdev: remove DeviceClass::init/exit(), Philippe Mathieu-Daudé, 2018/04/19
- [Qemu-devel] [PATCH v3 1/4] hw/i2c/smbus: Use DeviceClass::realize instead of SMBusDeviceClass::init, Philippe Mathieu-Daudé, 2018/04/19
- [Qemu-devel] [PATCH v3 2/4] hw/i2c: Use DeviceClass::realize instead of I2CSlaveClass::init, Philippe Mathieu-Daudé, 2018/04/19
- [Qemu-devel] [PATCH v3 4/4] qdev: Remove DeviceClass::exit, Philippe Mathieu-Daudé, 2018/04/19
- [Qemu-devel] [PATCH v3 3/4] qdev: Simplify the SysBusDeviceClass::init path, Philippe Mathieu-Daudé, 2018/04/19
- Re: [Qemu-devel] [PATCH v3 0/4] qdev: remove DeviceClass::init/exit(), Philippe Mathieu-Daudé, 2018/04/19