[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 06/55] net/pcnet-pci: QOM Upcast Sweep
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PULL 06/55] net/pcnet-pci: QOM Upcast Sweep |
Date: |
Tue, 23 Jul 2013 01:45:47 +0200 |
From: Peter Crosthwaite <address@hidden>
Define and use standard QOM cast macro. Remove usages of DO_UPCAST()
and direct -> style upcasting.
Signed-off-by: Peter Crosthwaite <address@hidden>
[AF: Renamed parent field, renamed from PC_NET to PCNET]
Signed-off-by: Andreas Färber <address@hidden>
---
hw/net/pcnet-pci.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c
index f4a5aef..6ef28f7 100644
--- a/hw/net/pcnet-pci.c
+++ b/hw/net/pcnet-pci.c
@@ -43,9 +43,16 @@
//#define PCNET_DEBUG_TMD
//#define PCNET_DEBUG_MATCH
+#define TYPE_PCI_PCNET "pcnet"
+
+#define PCI_PCNET(obj) \
+ OBJECT_CHECK(PCIPCNetState, (obj), TYPE_PCI_PCNET)
typedef struct {
- PCIDevice pci_dev;
+ /*< private >*/
+ PCIDevice parent_obj;
+ /*< public >*/
+
PCNetState state;
MemoryRegion io_bar;
} PCIPCNetState;
@@ -236,7 +243,7 @@ static const VMStateDescription vmstate_pci_pcnet = {
.minimum_version_id = 2,
.minimum_version_id_old = 2,
.fields = (VMStateField []) {
- VMSTATE_PCI_DEVICE(pci_dev, PCIPCNetState),
+ VMSTATE_PCI_DEVICE(parent_obj, PCIPCNetState),
VMSTATE_STRUCT(state, PCIPCNetState, 0, vmstate_pcnet, PCNetState),
VMSTATE_END_OF_LIST()
}
@@ -273,7 +280,7 @@ static void pci_pcnet_cleanup(NetClientState *nc)
static void pci_pcnet_uninit(PCIDevice *dev)
{
- PCIPCNetState *d = DO_UPCAST(PCIPCNetState, pci_dev, dev);
+ PCIPCNetState *d = PCI_PCNET(dev);
memory_region_destroy(&d->state.mmio);
memory_region_destroy(&d->io_bar);
@@ -293,7 +300,7 @@ static NetClientInfo net_pci_pcnet_info = {
static int pci_pcnet_init(PCIDevice *pci_dev)
{
- PCIPCNetState *d = DO_UPCAST(PCIPCNetState, pci_dev, pci_dev);
+ PCIPCNetState *d = PCI_PCNET(pci_dev);
PCNetState *s = &d->state;
uint8_t *pci_conf;
@@ -329,12 +336,12 @@ static int pci_pcnet_init(PCIDevice *pci_dev)
s->phys_mem_write = pci_physical_memory_write;
s->dma_opaque = pci_dev;
- return pcnet_common_init(&pci_dev->qdev, s, &net_pci_pcnet_info);
+ return pcnet_common_init(DEVICE(pci_dev), s, &net_pci_pcnet_info);
}
static void pci_reset(DeviceState *dev)
{
- PCIPCNetState *d = DO_UPCAST(PCIPCNetState, pci_dev.qdev, dev);
+ PCIPCNetState *d = PCI_PCNET(dev);
pcnet_h_reset(&d->state);
}
@@ -362,7 +369,7 @@ static void pcnet_class_init(ObjectClass *klass, void *data)
}
static const TypeInfo pcnet_info = {
- .name = "pcnet",
+ .name = TYPE_PCI_PCNET,
.parent = TYPE_PCI_DEVICE,
.instance_size = sizeof(PCIPCNetState),
.class_init = pcnet_class_init,
--
1.8.1.4
- [Qemu-devel] [PULL 00/55] QOM devices patch queue 2013-07-22, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 02/55] net/e1000: QOM Upcast Sweep, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 01/55] hw: Avoid use of QOM type name macros in VMStateDescriptions, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 06/55] net/pcnet-pci: QOM Upcast Sweep,
Andreas Färber <=
- [Qemu-devel] [PULL 04/55] net/rtl8139: QOM Upcast Sweep, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 03/55] net/e1000: QOM parent field cleanup, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 07/55] usb/hcd-xhci: QOM Upcast Sweep, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 05/55] net/rtl8139: QOM parent field cleanup, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 09/55] scsi/lsi53c895a: QOM Upcast Sweep, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 11/55] scsi/megasas: QOM Upcast Sweep, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 12/55] scsi/megasas: QOM parent field cleanup, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 13/55] scsi/esp-pci: QOM Upcast Sweep, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 08/55] usb/hcd-xhci: QOM parent field cleanup, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 10/55] scsi/lsi53c895a: QOM parent field cleanup, Andreas Färber, 2013/07/22