[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 22/26] kvmclock: QOM'ify some more
From: |
Hu Tao |
Subject: |
[Qemu-devel] [PATCH 22/26] kvmclock: QOM'ify some more |
Date: |
Sat, 22 Jun 2013 16:50:34 +0800 |
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>
---
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
- [Qemu-devel] [PATCH 13/26] ahci: use realize for ahci, (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 <=
[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