diff options
author | Andreas Färber <afaerber@suse.de> | 2013-07-26 18:28:26 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-07-29 21:06:57 +0200 |
commit | 93e7f5f42d0d3663acb94b24c8a9a329b5b13917 (patch) | |
tree | aae46ef366a2449c33290205ce40d9818b5f8daf /hw/i2c | |
parent | 60ecfcb354e526c29874af17bbadaabeff47409c (diff) | |
download | hqemu-93e7f5f42d0d3663acb94b24c8a9a329b5b13917.zip hqemu-93e7f5f42d0d3663acb94b24c8a9a329b5b13917.tar.gz |
versatile_i2c: QOM cast cleanup
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/i2c')
-rw-r--r-- | hw/i2c/versatile_i2c.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/hw/i2c/versatile_i2c.c b/hw/i2c/versatile_i2c.c index 204dd3d..02e9f17 100644 --- a/hw/i2c/versatile_i2c.c +++ b/hw/i2c/versatile_i2c.c @@ -24,8 +24,13 @@ #include "hw/sysbus.h" #include "bitbang_i2c.h" -typedef struct { - SysBusDevice busdev; +#define TYPE_VERSATILE_I2C "versatile_i2c" +#define VERSATILE_I2C(obj) \ + OBJECT_CHECK(VersatileI2CState, (obj), TYPE_VERSATILE_I2C) + +typedef struct VersatileI2CState { + SysBusDevice parent_obj; + MemoryRegion iomem; bitbang_i2c_interface *bitbang; int out; @@ -72,16 +77,17 @@ static const MemoryRegionOps versatile_i2c_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; -static int versatile_i2c_init(SysBusDevice *dev) +static int versatile_i2c_init(SysBusDevice *sbd) { - VersatileI2CState *s = FROM_SYSBUS(VersatileI2CState, dev); + DeviceState *dev = DEVICE(sbd); + VersatileI2CState *s = VERSATILE_I2C(dev); i2c_bus *bus; - bus = i2c_init_bus(&dev->qdev, "i2c"); + bus = i2c_init_bus(dev, "i2c"); s->bitbang = bitbang_i2c_init(bus); memory_region_init_io(&s->iomem, OBJECT(s), &versatile_i2c_ops, s, "versatile_i2c", 0x1000); - sysbus_init_mmio(dev, &s->iomem); + sysbus_init_mmio(sbd, &s->iomem); return 0; } @@ -93,7 +99,7 @@ static void versatile_i2c_class_init(ObjectClass *klass, void *data) } static const TypeInfo versatile_i2c_info = { - .name = "versatile_i2c", + .name = TYPE_VERSATILE_I2C, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(VersatileI2CState), .class_init = versatile_i2c_class_init, |