summaryrefslogtreecommitdiff
path: root/hw/sd/sdhci.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2014-12-08 18:10:31 -0500
committerPaolo Bonzini <pbonzini@redhat.com>2014-12-15 17:34:44 +0100
commit7302dcd60bbde1b11c298feb8134a34791f21b21 (patch)
tree96f2d8d3e2815f84ed0c0c54a32c39ac37f9ed31 /hw/sd/sdhci.c
parentd368ba4376b2c1c24175c74b3733b8fe64dbe8a6 (diff)
downloadqemu-7302dcd60bbde1b11c298feb8134a34791f21b21.tar.gz
qemu-7302dcd60bbde1b11c298feb8134a34791f21b21.tar.bz2
qemu-7302dcd60bbde1b11c298feb8134a34791f21b21.zip
sdhci: Add "sysbus" to sdhci QOM types and methods
Update the sdhci sysbus QOM types and methods so that sysbus is in their name. This is in preparation for adding PCI versions of these types and methods. Signed-off-by: Kevin O'Connor <kevin@koconnor.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/sd/sdhci.c')
-rw-r--r--hw/sd/sdhci.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index f834ea1a4a..d7ca0c057c 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -1142,9 +1142,8 @@ static inline unsigned int sdhci_get_fifolen(SDHCIState *s)
}
}
-static void sdhci_initfn(Object *obj)
+static void sdhci_initfn(SDHCIState *s)
{
- SDHCIState *s = SDHCI(obj);
DriveInfo *di;
di = drive_get_next(IF_SD);
@@ -1160,10 +1159,8 @@ static void sdhci_initfn(Object *obj)
s->transfer_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, sdhci_data_transfer, s);
}
-static void sdhci_uninitfn(Object *obj)
+static void sdhci_uninitfn(SDHCIState *s)
{
- SDHCIState *s = SDHCI(obj);
-
timer_del(s->insert_timer);
timer_free(s->insert_timer);
timer_del(s->transfer_timer);
@@ -1223,9 +1220,21 @@ static Property sdhci_properties[] = {
DEFINE_PROP_END_OF_LIST(),
};
-static void sdhci_realize(DeviceState *dev, Error ** errp)
+static void sdhci_sysbus_init(Object *obj)
+{
+ SDHCIState *s = SYSBUS_SDHCI(obj);
+ sdhci_initfn(s);
+}
+
+static void sdhci_sysbus_finalize(Object *obj)
+{
+ SDHCIState *s = SYSBUS_SDHCI(obj);
+ sdhci_uninitfn(s);
+}
+
+static void sdhci_sysbus_realize(DeviceState *dev, Error ** errp)
{
- SDHCIState *s = SDHCI(dev);
+ SDHCIState *s = SYSBUS_SDHCI(dev);
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
s->buf_maxsz = sdhci_get_fifolen(s);
@@ -1236,27 +1245,27 @@ static void sdhci_realize(DeviceState *dev, Error ** errp)
sysbus_init_mmio(sbd, &s->iomem);
}
-static void sdhci_class_init(ObjectClass *klass, void *data)
+static void sdhci_sysbus_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
dc->vmsd = &sdhci_vmstate;
dc->props = sdhci_properties;
- dc->realize = sdhci_realize;
+ dc->realize = sdhci_sysbus_realize;
}
-static const TypeInfo sdhci_type_info = {
- .name = TYPE_SDHCI,
+static const TypeInfo sdhci_sysbus_info = {
+ .name = TYPE_SYSBUS_SDHCI,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(SDHCIState),
- .instance_init = sdhci_initfn,
- .instance_finalize = sdhci_uninitfn,
- .class_init = sdhci_class_init,
+ .instance_init = sdhci_sysbus_init,
+ .instance_finalize = sdhci_sysbus_finalize,
+ .class_init = sdhci_sysbus_class_init,
};
static void sdhci_register_types(void)
{
- type_register_static(&sdhci_type_info);
+ type_register_static(&sdhci_sysbus_info);
}
type_init(sdhci_register_types)