Skip to content

Commit

Permalink
gpio/zaurus: QOM cast cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Färber <afaerber@suse.de>
  • Loading branch information
afaerber committed Jul 29, 2013
1 parent 1ed09e2 commit a009de4
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions hw/gpio/zaurus.c
Expand Up @@ -24,9 +24,13 @@

/* SCOOP devices */

#define TYPE_SCOOP "scoop"
#define SCOOP(obj) OBJECT_CHECK(ScoopInfo, (obj), TYPE_SCOOP)

typedef struct ScoopInfo ScoopInfo;
struct ScoopInfo {
SysBusDevice busdev;
SysBusDevice parent_obj;

qemu_irq handler[16];
MemoryRegion iomem;
uint16_t status;
Expand Down Expand Up @@ -162,16 +166,17 @@ static void scoop_gpio_set(void *opaque, int line, int level)
s->gpio_level &= ~(1 << line);
}

static int scoop_init(SysBusDevice *dev)
static int scoop_init(SysBusDevice *sbd)
{
ScoopInfo *s = FROM_SYSBUS(ScoopInfo, dev);
DeviceState *dev = DEVICE(sbd);
ScoopInfo *s = SCOOP(dev);

s->status = 0x02;
qdev_init_gpio_out(&s->busdev.qdev, s->handler, 16);
qdev_init_gpio_in(&s->busdev.qdev, scoop_gpio_set, 16);
qdev_init_gpio_out(dev, s->handler, 16);
qdev_init_gpio_in(dev, scoop_gpio_set, 16);
memory_region_init_io(&s->iomem, OBJECT(s), &scoop_ops, s, "scoop", 0x1000);

sysbus_init_mmio(dev, &s->iomem);
sysbus_init_mmio(sbd, &s->iomem);

return 0;
}
Expand Down Expand Up @@ -237,7 +242,7 @@ static void scoop_sysbus_class_init(ObjectClass *klass, void *data)
}

static const TypeInfo scoop_sysbus_info = {
.name = "scoop",
.name = TYPE_SCOOP,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(ScoopInfo),
.class_init = scoop_sysbus_class_init,
Expand Down

0 comments on commit a009de4

Please sign in to comment.