[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 122/173] lance: QOM cast cleanup
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PULL 122/173] lance: QOM cast cleanup |
Date: |
Mon, 29 Jul 2013 21:19:39 +0200 |
Signed-off-by: Andreas Färber <address@hidden>
---
hw/net/lance.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/hw/net/lance.c b/hw/net/lance.c
index 1be7b72..e339f02 100644
--- a/hw/net/lance.c
+++ b/hw/net/lance.c
@@ -43,8 +43,13 @@
#include "pcnet.h"
#include "trace.h"
+#define TYPE_LANCE "lance"
+#define SYSBUS_PCNET(obj) \
+ OBJECT_CHECK(SysBusPCNetState, (obj), TYPE_LANCE)
+
typedef struct {
- SysBusDevice busdev;
+ SysBusDevice parent_obj;
+
PCNetState state;
} 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;
memory_region_init_io(&s->mmio, OBJECT(d), &lance_mem_ops, d,
"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_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)
{
- SysBusPCNetState *d = DO_UPCAST(SysBusPCNetState, busdev.qdev, dev);
+ SysBusPCNetState *d = SYSBUS_PCNET(dev);
pcnet_h_reset(&d->state);
}
@@ -158,7 +164,7 @@ static void lance_class_init(ObjectClass *klass, void *data)
}
static const TypeInfo lance_info = {
- .name = "lance",
+ .name = TYPE_LANCE,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(SysBusPCNetState),
.class_init = lance_class_init,
--
1.8.1.4
- [Qemu-devel] [PULL 164/173] sysbus: Drop FROM_SYSBUS(), (continued)
- [Qemu-devel] [PULL 164/173] sysbus: Drop FROM_SYSBUS(), Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 165/173] sysbus: Remove unused sysbus_new() prototype, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 163/173] xilinx_timer: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 103/173] slavio_intctl: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 099/173] pl190: Rename pl190_state to PL190State, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 173/173] sysbus: QOM parent field cleanup for SysBusDevice, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 169/173] kvmvapic: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 168/173] mipsnet: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 118/173] cadence_gem: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 171/173] ioapic: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 122/173] lance: QOM cast cleanup,
Andreas Färber <=
- [Qemu-devel] [PULL 170/173] kvm/ioapic: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 100/173] pl190: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 101/173] puv3_intc: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 117/173] zynq_slcr: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 166/173] exynos4210_i2c: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 102/173] realview_gic: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 120/173] etraxfs_eth: Rename fs_eth to ETRAXFSEthState, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 104/173] xilinx_intc: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 098/173] omap_intc: QOM'ify omap-intc and omap2-intc, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 121/173] lan9118: QOM cast cleanup, Andreas Färber, 2013/07/29