lance: QOM cast cleanup
Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
3ff66d101b
commit
b1a2aaf774
|
@ -43,8 +43,13 @@
|
||||||
#include "pcnet.h"
|
#include "pcnet.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
|
#define TYPE_LANCE "lance"
|
||||||
|
#define SYSBUS_PCNET(obj) \
|
||||||
|
OBJECT_CHECK(SysBusPCNetState, (obj), TYPE_LANCE)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SysBusDevice busdev;
|
SysBusDevice parent_obj;
|
||||||
|
|
||||||
PCNetState state;
|
PCNetState state;
|
||||||
} SysBusPCNetState;
|
} SysBusPCNetState;
|
||||||
|
|
||||||
|
@ -112,28 +117,29 @@ static const VMStateDescription vmstate_lance = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int lance_init(SysBusDevice *dev)
|
static int lance_init(SysBusDevice *sbd)
|
||||||
{
|
{
|
||||||
SysBusPCNetState *d = FROM_SYSBUS(SysBusPCNetState, dev);
|
DeviceState *dev = DEVICE(sbd);
|
||||||
|
SysBusPCNetState *d = SYSBUS_PCNET(dev);
|
||||||
PCNetState *s = &d->state;
|
PCNetState *s = &d->state;
|
||||||
|
|
||||||
memory_region_init_io(&s->mmio, OBJECT(d), &lance_mem_ops, d,
|
memory_region_init_io(&s->mmio, OBJECT(d), &lance_mem_ops, d,
|
||||||
"lance-mmio", 4);
|
"lance-mmio", 4);
|
||||||
|
|
||||||
qdev_init_gpio_in(&dev->qdev, parent_lance_reset, 1);
|
qdev_init_gpio_in(dev, parent_lance_reset, 1);
|
||||||
|
|
||||||
sysbus_init_mmio(dev, &s->mmio);
|
sysbus_init_mmio(sbd, &s->mmio);
|
||||||
|
|
||||||
sysbus_init_irq(dev, &s->irq);
|
sysbus_init_irq(sbd, &s->irq);
|
||||||
|
|
||||||
s->phys_mem_read = ledma_memory_read;
|
s->phys_mem_read = ledma_memory_read;
|
||||||
s->phys_mem_write = ledma_memory_write;
|
s->phys_mem_write = ledma_memory_write;
|
||||||
return pcnet_common_init(&dev->qdev, s, &net_lance_info);
|
return pcnet_common_init(dev, s, &net_lance_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lance_reset(DeviceState *dev)
|
static void lance_reset(DeviceState *dev)
|
||||||
{
|
{
|
||||||
SysBusPCNetState *d = DO_UPCAST(SysBusPCNetState, busdev.qdev, dev);
|
SysBusPCNetState *d = SYSBUS_PCNET(dev);
|
||||||
|
|
||||||
pcnet_h_reset(&d->state);
|
pcnet_h_reset(&d->state);
|
||||||
}
|
}
|
||||||
|
@ -158,7 +164,7 @@ static void lance_class_init(ObjectClass *klass, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo lance_info = {
|
static const TypeInfo lance_info = {
|
||||||
.name = "lance",
|
.name = TYPE_LANCE,
|
||||||
.parent = TYPE_SYS_BUS_DEVICE,
|
.parent = TYPE_SYS_BUS_DEVICE,
|
||||||
.instance_size = sizeof(SysBusPCNetState),
|
.instance_size = sizeof(SysBusPCNetState),
|
||||||
.class_init = lance_class_init,
|
.class_init = lance_class_init,
|
||||||
|
|
Loading…
Reference in a new issue