|
From: | Paolo Bonzini |
Subject: | Re: [Qemu-ppc] [PATCH 27/28] sysbus: apic: ioapic: convert to QEMU Object Model |
Date: | Wed, 25 Jan 2012 11:15:14 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0 |
On 01/25/2012 09:37 AM, Jan Kiszka wrote:
> They're exactly the same size (16 lines). If you embed TypeInfo into > DeviceTypeInfo, and introduce a Device specific type registration > function, then you could do: > > static DeviceTypeInfo my_device_type_info = { > .type.name = TYPE_MY_DEVICE, > .type.parent = TYPE_PARENT_DEVICE, > .reset = my_device_reset,And if you introduce some #define TYPE_UNIMPLEMENTED (void *)&dummy_variable you can easily express [.field = NULL] => use parent .field = UNIMPLEMENTED => don't run any handler
I agree with Anthony, this would get really ugly where you are calling the functions and doing the class initialization. It's a different style from what we're used to, granted, but the difference in code size is not relevant (not enough to introduce a level of macro magic, at least) and the diffstat in this series is misleading because qdev is left with temporary duplication for now.
(I also complained with him about this a month ago or so). Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |