omap_gpio: QOM cast cleanup for omap_gpif_s

Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
Andreas Färber 2013-07-26 17:14:40 +02:00
parent 049e7d226e
commit 1d300b5f6f

View File

@ -35,8 +35,13 @@ struct omap_gpio_s {
uint16_t pins; uint16_t pins;
}; };
#define TYPE_OMAP1_GPIO "omap-gpio"
#define OMAP1_GPIO(obj) \
OBJECT_CHECK(struct omap_gpif_s, (obj), TYPE_OMAP1_GPIO)
struct omap_gpif_s { struct omap_gpif_s {
SysBusDevice busdev; SysBusDevice parent_obj;
MemoryRegion iomem; MemoryRegion iomem;
int mpu_model; int mpu_model;
void *clk; void *clk;
@ -587,8 +592,8 @@ static const MemoryRegionOps omap2_gpio_module_ops = {
static void omap_gpif_reset(DeviceState *dev) static void omap_gpif_reset(DeviceState *dev)
{ {
struct omap_gpif_s *s = FROM_SYSBUS(struct omap_gpif_s, struct omap_gpif_s *s = OMAP1_GPIO(dev);
SYS_BUS_DEVICE(dev));
omap_gpio_reset(&s->omap1); omap_gpio_reset(&s->omap1);
} }
@ -668,18 +673,20 @@ static const MemoryRegionOps omap2_gpif_top_ops = {
.endianness = DEVICE_NATIVE_ENDIAN, .endianness = DEVICE_NATIVE_ENDIAN,
}; };
static int omap_gpio_init(SysBusDevice *dev) static int omap_gpio_init(SysBusDevice *sbd)
{ {
struct omap_gpif_s *s = FROM_SYSBUS(struct omap_gpif_s, dev); DeviceState *dev = DEVICE(sbd);
struct omap_gpif_s *s = OMAP1_GPIO(dev);
if (!s->clk) { if (!s->clk) {
hw_error("omap-gpio: clk not connected\n"); hw_error("omap-gpio: clk not connected\n");
} }
qdev_init_gpio_in(&dev->qdev, omap_gpio_set, 16); qdev_init_gpio_in(dev, omap_gpio_set, 16);
qdev_init_gpio_out(&dev->qdev, s->omap1.handler, 16); qdev_init_gpio_out(dev, s->omap1.handler, 16);
sysbus_init_irq(dev, &s->omap1.irq); sysbus_init_irq(sbd, &s->omap1.irq);
memory_region_init_io(&s->iomem, OBJECT(s), &omap_gpio_ops, &s->omap1, memory_region_init_io(&s->iomem, OBJECT(s), &omap_gpio_ops, &s->omap1,
"omap.gpio", 0x1000); "omap.gpio", 0x1000);
sysbus_init_mmio(dev, &s->iomem); sysbus_init_mmio(sbd, &s->iomem);
return 0; return 0;
} }
@ -748,7 +755,7 @@ static void omap_gpio_class_init(ObjectClass *klass, void *data)
} }
static const TypeInfo omap_gpio_info = { static const TypeInfo omap_gpio_info = {
.name = "omap-gpio", .name = TYPE_OMAP1_GPIO,
.parent = TYPE_SYS_BUS_DEVICE, .parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(struct omap_gpif_s), .instance_size = sizeof(struct omap_gpif_s),
.class_init = omap_gpio_class_init, .class_init = omap_gpio_class_init,