summaryrefslogtreecommitdiff
path: root/hw/i386/kvm
diff options
context:
space:
mode:
authorHu Tao <hutao@cn.fujitsu.com>2013-07-01 18:18:38 +0800
committerAndreas Färber <afaerber@suse.de>2013-07-23 00:37:35 +0200
commit98bdc0d7ff93f2ab39c0634c744cc7f4a8ac7399 (patch)
tree8949dfde10d57c35c1971c82efd811a947f9b07c /hw/i386/kvm
parent02f9a6f5da74251e1e5685ae57643d45c3fb6c30 (diff)
kvm/clock: QOM'ify some more
Introduce type constant and avoid FROM_SYSBUS(). Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> [AF: Renamed parent field] Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/i386/kvm')
-rw-r--r--hw/i386/kvm/clock.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
index 1022d67178..62654584d6 100644
--- a/hw/i386/kvm/clock.c
+++ b/hw/i386/kvm/clock.c
@@ -22,8 +22,14 @@
#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 {
+ /*< private >*/
SysBusDevice busdev;
+ /*< public >*/
+
uint64_t clock;
bool clock_valid;
} KVMClockState;
@@ -87,7 +93,7 @@ static void kvmclock_vm_state_change(void *opaque, int running,
static int kvmclock_init(SysBusDevice *dev)
{
- KVMClockState *s = FROM_SYSBUS(KVMClockState, dev);
+ KVMClockState *s = KVM_CLOCK(dev);
qemu_add_vm_change_state_handler(kvmclock_vm_state_change, s);
return 0;
@@ -115,7 +121,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 +135,7 @@ void kvmclock_create(void)
if (kvm_enabled() &&
cpu->env.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);
}
}