[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 22/26] kvmclock: QOM'ify some more
From: |
Eduardo Habkost |
Subject: |
Re: [Qemu-devel] [PATCH 22/26] kvmclock: QOM'ify some more |
Date: |
Mon, 24 Jun 2013 10:33:37 -0300 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Sat, Jun 22, 2013 at 04:50:34PM +0800, Hu Tao wrote:
> Introduce type constant and avoid DO_UPCAST().
>
> Cc: address@hidden
> Cc: "Andreas Färber" <address@hidden>
> Cc: Paolo Bonzini <address@hidden>
> Cc: Eduardo Habkost <address@hidden>
> Cc: Igor Mammedov <address@hidden>
> Cc: Anthony Liguori <address@hidden>
> Signed-off-by: Hu Tao <address@hidden>
Reviewed-by: Eduardo Habkost <address@hidden>
But I agree with Igor that the order of 21/26 and 22/26 could be
changed, so kvmclock_realize() could use KVM_CLOCK() since the
beginning.
> ---
> hw/i386/kvm/clock.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
> index 74aa240..eaad880 100644
> --- a/hw/i386/kvm/clock.c
> +++ b/hw/i386/kvm/clock.c
> @@ -22,6 +22,9 @@
> #include <linux/kvm.h>
> #include <linux/kvm_para.h>
>
> +#define TYPE_KVM_CLOCK "kvmclock"
> +#define KVM_CLOCK(obj) OBJECT_CHECK(KVMClockState, (obj), TYPE_KVM_CLOCK)
> +
> typedef struct KVMClockState {
> SysBusDevice busdev;
> uint64_t clock;
> @@ -89,13 +92,13 @@ static void kvmclock_vm_state_change(void *opaque, int
> running,
>
> static void kvmclock_realize(DeviceState *dev, Error **errp)
> {
> - KVMClockState *s = DO_UPCAST(KVMClockState, busdev.qdev, dev);
> + KVMClockState *s = KVM_CLOCK(dev);
>
> qemu_add_vm_change_state_handler(kvmclock_vm_state_change, s);
> }
>
> static const VMStateDescription kvmclock_vmsd = {
> - .name = "kvmclock",
> + .name = TYPE_KVM_CLOCK,
> .version_id = 1,
> .minimum_version_id = 1,
> .minimum_version_id_old = 1,
> @@ -117,7 +120,7 @@ static void kvmclock_class_init(ObjectClass *klass, void
> *data)
> }
>
> static const TypeInfo kvmclock_info = {
> - .name = "kvmclock",
> + .name = TYPE_KVM_CLOCK,
> .parent = TYPE_SYS_BUS_DEVICE,
> .instance_size = sizeof(KVMClockState),
> .class_init = kvmclock_class_init,
> @@ -129,7 +132,7 @@ void kvmclock_create(void)
> if (kvm_enabled() &&
> first_cpu->features[FEAT_KVM] & ((1ULL << KVM_FEATURE_CLOCKSOURCE) |
> (1ULL <<
> KVM_FEATURE_CLOCKSOURCE2))) {
> - sysbus_create_simple("kvmclock", -1, NULL);
> + sysbus_create_simple(TYPE_KVM_CLOCK, -1, NULL);
> }
> }
>
> --
> 1.8.3.1
>
>
--
Eduardo
- [Qemu-devel] [PATCH 21/26] kvmclock: use realize for kvmclock, (continued)
[Qemu-devel] [PATCH 19/26] hpet: use realize for hpet, Hu Tao, 2013/06/22
[Qemu-devel] [PATCH 18/26] scsi esp: QOM'ify some more, Hu Tao, 2013/06/22
[Qemu-devel] [PATCH 22/26] kvmclock: QOM'ify some more, Hu Tao, 2013/06/22
- Re: [Qemu-devel] [PATCH 22/26] kvmclock: QOM'ify some more,
Eduardo Habkost <=
[Qemu-devel] [PATCH 25/26] isa bus: use realize for isa bus, Hu Tao, 2013/06/22
[Qemu-devel] [PATCH 23/26] kvmvapic realize, Hu Tao, 2013/06/22
[Qemu-devel] [PATCH 26/26] ehci: use realize for ehci, Hu Tao, 2013/06/22
[Qemu-devel] [PATCH 20/26] hpet: QOM'ify some more, Hu Tao, 2013/06/22
[Qemu-devel] [PATCH 24/26] ioapic: use realize for ioapic, Hu Tao, 2013/06/22
Re: [Qemu-devel] [PATCH 00/26] use realizefn for SysBusDevice, part 1, Andreas Färber, 2013/06/30