* [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land
@ 2013-06-11 6:40 peter.crosthwaite
2013-06-11 6:40 ` [Qemu-devel] [RFT PATCH v1 01/30] net/e1000: QOM Upcast Sweep peter.crosthwaite
` (29 more replies)
0 siblings, 30 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:40 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
There are a number of different cast implementations from various
stages of QEMU development out in device model land. This series cleans
up the ones involving TYPE_PCI_DEVICE to consistently use proper QOM
casts for both up and down casts.
Some were easy, some needed QOM cast macros which are added as
appropriate.
Following the recent discussion RE performance consequences of QOM
casts, im interested in any reports of possible performance regressions
here, although I am hoping that Anthony current efforts to improve
QOM casting efficiency make this a non-issue.
Peter Crosthwaite (30):
net/e1000: QOM Upcast Sweep
net/rtl8139: QOM Upcast Sweep
net/pcnet-pci: QOM Upcast Sweep
usb/hcd-xhci: QOM Upcast Sweep
scsi/lsi53c895a: QOM Upcast Sweep
scsi/megasas: QOM Upcast Sweep
scsi/esp-pci: QOM Upcast Sweep
ide/ich: QOM Upcast Sweep
ide/piix: QOM casting sweep
acpi/piix4: QOM Upcast Sweep
misc/pci-testdev: QOM Upcast Sweep
virtio/virtio-pci: QOM casting sweep
virtio/vmware_vga: QOM casting sweep
misc/ivshmem: QOM Upcast Sweep
xen/xen_platform: QOM casting sweep
isa/*: QOM casting sweep
pci/*: QOM casting sweep
pci-bridge/pci_bridge_dev: Don't use DO_UPCAST
pci-bridge/*: substitute ->qdev casts with DEVICE()
misc/vfio: substitute ->qdev casts with DEVICE()
net/eepro100: substitute ->qdev casts with DEVICE()
net/ne2000: substitute ->qdev casts with DEVICE()
usb/*: substitute ->qdev casts with DEVICE()
watchdog/wdt_i6300esb: substitute ->qdev casts with DEVICE()
scsi/vmw_pvscsi: substitute ->qdev casts with DEVICE()
i2c/smbus_ich9: substitute ->qdev casts with DEVICE()
ide/cmd646: substitute ->qdev casts with DEVICE()
ide/via: substitute ->qdev casts with DEVICE()
pci-host/*: substitute ->qdev casts with DEVICE()
i386/*: substitute ->qdev casts with DEVICE()
hw/acpi/piix4.c | 31 +++++++++++++++++--------------
hw/display/vmware_vga.c | 13 ++++++++-----
hw/i2c/smbus_ich9.c | 2 +-
hw/i386/kvm/pci-assign.c | 21 ++++++++++++---------
hw/i386/pc.c | 4 ++--
hw/i386/pc_piix.c | 4 ++--
hw/i386/pc_q35.c | 4 ++--
hw/ide/ahci.h | 5 +++++
hw/ide/cmd646.c | 8 ++++----
hw/ide/ich.c | 10 +++++-----
hw/ide/piix.c | 8 ++++----
hw/ide/via.c | 4 ++--
hw/isa/i82378.c | 8 ++++----
hw/isa/lpc_ich9.c | 6 +++---
hw/isa/piix4.c | 4 ++--
hw/isa/vt82c686.c | 14 +++++++-------
hw/misc/ivshmem.c | 18 +++++++++++-------
hw/misc/pci-testdev.c | 11 ++++++++---
hw/misc/vfio.c | 4 ++--
hw/net/e1000.c | 20 +++++++++++++-------
hw/net/eepro100.c | 14 ++++++++------
hw/net/ne2000.c | 6 ++++--
hw/net/pcnet-pci.c | 14 +++++++++-----
hw/net/rtl8139.c | 26 ++++++++++++++++++--------
hw/pci-bridge/dec.c | 2 +-
hw/pci-bridge/i82801b11.c | 2 +-
hw/pci-bridge/ioh3420.c | 2 +-
hw/pci-bridge/pci_bridge_dev.c | 2 +-
hw/pci-bridge/xio3130_downstream.c | 2 +-
hw/pci-bridge/xio3130_upstream.c | 2 +-
hw/pci-host/apb.c | 4 ++--
hw/pci-host/q35.c | 4 ++--
hw/pci/pci-hotplug.c | 18 ++++++++++--------
hw/pci/pci.c | 17 +++++++++--------
hw/pci/pci_bridge.c | 7 ++++---
hw/pci/pcie.c | 4 ++--
hw/pci/shpc.c | 8 ++++----
hw/scsi/esp-pci.c | 14 +++++++++-----
hw/scsi/lsi53c895a.c | 26 ++++++++++++++++----------
hw/scsi/megasas.c | 17 +++++++++++------
hw/scsi/vmw_pvscsi.c | 2 +-
hw/usb/hcd-ehci-pci.c | 13 ++++++++-----
hw/usb/hcd-ohci.c | 2 +-
hw/usb/hcd-uhci.c | 2 +-
hw/usb/hcd-xhci.c | 19 +++++++++++++------
hw/virtio/virtio-pci.c | 4 ++--
hw/watchdog/wdt_i6300esb.c | 2 +-
hw/xen/xen_platform.c | 28 ++++++++++++++++------------
48 files changed, 271 insertions(+), 191 deletions(-)
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 01/30] net/e1000: QOM Upcast Sweep
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
@ 2013-06-11 6:40 ` peter.crosthwaite
2013-06-24 3:42 ` Peter Crosthwaite
2013-06-11 6:41 ` [Qemu-devel] [RFT PATCH v1 02/30] net/rtl8139: " peter.crosthwaite
` (28 subsequent siblings)
29 siblings, 1 reply; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:40 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Define and use standard QOM cast macro. Remove usages of DO_UPCAST
and direct -> style upcasting.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/net/e1000.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index e6f46f0..a7de400 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -138,6 +138,11 @@ typedef struct E1000State_st {
uint32_t compat_flags;
} E1000State;
+#define TYPE_E1000 "e1000"
+
+#define E1000(obj) \
+ OBJECT_CHECK(E1000State, (obj), TYPE_E1000)
+
#define defreg(x) x = (E1000_##x>>2)
enum {
defreg(CTRL), defreg(EECD), defreg(EERD), defreg(GPRC),
@@ -1175,7 +1180,7 @@ static int e1000_post_load(void *opaque, int version_id)
}
static const VMStateDescription vmstate_e1000 = {
- .name = "e1000",
+ .name = TYPE_E1000,
.version_id = 2,
.minimum_version_id = 1,
.minimum_version_id_old = 1,
@@ -1296,7 +1301,7 @@ e1000_cleanup(NetClientState *nc)
static void
pci_e1000_uninit(PCIDevice *dev)
{
- E1000State *d = DO_UPCAST(E1000State, dev, dev);
+ E1000State *d = E1000(dev);
qemu_del_timer(d->autoneg_timer);
qemu_free_timer(d->autoneg_timer);
@@ -1316,7 +1321,8 @@ static NetClientInfo net_e1000_info = {
static int pci_e1000_init(PCIDevice *pci_dev)
{
- E1000State *d = DO_UPCAST(E1000State, dev, pci_dev);
+ DeviceState *dev = DEVICE(pci_dev);
+ E1000State *d = E1000(pci_dev);
uint8_t *pci_conf;
uint16_t checksum = 0;
int i;
@@ -1347,11 +1353,11 @@ static int pci_e1000_init(PCIDevice *pci_dev)
d->eeprom_data[EEPROM_CHECKSUM_REG] = checksum;
d->nic = qemu_new_nic(&net_e1000_info, &d->conf,
- object_get_typename(OBJECT(d)), d->dev.qdev.id, d);
+ object_get_typename(OBJECT(d)), dev->id, d);
qemu_format_nic_info_str(qemu_get_queue(d->nic), macaddr);
- add_boot_device_path(d->conf.bootindex, &pci_dev->qdev, "/ethernet-phy@0");
+ add_boot_device_path(d->conf.bootindex, dev, "/ethernet-phy@0");
d->autoneg_timer = qemu_new_timer_ms(vm_clock, e1000_autoneg_timer, d);
@@ -1360,7 +1366,7 @@ static int pci_e1000_init(PCIDevice *pci_dev)
static void qdev_e1000_reset(DeviceState *dev)
{
- E1000State *d = DO_UPCAST(E1000State, dev.qdev, dev);
+ E1000State *d = E1000(dev);
e1000_reset(d);
}
@@ -1390,7 +1396,7 @@ static void e1000_class_init(ObjectClass *klass, void *data)
}
static const TypeInfo e1000_info = {
- .name = "e1000",
+ .name = TYPE_E1000,
.parent = TYPE_PCI_DEVICE,
.instance_size = sizeof(E1000State),
.class_init = e1000_class_init,
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 02/30] net/rtl8139: QOM Upcast Sweep
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
2013-06-11 6:40 ` [Qemu-devel] [RFT PATCH v1 01/30] net/e1000: QOM Upcast Sweep peter.crosthwaite
@ 2013-06-11 6:41 ` peter.crosthwaite
2013-06-11 6:42 ` [Qemu-devel] [RFT PATCH v1 03/30] net/pcnet-pci: " peter.crosthwaite
` (27 subsequent siblings)
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:41 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Define and use standard QOM cast macro. Remove usages of DO_UPCAST
and direct -> style upcasting.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/net/rtl8139.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
index 7993f9f..955d35e 100644
--- a/hw/net/rtl8139.c
+++ b/hw/net/rtl8139.c
@@ -92,6 +92,11 @@ static inline GCC_FMT_ATTR(1, 2) int DPRINTF(const char *fmt, ...)
}
#endif
+#define TYPE_RTL8139 "rtl8139"
+
+#define RTL8139(obj) \
+ OBJECT_CHECK(RTL8139State, (obj), TYPE_RTL8139)
+
/* Symbolic offsets to registers. */
enum RTL8139_registers {
MAC0 = 0, /* Ethernet hardware address. */
@@ -1197,7 +1202,7 @@ static void rtl8139_reset_rxring(RTL8139State *s, uint32_t bufferSize)
static void rtl8139_reset(DeviceState *d)
{
- RTL8139State *s = container_of(d, RTL8139State, dev.qdev);
+ RTL8139State *s = RTL8139(d);
int i;
/* restore MAC address */
@@ -1364,6 +1369,8 @@ static const VMStateDescription vmstate_tally_counters = {
static void rtl8139_ChipCmd_write(RTL8139State *s, uint32_t val)
{
+ DeviceState *d = DEVICE(s);
+
val &= 0xff;
DPRINTF("ChipCmd write val=0x%08x\n", val);
@@ -1371,7 +1378,7 @@ static void rtl8139_ChipCmd_write(RTL8139State *s, uint32_t val)
if (val & CmdReset)
{
DPRINTF("ChipCmd reset\n");
- rtl8139_reset(&s->dev.qdev);
+ rtl8139_reset(d);
}
if (val & CmdRxEnb)
{
@@ -1525,6 +1532,8 @@ static uint32_t rtl8139_BasicModeStatus_read(RTL8139State *s)
static void rtl8139_Cfg9346_write(RTL8139State *s, uint32_t val)
{
+ DeviceState *d = DEVICE(s);
+
val &= 0xff;
DPRINTF("Cfg9346 write val=0x%02x\n", val);
@@ -1544,7 +1553,7 @@ static void rtl8139_Cfg9346_write(RTL8139State *s, uint32_t val)
} else if (opmode == 0x40) {
/* Reset. */
val = 0;
- rtl8139_reset(&s->dev.qdev);
+ rtl8139_reset(d);
}
s->Cfg9346 = val;
@@ -3439,7 +3448,7 @@ static void rtl8139_cleanup(NetClientState *nc)
static void pci_rtl8139_uninit(PCIDevice *dev)
{
- RTL8139State *s = DO_UPCAST(RTL8139State, dev, dev);
+ RTL8139State *s = RTL8139(dev);
memory_region_destroy(&s->bar_io);
memory_region_destroy(&s->bar_mem);
@@ -3477,7 +3486,8 @@ static NetClientInfo net_rtl8139_info = {
static int pci_rtl8139_init(PCIDevice *dev)
{
- RTL8139State * s = DO_UPCAST(RTL8139State, dev, dev);
+ RTL8139State *s = RTL8139(dev);
+ DeviceState *d = DEVICE(dev);
uint8_t *pci_conf;
pci_conf = s->dev.config;
@@ -3505,7 +3515,7 @@ static int pci_rtl8139_init(PCIDevice *dev)
s->eeprom.contents[9] = s->conf.macaddr.a[4] | s->conf.macaddr.a[5] << 8;
s->nic = qemu_new_nic(&net_rtl8139_info, &s->conf,
- object_get_typename(OBJECT(dev)), dev->qdev.id, s);
+ object_get_typename(OBJECT(dev)), d->id, s);
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
s->cplus_txbuffer = NULL;
@@ -3516,7 +3526,7 @@ static int pci_rtl8139_init(PCIDevice *dev)
s->timer = qemu_new_timer_ns(vm_clock, rtl8139_timer, s);
rtl8139_set_next_tctr_time(s, qemu_get_clock_ns(vm_clock));
- add_boot_device_path(s->conf.bootindex, &dev->qdev, "/ethernet-phy@0");
+ add_boot_device_path(s->conf.bootindex, d, "/ethernet-phy@0");
return 0;
}
@@ -3544,7 +3554,7 @@ static void rtl8139_class_init(ObjectClass *klass, void *data)
}
static const TypeInfo rtl8139_info = {
- .name = "rtl8139",
+ .name = TYPE_RTL8139,
.parent = TYPE_PCI_DEVICE,
.instance_size = sizeof(RTL8139State),
.class_init = rtl8139_class_init,
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 03/30] net/pcnet-pci: QOM Upcast Sweep
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
2013-06-11 6:40 ` [Qemu-devel] [RFT PATCH v1 01/30] net/e1000: QOM Upcast Sweep peter.crosthwaite
2013-06-11 6:41 ` [Qemu-devel] [RFT PATCH v1 02/30] net/rtl8139: " peter.crosthwaite
@ 2013-06-11 6:42 ` peter.crosthwaite
2013-06-11 6:43 ` [Qemu-devel] [RFT PATCH v1 04/30] usb/hcd-xhci: " peter.crosthwaite
` (26 subsequent siblings)
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:42 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Define and use standard QOM cast macro. Remove usages of DO_UPCAST
and direct -> style upcasting.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/net/pcnet-pci.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c
index 9df2b87..b1afbf4 100644
--- a/hw/net/pcnet-pci.c
+++ b/hw/net/pcnet-pci.c
@@ -43,6 +43,10 @@
//#define PCNET_DEBUG_TMD
//#define PCNET_DEBUG_MATCH
+#define TYPE_PCI_PC_NET "pcnet"
+
+#define PCI_PC_NET(obj) \
+ OBJECT_CHECK(PCIPCNetState, (obj), TYPE_PCI_PC_NET)
typedef struct {
PCIDevice pci_dev;
@@ -273,7 +277,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_PC_NET(dev);
memory_region_destroy(&d->state.mmio);
memory_region_destroy(&d->io_bar);
@@ -293,7 +297,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_PC_NET(pci_dev);
PCNetState *s = &d->state;
uint8_t *pci_conf;
@@ -329,12 +333,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_PC_NET(dev);
pcnet_h_reset(&d->state);
}
@@ -362,7 +366,7 @@ static void pcnet_class_init(ObjectClass *klass, void *data)
}
static const TypeInfo pcnet_info = {
- .name = "pcnet",
+ .name = TYPE_PCI_PC_NET,
.parent = TYPE_PCI_DEVICE,
.instance_size = sizeof(PCIPCNetState),
.class_init = pcnet_class_init,
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 04/30] usb/hcd-xhci: QOM Upcast Sweep
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (2 preceding siblings ...)
2013-06-11 6:42 ` [Qemu-devel] [RFT PATCH v1 03/30] net/pcnet-pci: " peter.crosthwaite
@ 2013-06-11 6:43 ` peter.crosthwaite
2013-06-11 6:43 ` [Qemu-devel] [RFT PATCH v1 05/30] scsi/lsi53c895a: " peter.crosthwaite
` (25 subsequent siblings)
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:43 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Define and use standard QOM cast macro. Remove usages of DO_UPCAST
and direct -> style upcasting.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/usb/hcd-xhci.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 91633ed..0146711 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -482,6 +482,11 @@ struct XHCIState {
XHCIRing cmd_ring;
};
+#define TYPE_XHCI "nec-usb-xhci"
+
+#define XHCI(obj) \
+ OBJECT_CHECK(XHCIState, (obj), TYPE_XHCI)
+
typedef struct XHCIEvRingSeg {
uint32_t addr_low;
uint32_t addr_high;
@@ -2681,7 +2686,7 @@ static void xhci_port_reset(XHCIPort *port)
static void xhci_reset(DeviceState *dev)
{
- XHCIState *xhci = DO_UPCAST(XHCIState, pci_dev.qdev, dev);
+ XHCIState *xhci = XHCI(dev);
int i;
trace_usb_xhci_reset();
@@ -2926,6 +2931,7 @@ static void xhci_oper_write(void *ptr, hwaddr reg,
uint64_t val, unsigned size)
{
XHCIState *xhci = ptr;
+ DeviceState *d = DEVICE(ptr);
trace_usb_xhci_oper_write(reg, val);
@@ -2939,7 +2945,7 @@ static void xhci_oper_write(void *ptr, hwaddr reg,
xhci->usbcmd = val & 0xc0f;
xhci_mfwrap_update(xhci);
if (val & USBCMD_HCRST) {
- xhci_reset(&xhci->pci_dev.qdev);
+ xhci_reset(d);
}
xhci_intx_update(xhci);
break;
@@ -3267,6 +3273,7 @@ static USBBusOps xhci_bus_ops = {
static void usb_xhci_init(XHCIState *xhci, DeviceState *dev)
{
+ DeviceState *d = DEVICE(xhci);
XHCIPort *port;
int i, usbports, speedmask;
@@ -3281,7 +3288,7 @@ static void usb_xhci_init(XHCIState *xhci, DeviceState *dev)
usbports = MAX(xhci->numports_2, xhci->numports_3);
xhci->numports = xhci->numports_2 + xhci->numports_3;
- usb_bus_new(&xhci->bus, &xhci_bus_ops, &xhci->pci_dev.qdev);
+ usb_bus_new(&xhci->bus, &xhci_bus_ops, d);
for (i = 0; i < usbports; i++) {
speedmask = 0;
@@ -3313,14 +3320,14 @@ static int usb_xhci_initfn(struct PCIDevice *dev)
{
int i, ret;
- XHCIState *xhci = DO_UPCAST(XHCIState, pci_dev, dev);
+ XHCIState *xhci = XHCI(dev);
xhci->pci_dev.config[PCI_CLASS_PROG] = 0x30; /* xHCI */
xhci->pci_dev.config[PCI_INTERRUPT_PIN] = 0x01; /* interrupt pin 1 */
xhci->pci_dev.config[PCI_CACHE_LINE_SIZE] = 0x10;
xhci->pci_dev.config[0x60] = 0x30; /* release number */
- usb_xhci_init(xhci, &dev->qdev);
+ usb_xhci_init(xhci, DEVICE(dev));
if (xhci->numintrs > MAXINTRS) {
xhci->numintrs = MAXINTRS;
@@ -3581,7 +3588,7 @@ static void xhci_class_init(ObjectClass *klass, void *data)
}
static const TypeInfo xhci_info = {
- .name = "nec-usb-xhci",
+ .name = TYPE_XHCI,
.parent = TYPE_PCI_DEVICE,
.instance_size = sizeof(XHCIState),
.class_init = xhci_class_init,
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 05/30] scsi/lsi53c895a: QOM Upcast Sweep
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (3 preceding siblings ...)
2013-06-11 6:43 ` [Qemu-devel] [RFT PATCH v1 04/30] usb/hcd-xhci: " peter.crosthwaite
@ 2013-06-11 6:43 ` peter.crosthwaite
2013-06-11 6:44 ` [Qemu-devel] [RFT PATCH v1 06/30] scsi/megasas: " peter.crosthwaite
` (24 subsequent siblings)
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:43 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Define and use standard QOM cast macro. Remove usages of DO_UPCAST
and direct -> style upcasting.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/scsi/lsi53c895a.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index 22b8e98..d488c5c 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -275,6 +275,11 @@ typedef struct {
uint32_t script_ram[2048];
} LSIState;
+#define TYPE_LSI53C895A "lsi53c895a"
+
+#define LSI53C895A(obj) \
+ OBJECT_CHECK(LSIState, (obj), TYPE_LSI53C895A)
+
static inline int lsi_irq_on_rsl(LSIState *s)
{
return (s->sien0 & LSI_SIST0_RSL) && (s->scid & LSI_SCID_RRE);
@@ -653,7 +658,7 @@ static void lsi_request_free(LSIState *s, lsi_request *p)
static void lsi_request_cancelled(SCSIRequest *req)
{
- LSIState *s = DO_UPCAST(LSIState, dev.qdev, req->bus->qbus.parent);
+ LSIState *s = LSI53C895A(req->bus->qbus.parent);
lsi_request *p = req->hba_private;
req->hba_private = NULL;
@@ -692,7 +697,7 @@ static int lsi_queue_req(LSIState *s, SCSIRequest *req, uint32_t len)
/* Callback to indicate that the SCSI layer has completed a command. */
static void lsi_command_complete(SCSIRequest *req, uint32_t status, size_t resid)
{
- LSIState *s = DO_UPCAST(LSIState, dev.qdev, req->bus->qbus.parent);
+ LSIState *s = LSI53C895A(req->bus->qbus.parent);
int out;
out = (s->sstat1 & PHASE_MASK) == PHASE_DO;
@@ -717,7 +722,7 @@ static void lsi_command_complete(SCSIRequest *req, uint32_t status, size_t resid
/* Callback to indicate that the SCSI layer has completed a transfer. */
static void lsi_transfer_data(SCSIRequest *req, uint32_t len)
{
- LSIState *s = DO_UPCAST(LSIState, dev.qdev, req->bus->qbus.parent);
+ LSIState *s = LSI53C895A(req->bus->qbus.parent);
int out;
assert(req->hba_private);
@@ -1726,7 +1731,7 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val)
lsi_execute_script(s);
}
if (val & LSI_ISTAT0_SRST) {
- qdev_reset_all(&s->dev.qdev);
+ qdev_reset_all(DEVICE(s));
}
break;
case 0x16: /* MBOX0 */
@@ -1960,7 +1965,7 @@ static const MemoryRegionOps lsi_io_ops = {
static void lsi_scsi_reset(DeviceState *dev)
{
- LSIState *s = DO_UPCAST(LSIState, dev.qdev, dev);
+ LSIState *s = LSI53C895A(dev);
lsi_soft_reset(s);
}
@@ -2061,7 +2066,7 @@ static const VMStateDescription vmstate_lsi_scsi = {
static void lsi_scsi_uninit(PCIDevice *d)
{
- LSIState *s = DO_UPCAST(LSIState, dev, d);
+ LSIState *s = LSI53C895A(d);
memory_region_destroy(&s->mmio_io);
memory_region_destroy(&s->ram_io);
@@ -2080,7 +2085,8 @@ static const struct SCSIBusInfo lsi_scsi_info = {
static int lsi_scsi_init(PCIDevice *dev)
{
- LSIState *s = DO_UPCAST(LSIState, dev, dev);
+ LSIState *s = LSI53C895A(dev);
+ DeviceState *d = DEVICE(dev);
uint8_t *pci_conf;
pci_conf = s->dev.config;
@@ -2099,8 +2105,8 @@ static int lsi_scsi_init(PCIDevice *dev)
pci_register_bar(&s->dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->ram_io);
QTAILQ_INIT(&s->queue);
- scsi_bus_new(&s->bus, &dev->qdev, &lsi_scsi_info, NULL);
- if (!dev->qdev.hotplugged) {
+ scsi_bus_new(&s->bus, d, &lsi_scsi_info, NULL);
+ if (!d->hotplugged) {
return scsi_bus_legacy_handle_cmdline(&s->bus);
}
return 0;
@@ -2122,7 +2128,7 @@ static void lsi_class_init(ObjectClass *klass, void *data)
}
static const TypeInfo lsi_info = {
- .name = "lsi53c895a",
+ .name = TYPE_LSI53C895A,
.parent = TYPE_PCI_DEVICE,
.instance_size = sizeof(LSIState),
.class_init = lsi_class_init,
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 06/30] scsi/megasas: QOM Upcast Sweep
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (4 preceding siblings ...)
2013-06-11 6:43 ` [Qemu-devel] [RFT PATCH v1 05/30] scsi/lsi53c895a: " peter.crosthwaite
@ 2013-06-11 6:44 ` peter.crosthwaite
2013-06-24 3:42 ` Peter Crosthwaite
2013-06-11 6:45 ` [Qemu-devel] [RFT PATCH v1 07/30] scsi/esp-pci: " peter.crosthwaite
` (23 subsequent siblings)
29 siblings, 1 reply; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:44 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Define and use standard QOM cast macro. Remove usages of DO_UPCAST
and direct -> style upcasting.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/scsi/megasas.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index fe6550c..21eaf4f 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -108,6 +108,11 @@ typedef struct MegasasState {
SCSIBus bus;
} MegasasState;
+#define TYPE_MEGASAS "megasas"
+
+#define MEGASAS(obj) \
+ OBJECT_CHECK(MegasasState, (obj), TYPE_MEGASAS)
+
#define MEGASAS_INTR_DISABLED_MASK 0xFFFFFFFF
static bool megasas_intr_enabled(MegasasState *s)
@@ -2039,13 +2044,13 @@ static void megasas_soft_reset(MegasasState *s)
static void megasas_scsi_reset(DeviceState *dev)
{
- MegasasState *s = DO_UPCAST(MegasasState, dev.qdev, dev);
+ MegasasState *s = MEGASAS(dev);
megasas_soft_reset(s);
}
static const VMStateDescription vmstate_megasas = {
- .name = "megasas",
+ .name = TYPE_MEGASAS,
.version_id = 0,
.minimum_version_id = 0,
.minimum_version_id_old = 0,
@@ -2064,7 +2069,7 @@ static const VMStateDescription vmstate_megasas = {
static void megasas_scsi_uninit(PCIDevice *d)
{
- MegasasState *s = DO_UPCAST(MegasasState, dev, d);
+ MegasasState *s = MEGASAS(d);
#ifdef USE_MSIX
msix_uninit(&s->dev, &s->mmio_io);
@@ -2087,7 +2092,7 @@ static const struct SCSIBusInfo megasas_scsi_info = {
static int megasas_scsi_init(PCIDevice *dev)
{
- MegasasState *s = DO_UPCAST(MegasasState, dev, dev);
+ MegasasState *s = MEGASAS(dev);
uint8_t *pci_conf;
int i, bar_type;
@@ -2158,7 +2163,7 @@ static int megasas_scsi_init(PCIDevice *dev)
s->frames[i].state = s;
}
- scsi_bus_new(&s->bus, &dev->qdev, &megasas_scsi_info, NULL);
+ scsi_bus_new(&s->bus, DEVICE(dev), &megasas_scsi_info, NULL);
scsi_bus_legacy_handle_cmdline(&s->bus);
return 0;
}
@@ -2198,7 +2203,7 @@ static void megasas_class_init(ObjectClass *oc, void *data)
}
static const TypeInfo megasas_info = {
- .name = "megasas",
+ .name = TYPE_MEGASAS,
.parent = TYPE_PCI_DEVICE,
.instance_size = sizeof(MegasasState),
.class_init = megasas_class_init,
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 07/30] scsi/esp-pci: QOM Upcast Sweep
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (5 preceding siblings ...)
2013-06-11 6:44 ` [Qemu-devel] [RFT PATCH v1 06/30] scsi/megasas: " peter.crosthwaite
@ 2013-06-11 6:45 ` peter.crosthwaite
2013-06-11 6:46 ` [Qemu-devel] [RFT PATCH v1 08/30] ide/ich: " peter.crosthwaite
` (22 subsequent siblings)
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:45 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Define and use standard QOM cast macro. Remove usages of DO_UPCAST
and direct -> style upcasting.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/scsi/esp-pci.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/hw/scsi/esp-pci.c b/hw/scsi/esp-pci.c
index 029789a..2a72da6 100644
--- a/hw/scsi/esp-pci.c
+++ b/hw/scsi/esp-pci.c
@@ -31,6 +31,9 @@
#define TYPE_AM53C974_DEVICE "am53c974"
+#define PCI_ESP(obj) \
+ OBJECT_CHECK(PCIESPState, (obj), TYPE_AM53C974_DEVICE)
+
#define DMA_CMD 0x0
#define DMA_STC 0x1
#define DMA_SPA 0x2
@@ -288,7 +291,7 @@ static const MemoryRegionOps esp_pci_io_ops = {
static void esp_pci_hard_reset(DeviceState *dev)
{
- PCIESPState *pci = DO_UPCAST(PCIESPState, dev.qdev, dev);
+ PCIESPState *pci = PCI_ESP(dev);
esp_hard_reset(&pci->esp);
pci->dma_regs[DMA_CMD] &= ~(DMA_CMD_DIR | DMA_CMD_INTE_D | DMA_CMD_INTE_P
| DMA_CMD_MDL | DMA_CMD_DIAG | DMA_CMD_MASK);
@@ -336,7 +339,8 @@ static const struct SCSIBusInfo esp_pci_scsi_info = {
static int esp_pci_scsi_init(PCIDevice *dev)
{
- PCIESPState *pci = DO_UPCAST(PCIESPState, dev, dev);
+ PCIESPState *pci = PCI_ESP(dev);
+ DeviceState *d = DEVICE(dev);
ESPState *s = &pci->esp;
uint8_t *pci_conf;
@@ -354,8 +358,8 @@ static int esp_pci_scsi_init(PCIDevice *dev)
pci_register_bar(&pci->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &pci->io);
s->irq = pci->dev.irq[0];
- scsi_bus_new(&s->bus, &dev->qdev, &esp_pci_scsi_info, NULL);
- if (!dev->qdev.hotplugged) {
+ scsi_bus_new(&s->bus, d, &esp_pci_scsi_info, NULL);
+ if (!d->hotplugged) {
return scsi_bus_legacy_handle_cmdline(&s->bus);
}
return 0;
@@ -363,7 +367,7 @@ static int esp_pci_scsi_init(PCIDevice *dev)
static void esp_pci_scsi_uninit(PCIDevice *d)
{
- PCIESPState *pci = DO_UPCAST(PCIESPState, dev, d);
+ PCIESPState *pci = PCI_ESP(d);
memory_region_destroy(&pci->io);
}
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 08/30] ide/ich: QOM Upcast Sweep
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (6 preceding siblings ...)
2013-06-11 6:45 ` [Qemu-devel] [RFT PATCH v1 07/30] scsi/esp-pci: " peter.crosthwaite
@ 2013-06-11 6:46 ` peter.crosthwaite
2013-06-11 6:46 ` [Qemu-devel] [RFT PATCH v1 09/30] ide/piix: QOM casting sweep peter.crosthwaite
` (21 subsequent siblings)
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:46 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Define and use standard QOM cast macro. Remove usages of DO_UPCAST
and direct -> style upcasting.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/ide/ahci.h | 5 +++++
hw/ide/ich.c | 10 +++++-----
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/hw/ide/ahci.h b/hw/ide/ahci.h
index 85f37fe..37b85e5 100644
--- a/hw/ide/ahci.h
+++ b/hw/ide/ahci.h
@@ -305,6 +305,11 @@ typedef struct AHCIPCIState {
AHCIState ahci;
} AHCIPCIState;
+#define TYPE_ICH_AHCI "ich9-ahci"
+
+#define ICH_AHCI(obj) \
+ OBJECT_CHECK(AHCIPCIState, (obj), TYPE_ICH_AHCI)
+
extern const VMStateDescription vmstate_ahci;
#define VMSTATE_AHCI(_field, _state) { \
diff --git a/hw/ide/ich.c b/hw/ide/ich.c
index ed1f1a2..8b59988 100644
--- a/hw/ide/ich.c
+++ b/hw/ide/ich.c
@@ -92,7 +92,7 @@ static const VMStateDescription vmstate_ich9_ahci = {
static void pci_ich9_reset(DeviceState *dev)
{
- struct AHCIPCIState *d = DO_UPCAST(struct AHCIPCIState, card.qdev, dev);
+ struct AHCIPCIState *d = ICH_AHCI(dev);
ahci_reset(&d->ahci);
}
@@ -102,9 +102,9 @@ static int pci_ich9_ahci_init(PCIDevice *dev)
struct AHCIPCIState *d;
int sata_cap_offset;
uint8_t *sata_cap;
- d = DO_UPCAST(struct AHCIPCIState, card, dev);
+ d = ICH_AHCI(dev);
- ahci_init(&d->ahci, &dev->qdev, pci_dma_context(dev), 6);
+ ahci_init(&d->ahci, DEVICE(dev), pci_dma_context(dev), 6);
pci_config_set_prog_interface(d->card.config, AHCI_PROGMODE_MAJOR_REV_1);
@@ -141,7 +141,7 @@ static int pci_ich9_ahci_init(PCIDevice *dev)
static void pci_ich9_uninit(PCIDevice *dev)
{
struct AHCIPCIState *d;
- d = DO_UPCAST(struct AHCIPCIState, card, dev);
+ d = ICH_AHCI(dev);
msi_uninit(dev);
ahci_uninit(&d->ahci);
@@ -163,7 +163,7 @@ static void ich_ahci_class_init(ObjectClass *klass, void *data)
}
static const TypeInfo ich_ahci_info = {
- .name = "ich9-ahci",
+ .name = TYPE_ICH_AHCI,
.parent = TYPE_PCI_DEVICE,
.instance_size = sizeof(AHCIPCIState),
.class_init = ich_ahci_class_init,
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 09/30] ide/piix: QOM casting sweep
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (7 preceding siblings ...)
2013-06-11 6:46 ` [Qemu-devel] [RFT PATCH v1 08/30] ide/ich: " peter.crosthwaite
@ 2013-06-11 6:46 ` peter.crosthwaite
2013-06-11 6:47 ` [Qemu-devel] [RFT PATCH v1 10/30] acpi/piix4: QOM Upcast Sweep peter.crosthwaite
` (20 subsequent siblings)
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:46 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Use standard QOM cast macro. Remove usage of DO_UPCAST and
direct -> style upcasting.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/ide/piix.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index bf2856f..d0fdea3 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -135,7 +135,7 @@ static void pci_piix_init_ports(PCIIDEState *d) {
int i;
for (i = 0; i < 2; i++) {
- ide_bus_new(&d->bus[i], &d->dev.qdev, i, 2);
+ ide_bus_new(&d->bus[i], DEVICE(d), i, 2);
ide_init_ioport(&d->bus[i], NULL, port_info[i].iobase,
port_info[i].iobase2);
ide_init2(&d->bus[i], isa_get_irq(NULL, port_info[i].isairq));
@@ -159,7 +159,7 @@ static int pci_piix_ide_initfn(PCIDevice *dev)
bmdma_setup_bar(d);
pci_register_bar(&d->dev, 4, PCI_BASE_ADDRESS_SPACE_IO, &d->bmdma_bar);
- vmstate_register(&d->dev.qdev, 0, &vmstate_ide_pci, d);
+ vmstate_register(DEVICE(dev), 0, &vmstate_ide_pci, d);
pci_piix_init_ports(d);
@@ -173,7 +173,7 @@ static int pci_piix3_xen_ide_unplug(DeviceState *dev)
DriveInfo *di;
int i = 0;
- pci_dev = DO_UPCAST(PCIDevice, qdev, dev);
+ pci_dev = PCI_DEVICE(dev);
pci_ide = DO_UPCAST(PCIIDEState, dev, pci_dev);
for (; i < 3; i++) {
@@ -188,7 +188,7 @@ static int pci_piix3_xen_ide_unplug(DeviceState *dev)
drive_put_ref(di);
}
}
- qdev_reset_all(&(pci_ide->dev.qdev));
+ qdev_reset_all(DEVICE(dev));
return 0;
}
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 10/30] acpi/piix4: QOM Upcast Sweep
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (8 preceding siblings ...)
2013-06-11 6:46 ` [Qemu-devel] [RFT PATCH v1 09/30] ide/piix: QOM casting sweep peter.crosthwaite
@ 2013-06-11 6:47 ` peter.crosthwaite
2013-06-11 6:48 ` [Qemu-devel] [RFT PATCH v1 11/30] misc/pci-testdev: " peter.crosthwaite
` (19 subsequent siblings)
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:47 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Use standard QOM cast macro. Remove usages of DO_UPCAST
and direct -> style upcasting.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/acpi/piix4.c | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index e6525ac..83a8407 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -96,6 +96,11 @@ typedef struct PIIX4PMState {
Notifier cpu_added_notifier;
} PIIX4PMState;
+#define TYPE_PIIX4_PM "PIIX4_PM"
+
+#define PIIX4_PM(obj) \
+ OBJECT_CHECK(PIIX4PMState, (obj), TYPE_PIIX4_PM)
+
static void piix4_acpi_system_hot_add_init(MemoryRegion *parent,
PCIBus *bus, PIIX4PMState *s);
@@ -300,7 +305,7 @@ static const VMStateDescription vmstate_acpi = {
static void acpi_piix_eject_slot(PIIX4PMState *s, unsigned slots)
{
BusChild *kid, *next;
- BusState *bus = qdev_get_parent_bus(&s->dev.qdev);
+ BusState *bus = qdev_get_parent_bus(DEVICE(s));
int slot = ffs(slots) - 1;
bool slot_free = true;
@@ -326,8 +331,7 @@ static void acpi_piix_eject_slot(PIIX4PMState *s, unsigned slots)
static void piix4_update_hotplug(PIIX4PMState *s)
{
- PCIDevice *dev = &s->dev;
- BusState *bus = qdev_get_parent_bus(&dev->qdev);
+ BusState *bus = qdev_get_parent_bus(DEVICE(s));
BusChild *kid, *next;
/* Execute any pending removes during reset */
@@ -395,7 +399,7 @@ static void piix4_pm_machine_ready(Notifier *n, void *opaque)
static int piix4_pm_initfn(PCIDevice *dev)
{
- PIIX4PMState *s = DO_UPCAST(PIIX4PMState, dev, dev);
+ PIIX4PMState *s = PIIX4_PM(dev);
uint8_t *pci_conf;
pci_conf = s->dev.config;
@@ -418,7 +422,7 @@ static int piix4_pm_initfn(PCIDevice *dev)
pci_conf[0x90] = s->smb_io_base | 1;
pci_conf[0x91] = s->smb_io_base >> 8;
pci_conf[0xd2] = 0x09;
- pm_smbus_init(&s->dev.qdev, &s->smb);
+ pm_smbus_init(DEVICE(dev), &s->smb);
memory_region_set_enabled(&s->smb.io, pci_conf[0xd2] & 1);
memory_region_add_subregion(pci_address_space_io(dev),
s->smb_io_base, &s->smb.io);
@@ -449,18 +453,18 @@ i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
qemu_irq sci_irq, qemu_irq smi_irq,
int kvm_enabled, FWCfgState *fw_cfg)
{
- PCIDevice *dev;
+ DeviceState *dev;
PIIX4PMState *s;
- dev = pci_create(bus, devfn, "PIIX4_PM");
- qdev_prop_set_uint32(&dev->qdev, "smb_io_base", smb_io_base);
+ dev = DEVICE(pci_create(bus, devfn, TYPE_PIIX4_PM));
+ qdev_prop_set_uint32(dev, "smb_io_base", smb_io_base);
- s = DO_UPCAST(PIIX4PMState, dev, dev);
+ s = PIIX4_PM(dev);
s->irq = sci_irq;
s->smi_irq = smi_irq;
s->kvm_enabled = kvm_enabled;
- qdev_init_nofail(&dev->qdev);
+ qdev_init_nofail(dev);
if (fw_cfg) {
uint8_t suspend[6] = {128, 0, 0, 129, 128, 128};
@@ -500,7 +504,7 @@ static void piix4_pm_class_init(ObjectClass *klass, void *data)
}
static const TypeInfo piix4_pm_info = {
- .name = "PIIX4_PM",
+ .name = TYPE_PIIX4_PM,
.parent = TYPE_PCI_DEVICE,
.instance_size = sizeof(PIIX4PMState),
.class_init = piix4_pm_class_init,
@@ -678,7 +682,7 @@ static void piix4_acpi_system_hot_add_init(MemoryRegion *parent,
PCI_HOTPLUG_SIZE);
memory_region_add_subregion(parent, PCI_HOTPLUG_ADDR,
&s->io_pci);
- pci_bus_hotplug(bus, piix4_device_hotplug, &s->dev.qdev);
+ pci_bus_hotplug(bus, piix4_device_hotplug, DEVICE(s));
qemu_for_each_cpu(piix4_init_cpu_status, &s->gpe_cpu);
memory_region_init_io(&s->io_cpu, &cpu_hotplug_ops, s, "apci-cpu-hotplug",
@@ -704,8 +708,7 @@ static int piix4_device_hotplug(DeviceState *qdev, PCIDevice *dev,
PCIHotplugState state)
{
int slot = PCI_SLOT(dev->devfn);
- PIIX4PMState *s = DO_UPCAST(PIIX4PMState, dev,
- PCI_DEVICE(qdev));
+ PIIX4PMState *s = PIIX4_PM(qdev);
/* Don't send event when device is enabled during qemu machine creation:
* it is present on boot, no hotplug event is necessary. We do send an
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 11/30] misc/pci-testdev: QOM Upcast Sweep
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (9 preceding siblings ...)
2013-06-11 6:47 ` [Qemu-devel] [RFT PATCH v1 10/30] acpi/piix4: QOM Upcast Sweep peter.crosthwaite
@ 2013-06-11 6:48 ` peter.crosthwaite
2013-06-11 6:49 ` [Qemu-devel] [RFT PATCH v1 12/30] virtio/virtio-pci: QOM casting sweep peter.crosthwaite
` (18 subsequent siblings)
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:48 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Define and use standard QOM cast macro. Remove usages of DO_UPCAST
and direct -> style upcasting.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/misc/pci-testdev.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/hw/misc/pci-testdev.c b/hw/misc/pci-testdev.c
index 71ce5a3..add58b7 100644
--- a/hw/misc/pci-testdev.c
+++ b/hw/misc/pci-testdev.c
@@ -83,6 +83,11 @@ typedef struct PCITestDevState {
int current;
} PCITestDevState;
+#define TYPE_PCI_TEST_DEV "pci-testdev"
+
+#define PCI_TEST_DEV(obj) \
+ OBJECT_CHECK(PCITestDevState, (obj), TYPE_PCI_TEST_DEV)
+
#define IOTEST_IS_MEM(i) (strcmp(IOTEST_TYPE(i), "portio"))
#define IOTEST_REGION(d, i) (IOTEST_IS_MEM(i) ? &(d)->mmio : &(d)->portio)
#define IOTEST_SIZE(i) (IOTEST_IS_MEM(i) ? IOTEST_MEMSIZE : IOTEST_IOSIZE)
@@ -274,7 +279,7 @@ static int pci_testdev_init(PCIDevice *pci_dev)
static void
pci_testdev_uninit(PCIDevice *dev)
{
- PCITestDevState *d = DO_UPCAST(PCITestDevState, dev, dev);
+ PCITestDevState *d = PCI_TEST_DEV(dev);
int i;
pci_testdev_reset(d);
@@ -291,7 +296,7 @@ pci_testdev_uninit(PCIDevice *dev)
static void qdev_pci_testdev_reset(DeviceState *dev)
{
- PCITestDevState *d = DO_UPCAST(PCITestDevState, dev.qdev, dev);
+ PCITestDevState *d = PCI_TEST_DEV(dev);
pci_testdev_reset(d);
}
@@ -311,7 +316,7 @@ static void pci_testdev_class_init(ObjectClass *klass, void *data)
}
static const TypeInfo pci_testdev_info = {
- .name = "pci-testdev",
+ .name = TYPE_PCI_TEST_DEV,
.parent = TYPE_PCI_DEVICE,
.instance_size = sizeof(PCITestDevState),
.class_init = pci_testdev_class_init,
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 12/30] virtio/virtio-pci: QOM casting sweep
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (10 preceding siblings ...)
2013-06-11 6:48 ` [Qemu-devel] [RFT PATCH v1 11/30] misc/pci-testdev: " peter.crosthwaite
@ 2013-06-11 6:49 ` peter.crosthwaite
2013-06-11 7:09 ` Frederic Konrad
2013-06-11 6:49 ` [Qemu-devel] [RFT PATCH v1 13/30] virtio/vmware_vga: " peter.crosthwaite
` (17 subsequent siblings)
29 siblings, 1 reply; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:49 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Use standard QOM cast macro. Remove usages of container_of() and
direct -> style upcasting.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/virtio/virtio-pci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 444b71a..a6cad0d 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -98,7 +98,7 @@ static void virtio_pci_bus_new(VirtioBusState *bus, VirtIOPCIProxy *dev);
/* DeviceState to VirtIOPCIProxy. For use off data-path. TODO: use QOM. */
static inline VirtIOPCIProxy *to_virtio_pci_proxy(DeviceState *d)
{
- return container_of(d, VirtIOPCIProxy, pci_dev.qdev);
+ return VIRTIO_PCI(d);
}
/* DeviceState to VirtIOPCIProxy. Note: used on datapath,
@@ -106,7 +106,7 @@ static inline VirtIOPCIProxy *to_virtio_pci_proxy(DeviceState *d)
*/
static inline VirtIOPCIProxy *to_virtio_pci_proxy_fast(DeviceState *d)
{
- return container_of(d, VirtIOPCIProxy, pci_dev.qdev);
+ return VIRTIO_PCI(d);
}
static void virtio_pci_notify(DeviceState *d, uint16_t vector)
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 13/30] virtio/vmware_vga: QOM casting sweep
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (11 preceding siblings ...)
2013-06-11 6:49 ` [Qemu-devel] [RFT PATCH v1 12/30] virtio/virtio-pci: QOM casting sweep peter.crosthwaite
@ 2013-06-11 6:49 ` peter.crosthwaite
2013-06-11 6:50 ` [Qemu-devel] [RFT PATCH v1 14/30] misc/ivshmem: QOM Upcast Sweep peter.crosthwaite
` (16 subsequent siblings)
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:49 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Define and use standard QOM cast macro. Remove usages of DO_UPCAST and
direct -> style casting.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/display/vmware_vga.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
index fd3569d..0e2aa3f 100644
--- a/hw/display/vmware_vga.c
+++ b/hw/display/vmware_vga.c
@@ -81,6 +81,11 @@ struct vmsvga_state_s {
int redraw_fifo_first, redraw_fifo_last;
};
+#define TYPE_VM_SVGA "vmware-svga"
+
+#define VM_SVGA(obj) \
+ OBJECT_CHECK(struct pci_vmsvga_state_s, (obj), TYPE_VM_SVGA)
+
struct pci_vmsvga_state_s {
PCIDevice card;
struct vmsvga_state_s chip;
@@ -1092,8 +1097,7 @@ static void vmsvga_update_display(void *opaque)
static void vmsvga_reset(DeviceState *dev)
{
- struct pci_vmsvga_state_s *pci =
- DO_UPCAST(struct pci_vmsvga_state_s, card.qdev, dev);
+ struct pci_vmsvga_state_s *pci = VM_SVGA(dev);
struct vmsvga_state_s *s = &pci->chip;
s->index = 0;
@@ -1246,8 +1250,7 @@ static const MemoryRegionOps vmsvga_io_ops = {
static int pci_vmsvga_initfn(PCIDevice *dev)
{
- struct pci_vmsvga_state_s *s =
- DO_UPCAST(struct pci_vmsvga_state_s, card, dev);
+ struct pci_vmsvga_state_s *s = VM_SVGA(dev);
s->card.config[PCI_CACHE_LINE_SIZE] = 0x08; /* Cache line size */
s->card.config[PCI_LATENCY_TIMER] = 0x40; /* Latency timer */
@@ -1299,7 +1302,7 @@ static void vmsvga_class_init(ObjectClass *klass, void *data)
}
static const TypeInfo vmsvga_info = {
- .name = "vmware-svga",
+ .name = TYPE_VM_SVGA,
.parent = TYPE_PCI_DEVICE,
.instance_size = sizeof(struct pci_vmsvga_state_s),
.class_init = vmsvga_class_init,
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 14/30] misc/ivshmem: QOM Upcast Sweep
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (12 preceding siblings ...)
2013-06-11 6:49 ` [Qemu-devel] [RFT PATCH v1 13/30] virtio/vmware_vga: " peter.crosthwaite
@ 2013-06-11 6:50 ` peter.crosthwaite
2013-06-11 6:51 ` [Qemu-devel] [RFT PATCH v1 15/30] xen/xen_platform: QOM casting sweep peter.crosthwaite
` (15 subsequent siblings)
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:50 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Define and use standard QOM cast macro. Remove usages of DO_UPCAST
and direct -> style upcasting.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/misc/ivshmem.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index a19a6d6..000556a 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -48,6 +48,10 @@
#define IVSHMEM_DPRINTF(fmt, ...)
#endif
+#define TYPE_IVSHMEM "ivshmem"
+#define IVSHMEM(obj) \
+ OBJECT_CHECK(IVShmemState, (obj), TYPE_IVSHMEM)
+
typedef struct Peer {
int nb_eventfds;
EventNotifier *eventfds;
@@ -341,7 +345,7 @@ static void create_shared_memory_BAR(IVShmemState *s, int fd) {
memory_region_init_ram_ptr(&s->ivshmem, "ivshmem.bar2",
s->ivshmem_size, ptr);
- vmstate_register_ram(&s->ivshmem, &s->dev.qdev);
+ vmstate_register_ram(&s->ivshmem, DEVICE(&s->dev));
memory_region_add_subregion(&s->bar, 0, &s->ivshmem);
/* region for shared memory */
@@ -469,7 +473,7 @@ static void ivshmem_read(void *opaque, const uint8_t * buf, int flags)
incoming_fd, 0);
memory_region_init_ram_ptr(&s->ivshmem,
"ivshmem.bar2", s->ivshmem_size, map_ptr);
- vmstate_register_ram(&s->ivshmem, &s->dev.qdev);
+ vmstate_register_ram(&s->ivshmem, DEVICE(&s->dev));
IVSHMEM_DPRINTF("guest h/w addr = %" PRIu64 ", size = %" PRIu64 "\n",
s->ivshmem_offset, s->ivshmem_size);
@@ -534,7 +538,7 @@ static void ivshmem_use_msix(IVShmemState * s)
static void ivshmem_reset(DeviceState *d)
{
- IVShmemState *s = DO_UPCAST(IVShmemState, dev.qdev, d);
+ IVShmemState *s = IVSHMEM(d);
s->intrstatus = 0;
ivshmem_use_msix(s);
@@ -648,7 +652,7 @@ static int pci_ivshmem_init(PCIDevice *dev)
s->ivshmem_size = ivshmem_get_size(s);
}
- register_savevm(&s->dev.qdev, "ivshmem", 0, 0, ivshmem_save, ivshmem_load,
+ register_savevm(DEVICE(dev), "ivshmem", 0, 0, ivshmem_save, ivshmem_load,
dev);
/* IRQFD requires MSI */
@@ -779,10 +783,10 @@ static void pci_ivshmem_uninit(PCIDevice *dev)
memory_region_destroy(&s->ivshmem_mmio);
memory_region_del_subregion(&s->bar, &s->ivshmem);
- vmstate_unregister_ram(&s->ivshmem, &s->dev.qdev);
+ vmstate_unregister_ram(&s->ivshmem, DEVICE(dev));
memory_region_destroy(&s->ivshmem);
memory_region_destroy(&s->bar);
- unregister_savevm(&dev->qdev, "ivshmem", s);
+ unregister_savevm(DEVICE(dev), "ivshmem", s);
}
static Property ivshmem_properties[] = {
@@ -812,7 +816,7 @@ static void ivshmem_class_init(ObjectClass *klass, void *data)
}
static const TypeInfo ivshmem_info = {
- .name = "ivshmem",
+ .name = TYPE_IVSHMEM,
.parent = TYPE_PCI_DEVICE,
.instance_size = sizeof(IVShmemState),
.class_init = ivshmem_class_init,
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 15/30] xen/xen_platform: QOM casting sweep
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (13 preceding siblings ...)
2013-06-11 6:50 ` [Qemu-devel] [RFT PATCH v1 14/30] misc/ivshmem: QOM Upcast Sweep peter.crosthwaite
@ 2013-06-11 6:51 ` peter.crosthwaite
2013-06-11 6:52 ` [Qemu-devel] [RFT PATCH v1 16/30] isa/*: " peter.crosthwaite
` (14 subsequent siblings)
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:51 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Define and use standard QOM cast macro. Remove usages of DO_UPCAST
and direct -> style upcasting.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/xen/xen_platform.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/hw/xen/xen_platform.c b/hw/xen/xen_platform.c
index b6c6793..f119c44 100644
--- a/hw/xen/xen_platform.c
+++ b/hw/xen/xen_platform.c
@@ -62,6 +62,10 @@ typedef struct PCIXenPlatformState {
int log_buffer_off;
} PCIXenPlatformState;
+#define TYPE_XEN_PLATFORM "xen-platform"
+#define XEN_PLATFORM(obj) \
+ OBJECT_CHECK(PCIXenPlatformState, (obj), TYPE_XEN_PLATFORM)
+
#define XEN_PLATFORM_IOPORT 0x10
/* Send bytes to syslog */
@@ -88,7 +92,7 @@ static void unplug_nic(PCIBus *b, PCIDevice *d, void *o)
if (pci_get_word(d->config + PCI_CLASS_DEVICE) ==
PCI_CLASS_NETWORK_ETHERNET
&& strcmp(d->name, "xen-pci-passthrough") != 0) {
- qdev_free(&d->qdev);
+ qdev_free(DEVICE(d));
}
}
@@ -103,7 +107,7 @@ static void unplug_disks(PCIBus *b, PCIDevice *d, void *o)
if (pci_get_word(d->config + PCI_CLASS_DEVICE) ==
PCI_CLASS_STORAGE_IDE
&& strcmp(d->name, "xen-pci-passthrough") != 0) {
- qdev_unplug(&(d->qdev), NULL);
+ qdev_unplug(DEVICE(d), NULL);
}
}
@@ -114,7 +118,7 @@ static void pci_unplug_disks(PCIBus *bus)
static void platform_fixed_ioport_writew(void *opaque, uint32_t addr, uint32_t val)
{
- PCIXenPlatformState *s = opaque;
+ PCIXenPlatformState *s = XEN_PLATFORM(opaque);
switch (addr) {
case 0:
@@ -164,7 +168,7 @@ static void platform_fixed_ioport_writel(void *opaque, uint32_t addr,
static void platform_fixed_ioport_writeb(void *opaque, uint32_t addr, uint32_t val)
{
- PCIXenPlatformState *s = opaque;
+ PCIXenPlatformState *s = XEN_PLATFORM(opaque);
switch (addr) {
case 0: /* Platform flags */ {
@@ -187,7 +191,7 @@ static void platform_fixed_ioport_writeb(void *opaque, uint32_t addr, uint32_t v
static uint32_t platform_fixed_ioport_readw(void *opaque, uint32_t addr)
{
- PCIXenPlatformState *s = opaque;
+ PCIXenPlatformState *s = XEN_PLATFORM(opaque);
switch (addr) {
case 0:
@@ -206,7 +210,7 @@ static uint32_t platform_fixed_ioport_readw(void *opaque, uint32_t addr)
static uint32_t platform_fixed_ioport_readb(void *opaque, uint32_t addr)
{
- PCIXenPlatformState *s = opaque;
+ PCIXenPlatformState *s = XEN_PLATFORM(opaque);
switch (addr) {
case 0:
@@ -222,7 +226,7 @@ static uint32_t platform_fixed_ioport_readb(void *opaque, uint32_t addr)
static void platform_fixed_ioport_reset(void *opaque)
{
- PCIXenPlatformState *s = opaque;
+ PCIXenPlatformState *s = XEN_PLATFORM(opaque);
platform_fixed_ioport_writeb(s, 0, 0);
}
@@ -292,7 +296,7 @@ static uint64_t xen_platform_ioport_readb(void *opaque, hwaddr addr,
static void xen_platform_ioport_writeb(void *opaque, hwaddr addr,
uint64_t val, unsigned int size)
{
- PCIXenPlatformState *s = opaque;
+ PCIXenPlatformState *s = XEN_PLATFORM(opaque);
switch (addr) {
case 0: /* Platform flags */
@@ -349,7 +353,7 @@ static void platform_mmio_setup(PCIXenPlatformState *d)
static int xen_platform_post_load(void *opaque, int version_id)
{
- PCIXenPlatformState *s = opaque;
+ PCIXenPlatformState *s = XEN_PLATFORM(opaque);
platform_fixed_ioport_writeb(s, 0, s->flags);
@@ -371,7 +375,7 @@ static const VMStateDescription vmstate_xen_platform = {
static int xen_platform_initfn(PCIDevice *dev)
{
- PCIXenPlatformState *d = DO_UPCAST(PCIXenPlatformState, pci_dev, dev);
+ PCIXenPlatformState *d = XEN_PLATFORM(dev);
uint8_t *pci_conf;
pci_conf = d->pci_dev.config;
@@ -397,7 +401,7 @@ static int xen_platform_initfn(PCIDevice *dev)
static void platform_reset(DeviceState *dev)
{
- PCIXenPlatformState *s = DO_UPCAST(PCIXenPlatformState, pci_dev.qdev, dev);
+ PCIXenPlatformState *s = XEN_PLATFORM(dev);
platform_fixed_ioport_reset(s);
}
@@ -420,7 +424,7 @@ static void xen_platform_class_init(ObjectClass *klass, void *data)
}
static const TypeInfo xen_platform_info = {
- .name = "xen-platform",
+ .name = TYPE_XEN_PLATFORM,
.parent = TYPE_PCI_DEVICE,
.instance_size = sizeof(PCIXenPlatformState),
.class_init = xen_platform_class_init,
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 16/30] isa/*: QOM casting sweep
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (14 preceding siblings ...)
2013-06-11 6:51 ` [Qemu-devel] [RFT PATCH v1 15/30] xen/xen_platform: QOM casting sweep peter.crosthwaite
@ 2013-06-11 6:52 ` peter.crosthwaite
2013-06-11 9:58 ` Andreas Färber
2013-06-11 6:52 ` [Qemu-devel] [RFT PATCH v1 17/30] pci/*: " peter.crosthwaite
` (13 subsequent siblings)
29 siblings, 1 reply; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:52 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Use standard QOM cast macros. Remove usage of DO_UPCAST and
direct -> style upcasting.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/isa/i82378.c | 8 ++++----
hw/isa/lpc_ich9.c | 6 +++---
hw/isa/piix4.c | 4 ++--
hw/isa/vt82c686.c | 14 +++++++-------
4 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
index cced9af..95a2d1c 100644
--- a/hw/isa/i82378.c
+++ b/hw/isa/i82378.c
@@ -159,8 +159,7 @@ static void i82378_request_out0_irq(void *opaque, int irq, int level)
static void i82378_request_pic_irq(void *opaque, int irq, int level)
{
- DeviceState *dev = opaque;
- PCIDevice *pci = DO_UPCAST(PCIDevice, qdev, dev);
+ PCIDevice *pci = PCI_DEVICE(opaque);
PCIi82378State *s = DO_UPCAST(PCIi82378State, pci_dev, pci);
qemu_set_irq(s->state.i8259[irq], level);
@@ -210,6 +209,7 @@ static void i82378_init(DeviceState *dev, I82378State *s)
static int pci_i82378_init(PCIDevice *dev)
{
PCIi82378State *pci = DO_UPCAST(PCIi82378State, pci_dev, dev);
+ DeviceState *d = DEVICE(pci);
I82378State *s = &pci->state;
uint8_t *pci_conf;
@@ -233,9 +233,9 @@ static int pci_i82378_init(PCIDevice *dev)
pci_set_long(pci_conf + PCI_BASE_ADDRESS_0, pci->isa_io_base);
isa_mem_base = pci->isa_mem_base;
- isa_bus_new(&dev->qdev, pci_address_space_io(dev));
+ isa_bus_new(d, pci_address_space_io(dev));
- i82378_init(&dev->qdev, s);
+ i82378_init(d, s);
return 0;
}
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index 667e882..497ced1 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -277,7 +277,7 @@ void ich9_lpc_set_irq(void *opaque, int pirq, int level)
*/
int ich9_lpc_map_irq(PCIDevice *pci_dev, int intx)
{
- BusState *bus = qdev_get_parent_bus(&pci_dev->qdev);
+ BusState *bus = qdev_get_parent_bus(DEVICE(pci_dev));
PCIBus *pci_bus = PCI_BUS(bus);
PCIDevice *lpc_pdev =
pci_bus->devices[PCI_DEVFN(ICH9_LPC_DEV, ICH9_LPC_FUNC)];
@@ -364,7 +364,7 @@ void ich9_lpc_pm_init(PCIDevice *lpc_pci)
sci_irq = qemu_allocate_irqs(ich9_set_sci, lpc, 1);
ich9_pm_init(lpc_pci, &lpc->pm, sci_irq[0]);
- ich9_lpc_reset(&lpc->d.qdev);
+ ich9_lpc_reset(DEVICE(lpc));
}
/* APM */
@@ -529,7 +529,7 @@ static int ich9_lpc_initfn(PCIDevice *d)
ICH9LPCState *lpc = ICH9_LPC_DEVICE(d);
ISABus *isa_bus;
- isa_bus = isa_bus_new(&d->qdev, get_system_io());
+ isa_bus = isa_bus_new(DEVICE(d), get_system_io());
pci_set_long(d->wmask + ICH9_LPC_PMBASE,
ICH9_LPC_PMBASE_BASE_ADDRESS_MASK);
diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
index d750413..1eb05b2 100644
--- a/hw/isa/piix4.c
+++ b/hw/isa/piix4.c
@@ -87,7 +87,7 @@ static int piix4_initfn(PCIDevice *dev)
{
PIIX4State *d = DO_UPCAST(PIIX4State, dev, dev);
- isa_bus_new(&d->dev.qdev, pci_address_space_io(dev));
+ isa_bus_new(DEVICE(dev), pci_address_space_io(dev));
piix4_dev = &d->dev;
qemu_register_reset(piix4_reset, d);
return 0;
@@ -98,7 +98,7 @@ int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn)
PCIDevice *d;
d = pci_create_simple_multifunction(bus, devfn, true, "PIIX4");
- *isa_bus = DO_UPCAST(ISABus, qbus, qdev_get_child_bus(&d->qdev, "isa.0"));
+ *isa_bus = DO_UPCAST(ISABus, qbus, qdev_get_child_bus(DEVICE(d), "isa.0"));
return d->devfn;
}
diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
index 5261927..8ec0d84 100644
--- a/hw/isa/vt82c686.c
+++ b/hw/isa/vt82c686.c
@@ -266,7 +266,7 @@ void vt82c686b_ac97_init(PCIBus *bus, int devfn)
PCIDevice *dev;
dev = pci_create(bus, devfn, "VT82C686B_AC97");
- qdev_init_nofail(&dev->qdev);
+ qdev_init_nofail(DEVICE(dev));
}
static void via_ac97_class_init(ObjectClass *klass, void *data)
@@ -307,7 +307,7 @@ void vt82c686b_mc97_init(PCIBus *bus, int devfn)
PCIDevice *dev;
dev = pci_create(bus, devfn, "VT82C686B_MC97");
- qdev_init_nofail(&dev->qdev);
+ qdev_init_nofail(DEVICE(dev));
}
static void via_mc97_class_init(ObjectClass *klass, void *data)
@@ -349,7 +349,7 @@ static int vt82c686b_pm_initfn(PCIDevice *dev)
pci_conf[0x90] = s->smb_io_base | 1;
pci_conf[0x91] = s->smb_io_base >> 8;
pci_conf[0xd2] = 0x90;
- pm_smbus_init(&s->dev.qdev, &s->smb);
+ pm_smbus_init(DEVICE(dev), &s->smb);
memory_region_add_subregion(get_system_io(), s->smb_io_base, &s->smb.io);
apm_init(dev, &s->apm, NULL, s);
@@ -372,11 +372,11 @@ i2c_bus *vt82c686b_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
VT686PMState *s;
dev = pci_create(bus, devfn, "VT82C686B_PM");
- qdev_prop_set_uint32(&dev->qdev, "smb_io_base", smb_io_base);
+ qdev_prop_set_uint32(DEVICE(dev), "smb_io_base", smb_io_base);
s = DO_UPCAST(VT686PMState, dev, dev);
- qdev_init_nofail(&dev->qdev);
+ qdev_init_nofail(DEVICE(dev));
return s->smb.smbus;
}
@@ -427,7 +427,7 @@ static int vt82c686b_initfn(PCIDevice *d)
uint8_t *wmask;
int i;
- isa_bus_new(&d->qdev, pci_address_space_io(d));
+ isa_bus_new(DEVICE(d), pci_address_space_io(d));
pci_conf = d->config;
pci_config_set_prog_interface(pci_conf, 0x0);
@@ -450,7 +450,7 @@ ISABus *vt82c686b_init(PCIBus *bus, int devfn)
d = pci_create_simple_multifunction(bus, devfn, true, "VT82C686B");
- return DO_UPCAST(ISABus, qbus, qdev_get_child_bus(&d->qdev, "isa.0"));
+ return DO_UPCAST(ISABus, qbus, qdev_get_child_bus(DEVICE(d), "isa.0"));
}
static void via_class_init(ObjectClass *klass, void *data)
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 17/30] pci/*: QOM casting sweep
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (15 preceding siblings ...)
2013-06-11 6:52 ` [Qemu-devel] [RFT PATCH v1 16/30] isa/*: " peter.crosthwaite
@ 2013-06-11 6:52 ` peter.crosthwaite
2013-06-11 6:53 ` [Qemu-devel] [RFT PATCH v1 18/30] pci-bridge/pci_bridge_dev: Don't use DO_UPCAST peter.crosthwaite
` (12 subsequent siblings)
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:52 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Use standard QOM cast macro. Remove usages of DO_UPCAST, container_of()
and direct -> style upcasting.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/pci/pci-hotplug.c | 18 ++++++++++--------
hw/pci/pci.c | 17 +++++++++--------
hw/pci/pcie.c | 4 ++--
hw/pci/shpc.c | 8 ++++----
4 files changed, 25 insertions(+), 22 deletions(-)
diff --git a/hw/pci/pci-hotplug.c b/hw/pci/pci-hotplug.c
index 12287d1..0009190 100644
--- a/hw/pci/pci-hotplug.c
+++ b/hw/pci/pci-hotplug.c
@@ -129,7 +129,7 @@ int pci_drive_hot_add(Monitor *mon, const QDict *qdict, DriveInfo *dinfo)
monitor_printf(mon, "no pci device with address %s\n", pci_addr);
goto err;
}
- if (scsi_hot_add(mon, &dev->qdev, dinfo, 1) != 0) {
+ if (scsi_hot_add(mon, DEVICE(dev), dinfo, 1) != 0) {
goto err;
}
break;
@@ -193,11 +193,12 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
switch (type) {
case IF_SCSI:
dev = pci_create(bus, devfn, "lsi53c895a");
- if (qdev_init(&dev->qdev) < 0)
+ if (qdev_init(DEVICE(dev)) < 0) {
dev = NULL;
+ }
if (dev && dinfo) {
- if (scsi_hot_add(mon, &dev->qdev, dinfo, 0) != 0) {
- qdev_unplug(&dev->qdev, NULL);
+ if (scsi_hot_add(mon, DEVICE(dev), dinfo, 0) != 0) {
+ qdev_unplug(DEVICE(dev), NULL);
dev = NULL;
}
}
@@ -208,13 +209,14 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
return NULL;
}
dev = pci_create(bus, devfn, "virtio-blk-pci");
- if (qdev_prop_set_drive(&dev->qdev, "drive", dinfo->bdrv) < 0) {
- qdev_free(&dev->qdev);
+ if (qdev_prop_set_drive(DEVICE(dev), "drive", dinfo->bdrv) < 0) {
+ qdev_free(DEVICE(dev));
dev = NULL;
break;
}
- if (qdev_init(&dev->qdev) < 0)
+ if (qdev_init(DEVICE(dev)) < 0) {
dev = NULL;
+ }
break;
default:
dev = NULL;
@@ -276,7 +278,7 @@ static int pci_device_hot_remove(Monitor *mon, const char *pci_addr)
return -1;
}
- qdev_unplug(&d->qdev, &local_err);
+ qdev_unplug(DEVICE(d), &local_err);
if (error_is_set(&local_err)) {
monitor_printf(mon, "%s\n", error_get_pretty(local_err));
error_free(local_err);
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index bb3879b..01a754d 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -177,7 +177,7 @@ void pci_device_reset(PCIDevice *dev)
{
int r;
- qdev_reset_all(&dev->qdev);
+ qdev_reset_all(DEVICE(dev));
dev->irq_state = 0;
pci_update_irq_status(dev);
@@ -1449,6 +1449,7 @@ static PciBridgeInfo *qmp_query_pci_bridge(PCIDevice *dev, PCIBus *bus,
static PciDeviceInfo *qmp_query_pci_device(PCIDevice *dev, PCIBus *bus,
int bus_num)
{
+ DeviceState *d = DEVICE(dev);
const pci_class_desc *desc;
PciDeviceInfo *info;
uint8_t type;
@@ -1470,7 +1471,7 @@ static PciDeviceInfo *qmp_query_pci_device(PCIDevice *dev, PCIBus *bus,
info->id.vendor = pci_get_word(dev->config + PCI_VENDOR_ID);
info->id.device = pci_get_word(dev->config + PCI_DEVICE_ID);
info->regions = qmp_query_pci_regions(dev);
- info->qdev_id = g_strdup(dev->qdev.id ? dev->qdev.id : "");
+ info->qdev_id = g_strdup(d->id ? d->id : "");
if (dev->config[PCI_INTERRUPT_PIN] != 0) {
info->has_irq = true;
@@ -1594,7 +1595,7 @@ PCIDevice *pci_nic_init(NICInfo *nd, const char *default_model,
}
pci_dev = pci_create(bus, devfn, pci_nic_names[i]);
- dev = &pci_dev->qdev;
+ dev = DEVICE(pci_dev);
qdev_set_nic_properties(dev, nd);
if (qdev_init(dev) < 0)
return NULL;
@@ -1734,7 +1735,7 @@ static int pci_qdev_init(DeviceState *qdev)
qdev->hotplugged ? PCI_HOTPLUG_ENABLED:
PCI_COLDPLUG_ENABLED);
if (rc != 0) {
- int r = pci_unregister_device(&pci_dev->qdev);
+ int r = pci_unregister_device(DEVICE(pci_dev));
assert(!r);
return rc;
}
@@ -1771,7 +1772,7 @@ PCIDevice *pci_create_simple_multifunction(PCIBus *bus, int devfn,
const char *name)
{
PCIDevice *dev = pci_create_multifunction(bus, devfn, multifunction, name);
- qdev_init_nofail(&dev->qdev);
+ qdev_init_nofail(DEVICE(dev));
return dev;
}
@@ -1949,7 +1950,7 @@ static int pci_add_option_rom(PCIDevice *pdev, bool is_default_rom)
}
pdev->has_rom = true;
memory_region_init_ram(&pdev->rom, name, size);
- vmstate_register_ram(&pdev->rom, &pdev->qdev);
+ vmstate_register_ram(&pdev->rom, DEVICE(pdev));
ptr = memory_region_get_ram_ptr(&pdev->rom);
load_image(path, ptr);
g_free(path);
@@ -1969,7 +1970,7 @@ static void pci_del_option_rom(PCIDevice *pdev)
if (!pdev->has_rom)
return;
- vmstate_unregister_ram(&pdev->rom, &pdev->qdev);
+ vmstate_unregister_ram(&pdev->rom, DEVICE(pdev));
memory_region_destroy(&pdev->rom);
pdev->has_rom = false;
}
@@ -2129,7 +2130,7 @@ static char *pcibus_get_fw_dev_path(DeviceState *dev)
static char *pcibus_get_dev_path(DeviceState *dev)
{
- PCIDevice *d = container_of(dev, PCIDevice, qdev);
+ PCIDevice *d = PCI_DEVICE(dev);
PCIDevice *t;
int slot_depth;
/* Path format: Domain:00:Slot.Function:Slot.Function....:Slot.Function.
diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
index 62bd0b8..db4bca8 100644
--- a/hw/pci/pcie.c
+++ b/hw/pci/pcie.c
@@ -251,7 +251,7 @@ static int pcie_cap_slot_hotplug(DeviceState *qdev,
PCI_EXP_SLTSTA_PDS);
pcie_cap_slot_event(d, PCI_EXP_HP_EV_PDC);
} else {
- qdev_free(&pci_dev->qdev);
+ qdev_free(DEVICE(pci_dev));
pci_word_test_and_clear_mask(exp_cap + PCI_EXP_SLTSTA,
PCI_EXP_SLTSTA_PDS);
pcie_cap_slot_event(d, PCI_EXP_HP_EV_PDC);
@@ -306,7 +306,7 @@ void pcie_cap_slot_init(PCIDevice *dev, uint16_t slot)
dev->exp.hpev_notified = false;
pci_bus_hotplug(pci_bridge_get_sec_bus(DO_UPCAST(PCIBridge, dev, dev)),
- pcie_cap_slot_hotplug, &dev->qdev);
+ pcie_cap_slot_hotplug, DEVICE(dev));
}
void pcie_cap_slot_reset(PCIDevice *dev)
diff --git a/hw/pci/shpc.c b/hw/pci/shpc.c
index d35c2ee..aa45e77 100644
--- a/hw/pci/shpc.c
+++ b/hw/pci/shpc.c
@@ -252,9 +252,9 @@ static void shpc_free_devices_in_slot(SHPCDevice *shpc, int slot)
for (devfn = PCI_DEVFN(pci_slot, 0);
devfn <= PCI_DEVFN(pci_slot, PCI_FUNC_MAX - 1);
++devfn) {
- PCIDevice *affected_dev = shpc->sec_bus->devices[devfn];
+ DeviceState *affected_dev = DEVICE(shpc->sec_bus->devices[devfn]);
if (affected_dev) {
- qdev_free(&affected_dev->qdev);
+ qdev_free(affected_dev);
}
}
}
@@ -497,7 +497,7 @@ static int shpc_device_hotplug(DeviceState *qdev, PCIDevice *affected_dev,
int pci_slot = PCI_SLOT(affected_dev->devfn);
uint8_t state;
uint8_t led;
- PCIDevice *d = DO_UPCAST(PCIDevice, qdev, qdev);
+ PCIDevice *d = PCI_DEVICE(qdev);
SHPCDevice *shpc = d->shpc;
int slot = SHPC_PCI_TO_IDX(pci_slot);
if (pci_slot < SHPC_IDX_TO_PCI(0) || slot >= shpc->nslots) {
@@ -616,7 +616,7 @@ int shpc_init(PCIDevice *d, PCIBus *sec_bus, MemoryRegion *bar, unsigned offset)
SHPC_SIZEOF(d));
shpc_cap_update_dword(d);
memory_region_add_subregion(bar, offset, &shpc->mmio);
- pci_bus_hotplug(sec_bus, shpc_device_hotplug, &d->qdev);
+ pci_bus_hotplug(sec_bus, shpc_device_hotplug, DEVICE(d));
d->cap_present |= QEMU_PCI_CAP_SHPC;
return 0;
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 18/30] pci-bridge/pci_bridge_dev: Don't use DO_UPCAST
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (16 preceding siblings ...)
2013-06-11 6:52 ` [Qemu-devel] [RFT PATCH v1 17/30] pci/*: " peter.crosthwaite
@ 2013-06-11 6:53 ` peter.crosthwaite
2013-06-11 6:54 ` [Qemu-devel] [RFT PATCH v1 19/30] pci-bridge/*: substitute ->qdev casts with DEVICE() peter.crosthwaite
` (11 subsequent siblings)
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:53 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Just use the defined PCI_DEVICE cast macro.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/pci-bridge/pci_bridge_dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/pci-bridge/pci_bridge_dev.c b/hw/pci-bridge/pci_bridge_dev.c
index 971b432..c845f38 100644
--- a/hw/pci-bridge/pci_bridge_dev.c
+++ b/hw/pci-bridge/pci_bridge_dev.c
@@ -104,7 +104,7 @@ static void pci_bridge_dev_write_config(PCIDevice *d,
static void qdev_pci_bridge_dev_reset(DeviceState *qdev)
{
- PCIDevice *dev = DO_UPCAST(PCIDevice, qdev, qdev);
+ PCIDevice *dev = PCI_DEVICE(qdev);
pci_bridge_reset(qdev);
shpc_reset(dev);
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 19/30] pci-bridge/*: substitute ->qdev casts with DEVICE()
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (17 preceding siblings ...)
2013-06-11 6:53 ` [Qemu-devel] [RFT PATCH v1 18/30] pci-bridge/pci_bridge_dev: Don't use DO_UPCAST peter.crosthwaite
@ 2013-06-11 6:54 ` peter.crosthwaite
2013-06-11 6:55 ` [Qemu-devel] [RFT PATCH v1 20/30] misc/vfio: " peter.crosthwaite
` (10 subsequent siblings)
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:54 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/pci-bridge/i82801b11.c | 2 +-
hw/pci-bridge/ioh3420.c | 2 +-
hw/pci-bridge/xio3130_downstream.c | 2 +-
hw/pci-bridge/xio3130_upstream.c | 2 +-
hw/pci/pci_bridge.c | 7 ++++---
5 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/hw/pci-bridge/i82801b11.c b/hw/pci-bridge/i82801b11.c
index 5807a92..8b20e27 100644
--- a/hw/pci-bridge/i82801b11.c
+++ b/hw/pci-bridge/i82801b11.c
@@ -108,7 +108,7 @@ PCIBus *ich9_d2pbr_init(PCIBus *bus, int devfn, int sec_bus)
return NULL;
}
br = DO_UPCAST(PCIBridge, dev, d);
- qdev = &br->dev.qdev;
+ qdev = DEVICE(br);
snprintf(buf, sizeof(buf), "pci.%d", sec_bus);
pci_bridge_map_irq(br, buf, pci_swizzle_map_irq_fn);
diff --git a/hw/pci-bridge/ioh3420.c b/hw/pci-bridge/ioh3420.c
index bb541eb..32f9ed6 100644
--- a/hw/pci-bridge/ioh3420.c
+++ b/hw/pci-bridge/ioh3420.c
@@ -173,7 +173,7 @@ PCIESlot *ioh3420_init(PCIBus *bus, int devfn, bool multifunction,
}
br = DO_UPCAST(PCIBridge, dev, d);
- qdev = &br->dev.qdev;
+ qdev = DEVICE(br);
pci_bridge_map_irq(br, bus_name, map_irq);
qdev_prop_set_uint8(qdev, "port", port);
qdev_prop_set_uint8(qdev, "chassis", chassis);
diff --git a/hw/pci-bridge/xio3130_downstream.c b/hw/pci-bridge/xio3130_downstream.c
index 1810dd2..6a799e2 100644
--- a/hw/pci-bridge/xio3130_downstream.c
+++ b/hw/pci-bridge/xio3130_downstream.c
@@ -140,7 +140,7 @@ PCIESlot *xio3130_downstream_init(PCIBus *bus, int devfn, bool multifunction,
}
br = DO_UPCAST(PCIBridge, dev, d);
- qdev = &br->dev.qdev;
+ qdev = DEVICE(br);
pci_bridge_map_irq(br, bus_name, map_irq);
qdev_prop_set_uint8(qdev, "port", port);
qdev_prop_set_uint8(qdev, "chassis", chassis);
diff --git a/hw/pci-bridge/xio3130_upstream.c b/hw/pci-bridge/xio3130_upstream.c
index 8e0d97a..9bb9daa 100644
--- a/hw/pci-bridge/xio3130_upstream.c
+++ b/hw/pci-bridge/xio3130_upstream.c
@@ -120,7 +120,7 @@ PCIEPort *xio3130_upstream_init(PCIBus *bus, int devfn, bool multifunction,
}
br = DO_UPCAST(PCIBridge, dev, d);
- qdev = &br->dev.qdev;
+ qdev = DEVICE(br);
pci_bridge_map_irq(br, bus_name, map_irq);
qdev_prop_set_uint8(qdev, "port", port);
qdev_init_nofail(qdev);
diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c
index 24be6c5..f6657e8 100644
--- a/hw/pci/pci_bridge.c
+++ b/hw/pci/pci_bridge.c
@@ -330,6 +330,7 @@ void pci_bridge_reset(DeviceState *qdev)
/* default qdev initialization function for PCI-to-PCI bridge */
int pci_bridge_initfn(PCIDevice *dev, const char *typename)
{
+ DeviceState *d = DEVICE(dev);
PCIBus *parent = dev->bus;
PCIBridge *br = DO_UPCAST(PCIBridge, dev, dev);
PCIBus *sec_bus = &br->sec_bus;
@@ -359,11 +360,11 @@ int pci_bridge_initfn(PCIDevice *dev, const char *typename)
* Since PCI Bridge devices have a single bus each, we don't need the index:
* let users address the bus using the device name.
*/
- if (!br->bus_name && dev->qdev.id && *dev->qdev.id) {
- br->bus_name = dev->qdev.id;
+ if (!br->bus_name && d->id && *d->id) {
+ br->bus_name = d->id;
}
- qbus_create_inplace(&sec_bus->qbus, typename, &dev->qdev, br->bus_name);
+ qbus_create_inplace(&sec_bus->qbus, typename, d, br->bus_name);
sec_bus->parent_dev = dev;
sec_bus->map_irq = br->map_irq ? br->map_irq : pci_swizzle_map_irq_fn;
sec_bus->address_space_mem = &br->address_space_mem;
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 20/30] misc/vfio: substitute ->qdev casts with DEVICE()
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (18 preceding siblings ...)
2013-06-11 6:54 ` [Qemu-devel] [RFT PATCH v1 19/30] pci-bridge/*: substitute ->qdev casts with DEVICE() peter.crosthwaite
@ 2013-06-11 6:55 ` peter.crosthwaite
2013-06-11 6:55 ` [Qemu-devel] [RFT PATCH v1 21/30] net/eepro100: " peter.crosthwaite
` (9 subsequent siblings)
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:55 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/misc/vfio.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
index 693a9ff..aa75dc2 100644
--- a/hw/misc/vfio.c
+++ b/hw/misc/vfio.c
@@ -3072,7 +3072,7 @@ static int vfio_initfn(PCIDevice *pdev)
}
}
- add_boot_device_path(vdev->bootindex, &pdev->qdev, NULL);
+ add_boot_device_path(vdev->bootindex, DEVICE(pdev), NULL);
return 0;
@@ -3106,7 +3106,7 @@ static void vfio_exitfn(PCIDevice *pdev)
static void vfio_pci_reset(DeviceState *dev)
{
- PCIDevice *pdev = DO_UPCAST(PCIDevice, qdev, dev);
+ PCIDevice *pdev = PCI_DEVICE(dev);
VFIODevice *vdev = DO_UPCAST(VFIODevice, pdev, pdev);
uint16_t cmd;
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 21/30] net/eepro100: substitute ->qdev casts with DEVICE()
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (19 preceding siblings ...)
2013-06-11 6:55 ` [Qemu-devel] [RFT PATCH v1 20/30] misc/vfio: " peter.crosthwaite
@ 2013-06-11 6:55 ` peter.crosthwaite
2013-06-11 6:56 ` [Qemu-devel] [RFT PATCH v1 22/30] net/ne2000: " peter.crosthwaite
` (8 subsequent siblings)
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:55 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/net/eepro100.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c
index dc99ea6..f34b5dc 100644
--- a/hw/net/eepro100.c
+++ b/hw/net/eepro100.c
@@ -1842,13 +1842,14 @@ static void nic_cleanup(NetClientState *nc)
static void pci_nic_uninit(PCIDevice *pci_dev)
{
+ DeviceState *d = DEVICE(pci_dev);
EEPRO100State *s = DO_UPCAST(EEPRO100State, dev, pci_dev);
memory_region_destroy(&s->mmio_bar);
memory_region_destroy(&s->io_bar);
memory_region_destroy(&s->flash_bar);
- vmstate_unregister(&pci_dev->qdev, s->vmstate, s);
- eeprom93xx_free(&pci_dev->qdev, s->eeprom);
+ vmstate_unregister(d, s->vmstate, s);
+ eeprom93xx_free(d, s->eeprom);
qemu_del_nic(s->nic);
}
@@ -1862,6 +1863,7 @@ static NetClientInfo net_eepro100_info = {
static int e100_nic_init(PCIDevice *pci_dev)
{
+ DeviceState *d = DEVICE(pci_dev);
EEPRO100State *s = DO_UPCAST(EEPRO100State, dev, pci_dev);
E100PCIDeviceInfo *info = eepro100_get_class(s);
@@ -1873,7 +1875,7 @@ static int e100_nic_init(PCIDevice *pci_dev)
/* Add 64 * 2 EEPROM. i82557 and i82558 support a 64 word EEPROM,
* i82559 and later support 64 or 256 word EEPROM. */
- s->eeprom = eeprom93xx_new(&pci_dev->qdev, EEPROM_SIZE);
+ s->eeprom = eeprom93xx_new(d, EEPROM_SIZE);
/* Handler for memory-mapped I/O */
memory_region_init_io(&s->mmio_bar, &eepro100_ops, s, "eepro100-mmio",
@@ -1893,7 +1895,7 @@ static int e100_nic_init(PCIDevice *pci_dev)
nic_reset(s);
s->nic = qemu_new_nic(&net_eepro100_info, &s->conf,
- object_get_typename(OBJECT(pci_dev)), pci_dev->qdev.id, s);
+ object_get_typename(OBJECT(pci_dev)), d->id, s);
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
TRACE(OTHER, logout("%s\n", qemu_get_queue(s->nic)->info_str));
@@ -1903,9 +1905,9 @@ static int e100_nic_init(PCIDevice *pci_dev)
s->vmstate = g_malloc(sizeof(vmstate_eepro100));
memcpy(s->vmstate, &vmstate_eepro100, sizeof(vmstate_eepro100));
s->vmstate->name = qemu_get_queue(s->nic)->model;
- vmstate_register(&pci_dev->qdev, -1, s->vmstate, s);
+ vmstate_register(d, -1, s->vmstate, s);
- add_boot_device_path(s->conf.bootindex, &pci_dev->qdev, "/ethernet-phy@0");
+ add_boot_device_path(s->conf.bootindex, d, "/ethernet-phy@0");
return 0;
}
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 22/30] net/ne2000: substitute ->qdev casts with DEVICE()
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (20 preceding siblings ...)
2013-06-11 6:55 ` [Qemu-devel] [RFT PATCH v1 21/30] net/eepro100: " peter.crosthwaite
@ 2013-06-11 6:56 ` peter.crosthwaite
2013-06-11 6:57 ` [Qemu-devel] [RFT PATCH v1 23/30] usb/*: " peter.crosthwaite
` (7 subsequent siblings)
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:56 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/net/ne2000.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c
index 33ee03e..70a7991 100644
--- a/hw/net/ne2000.c
+++ b/hw/net/ne2000.c
@@ -722,6 +722,8 @@ static NetClientInfo net_ne2000_info = {
static int pci_ne2000_init(PCIDevice *pci_dev)
{
PCINE2000State *d = DO_UPCAST(PCINE2000State, dev, pci_dev);
+ DeviceState *ds = DEVICE(pci_dev);
+
NE2000State *s;
uint8_t *pci_conf;
@@ -737,10 +739,10 @@ static int pci_ne2000_init(PCIDevice *pci_dev)
ne2000_reset(s);
s->nic = qemu_new_nic(&net_ne2000_info, &s->c,
- object_get_typename(OBJECT(pci_dev)), pci_dev->qdev.id, s);
+ object_get_typename(OBJECT(pci_dev)), ds->id, s);
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->c.macaddr.a);
- add_boot_device_path(s->c.bootindex, &pci_dev->qdev, "/ethernet-phy@0");
+ add_boot_device_path(s->c.bootindex, ds, "/ethernet-phy@0");
return 0;
}
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 23/30] usb/*: substitute ->qdev casts with DEVICE()
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (21 preceding siblings ...)
2013-06-11 6:56 ` [Qemu-devel] [RFT PATCH v1 22/30] net/ne2000: " peter.crosthwaite
@ 2013-06-11 6:57 ` peter.crosthwaite
2013-06-11 6:58 ` [Qemu-devel] [RFT PATCH v1 24/30] watchdog/wdt_i6300esb: " peter.crosthwaite
` (6 subsequent siblings)
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:57 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/usb/hcd-ehci-pci.c | 13 ++++++++-----
hw/usb/hcd-ohci.c | 2 +-
hw/usb/hcd-uhci.c | 2 +-
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/hw/usb/hcd-ehci-pci.c b/hw/usb/hcd-ehci-pci.c
index 0eb7826..c772e1f 100644
--- a/hw/usb/hcd-ehci-pci.c
+++ b/hw/usb/hcd-ehci-pci.c
@@ -197,6 +197,7 @@ int ehci_create_ich9_with_companions(PCIBus *bus, int slot)
const struct ehci_companions *comp;
PCIDevice *ehci, *uhci;
BusState *usbbus;
+ DeviceState *dev;
const char *name;
int i;
@@ -214,15 +215,17 @@ int ehci_create_ich9_with_companions(PCIBus *bus, int slot)
}
ehci = pci_create_multifunction(bus, PCI_DEVFN(slot, 7), true, name);
- qdev_init_nofail(&ehci->qdev);
- usbbus = QLIST_FIRST(&ehci->qdev.child_bus);
+ dev = DEVICE(ehci);
+ qdev_init_nofail(dev);
+ usbbus = QLIST_FIRST(&dev->child_bus);
for (i = 0; i < 3; i++) {
uhci = pci_create_multifunction(bus, PCI_DEVFN(slot, comp[i].func),
true, comp[i].name);
- qdev_prop_set_string(&uhci->qdev, "masterbus", usbbus->name);
- qdev_prop_set_uint32(&uhci->qdev, "firstport", comp[i].port);
- qdev_init_nofail(&uhci->qdev);
+ dev = DEVICE(uhci);
+ qdev_prop_set_string(dev, "masterbus", usbbus->name);
+ qdev_prop_set_uint32(dev, "firstport", comp[i].port);
+ qdev_init_nofail(dev);
}
return 0;
}
diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c
index 51241cd..62c08ee 100644
--- a/hw/usb/hcd-ohci.c
+++ b/hw/usb/hcd-ohci.c
@@ -1857,7 +1857,7 @@ static int usb_ohci_initfn_pci(struct PCIDevice *dev)
ohci->pci_dev.config[PCI_CLASS_PROG] = 0x10; /* OHCI */
ohci->pci_dev.config[PCI_INTERRUPT_PIN] = 0x01; /* interrupt pin A */
- if (usb_ohci_init(&ohci->state, &dev->qdev, ohci->num_ports, 0,
+ if (usb_ohci_init(&ohci->state, DEVICE(dev), ohci->num_ports, 0,
ohci->masterbus, ohci->firstport,
pci_dma_context(dev)) != 0) {
return -1;
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index c85b203..67c13c3 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -1246,7 +1246,7 @@ static int usb_uhci_common_initfn(PCIDevice *dev)
return -1;
}
} else {
- usb_bus_new(&s->bus, &uhci_bus_ops, &s->dev.qdev);
+ usb_bus_new(&s->bus, &uhci_bus_ops, DEVICE(dev));
for (i = 0; i < NB_PORTS; i++) {
usb_register_port(&s->bus, &s->ports[i].port, s, i, &uhci_port_ops,
USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 24/30] watchdog/wdt_i6300esb: substitute ->qdev casts with DEVICE()
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (22 preceding siblings ...)
2013-06-11 6:57 ` [Qemu-devel] [RFT PATCH v1 23/30] usb/*: " peter.crosthwaite
@ 2013-06-11 6:58 ` peter.crosthwaite
2013-06-11 6:58 ` [Qemu-devel] [RFT PATCH v1 25/30] scsi/vmw_pvscsi: " peter.crosthwaite
` (5 subsequent siblings)
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:58 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/watchdog/wdt_i6300esb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c
index 1407fba..df39d9c 100644
--- a/hw/watchdog/wdt_i6300esb.c
+++ b/hw/watchdog/wdt_i6300esb.c
@@ -195,7 +195,7 @@ static void i6300esb_timer_expired(void *vp)
if (d->reboot_enabled) {
d->previous_reboot_flag = 1;
watchdog_perform_action(); /* This reboots, exits, etc */
- i6300esb_reset(&d->dev.qdev);
+ i6300esb_reset(DEVICE(d));
}
/* In "free running mode" we start stage 1 again. */
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 25/30] scsi/vmw_pvscsi: substitute ->qdev casts with DEVICE()
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (23 preceding siblings ...)
2013-06-11 6:58 ` [Qemu-devel] [RFT PATCH v1 24/30] watchdog/wdt_i6300esb: " peter.crosthwaite
@ 2013-06-11 6:58 ` peter.crosthwaite
2013-06-11 6:59 ` [Qemu-devel] [RFT PATCH v1 26/30] i2c/smbus_ich9: " peter.crosthwaite
` (4 subsequent siblings)
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:58 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/scsi/vmw_pvscsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
index 48d12f4..e9cf15f 100644
--- a/hw/scsi/vmw_pvscsi.c
+++ b/hw/scsi/vmw_pvscsi.c
@@ -1088,7 +1088,7 @@ pvscsi_init(PCIDevice *pci_dev)
return -ENOMEM;
}
- scsi_bus_new(&s->bus, &pci_dev->qdev, &pvscsi_scsi_info, NULL);
+ scsi_bus_new(&s->bus, DEVICE(pci_dev), &pvscsi_scsi_info, NULL);
pvscsi_reset_state(s);
return 0;
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 26/30] i2c/smbus_ich9: substitute ->qdev casts with DEVICE()
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (24 preceding siblings ...)
2013-06-11 6:58 ` [Qemu-devel] [RFT PATCH v1 25/30] scsi/vmw_pvscsi: " peter.crosthwaite
@ 2013-06-11 6:59 ` peter.crosthwaite
2013-06-11 7:00 ` [Qemu-devel] [RFT PATCH v1 27/30] ide/cmd646: " peter.crosthwaite
` (3 subsequent siblings)
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 6:59 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/i2c/smbus_ich9.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/i2c/smbus_ich9.c b/hw/i2c/smbus_ich9.c
index ca22978..f87343f 100644
--- a/hw/i2c/smbus_ich9.c
+++ b/hw/i2c/smbus_ich9.c
@@ -82,7 +82,7 @@ static int ich9_smbus_initfn(PCIDevice *d)
pci_set_byte(d->config + ICH9_SMB_HOSTC, 0);
/* TODO bar0, bar1: 64bit BAR support*/
- pm_smbus_init(&d->qdev, &s->smb);
+ pm_smbus_init(DEVICE(d), &s->smb);
pci_register_bar(d, ICH9_SMB_SMB_BASE_BAR, PCI_BASE_ADDRESS_SPACE_IO,
&s->smb.io);
return 0;
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 27/30] ide/cmd646: substitute ->qdev casts with DEVICE()
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (25 preceding siblings ...)
2013-06-11 6:59 ` [Qemu-devel] [RFT PATCH v1 26/30] i2c/smbus_ich9: " peter.crosthwaite
@ 2013-06-11 7:00 ` peter.crosthwaite
2013-06-11 7:01 ` [Qemu-devel] [RFT PATCH v1 28/30] ide/via: " peter.crosthwaite
` (2 subsequent siblings)
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 7:00 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/ide/cmd646.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c
index a73eb9a..9544c1f 100644
--- a/hw/ide/cmd646.c
+++ b/hw/ide/cmd646.c
@@ -281,7 +281,7 @@ static int pci_cmd646_ide_initfn(PCIDevice *dev)
irq = qemu_allocate_irqs(cmd646_set_irq, d, 2);
for (i = 0; i < 2; i++) {
- ide_bus_new(&d->bus[i], &d->dev.qdev, i, 2);
+ ide_bus_new(&d->bus[i], DEVICE(d), i, 2);
ide_init2(&d->bus[i], irq[i]);
bmdma_init(&d->bus[i], &d->bmdma[i], d);
@@ -290,7 +290,7 @@ static int pci_cmd646_ide_initfn(PCIDevice *dev)
&d->bmdma[i].dma);
}
- vmstate_register(&dev->qdev, 0, &vmstate_ide_pci, d);
+ vmstate_register(DEVICE(dev), 0, &vmstate_ide_pci, d);
qemu_register_reset(cmd646_reset, d);
return 0;
}
@@ -317,8 +317,8 @@ void pci_cmd646_ide_init(PCIBus *bus, DriveInfo **hd_table,
PCIDevice *dev;
dev = pci_create(bus, -1, "cmd646-ide");
- qdev_prop_set_uint32(&dev->qdev, "secondary", secondary_ide_enabled);
- qdev_init_nofail(&dev->qdev);
+ qdev_prop_set_uint32(DEVICE(dev), "secondary", secondary_ide_enabled);
+ qdev_init_nofail(DEVICE(dev));
pci_ide_create_devs(dev, hd_table);
}
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 28/30] ide/via: substitute ->qdev casts with DEVICE()
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (26 preceding siblings ...)
2013-06-11 7:00 ` [Qemu-devel] [RFT PATCH v1 27/30] ide/cmd646: " peter.crosthwaite
@ 2013-06-11 7:01 ` peter.crosthwaite
2013-06-11 7:01 ` [Qemu-devel] [RFT PATCH v1 29/30] pci-host/*: " peter.crosthwaite
2013-06-11 7:02 ` [Qemu-devel] [RFT PATCH v1 30/30] i386/*: " peter.crosthwaite
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 7:01 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/ide/via.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/ide/via.c b/hw/ide/via.c
index 5fe053c..b81e1fe 100644
--- a/hw/ide/via.c
+++ b/hw/ide/via.c
@@ -158,7 +158,7 @@ static void vt82c686b_init_ports(PCIIDEState *d) {
int i;
for (i = 0; i < 2; i++) {
- ide_bus_new(&d->bus[i], &d->dev.qdev, i, 2);
+ ide_bus_new(&d->bus[i], DEVICE(d), i, 2);
ide_init_ioport(&d->bus[i], NULL, port_info[i].iobase,
port_info[i].iobase2);
ide_init2(&d->bus[i], isa_get_irq(NULL, port_info[i].isairq));
@@ -183,7 +183,7 @@ static int vt82c686b_ide_initfn(PCIDevice *dev)
bmdma_setup_bar(d);
pci_register_bar(&d->dev, 4, PCI_BASE_ADDRESS_SPACE_IO, &d->bmdma_bar);
- vmstate_register(&dev->qdev, 0, &vmstate_ide_pci, d);
+ vmstate_register(DEVICE(dev), 0, &vmstate_ide_pci, d);
vt82c686b_init_ports(d);
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 29/30] pci-host/*: substitute ->qdev casts with DEVICE()
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (27 preceding siblings ...)
2013-06-11 7:01 ` [Qemu-devel] [RFT PATCH v1 28/30] ide/via: " peter.crosthwaite
@ 2013-06-11 7:01 ` peter.crosthwaite
2013-06-11 7:02 ` [Qemu-devel] [RFT PATCH v1 30/30] i386/*: " peter.crosthwaite
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 7:01 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/pci-bridge/dec.c | 2 +-
hw/pci-host/apb.c | 4 ++--
hw/pci-host/q35.c | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/hw/pci-bridge/dec.c b/hw/pci-bridge/dec.c
index cff458b..1e5611d 100644
--- a/hw/pci-bridge/dec.c
+++ b/hw/pci-bridge/dec.c
@@ -88,7 +88,7 @@ PCIBus *pci_dec_21154_init(PCIBus *parent_bus, int devfn)
"dec-21154-p2p-bridge");
br = DO_UPCAST(PCIBridge, dev, dev);
pci_bridge_map_irq(br, "DEC 21154 PCI-PCI bridge", dec_map_irq);
- qdev_init_nofail(&dev->qdev);
+ qdev_init_nofail(DEVICE(dev));
return pci_bridge_get_sec_bus(br);
}
diff --git a/hw/pci-host/apb.c b/hw/pci-host/apb.c
index e099655..f3987ff 100644
--- a/hw/pci-host/apb.c
+++ b/hw/pci-host/apb.c
@@ -467,7 +467,7 @@ PCIBus *pci_apb_init(hwaddr special_base,
br = DO_UPCAST(PCIBridge, dev, pci_dev);
pci_bridge_map_irq(br, "Advanced PCI Bus secondary bridge 1",
pci_apb_map_irq);
- qdev_init_nofail(&pci_dev->qdev);
+ qdev_init_nofail(DEVICE(dev));
*bus2 = pci_bridge_get_sec_bus(br);
pci_dev = pci_create_multifunction(d->bus, PCI_DEVFN(1, 1), true,
@@ -475,7 +475,7 @@ PCIBus *pci_apb_init(hwaddr special_base,
br = DO_UPCAST(PCIBridge, dev, pci_dev);
pci_bridge_map_irq(br, "Advanced PCI Bus secondary bridge 2",
pci_apb_map_irq);
- qdev_init_nofail(&pci_dev->qdev);
+ qdev_init_nofail(DEVICE(pci_dev));
*bus3 = pci_bridge_get_sec_bus(br);
return d->bus;
diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
index 24df6b5..d04471c 100644
--- a/hw/pci-host/q35.c
+++ b/hw/pci-host/q35.c
@@ -104,8 +104,8 @@ static const TypeInfo q35_host_info = {
/* PCIe MMCFG */
static void mch_update_pciexbar(MCHPCIState *mch)
{
- PCIDevice *pci_dev = &mch->d;
- BusState *bus = qdev_get_parent_bus(&pci_dev->qdev);
+ PCIDevice *pci_dev = PCI_DEVICE(mch);
+ BusState *bus = qdev_get_parent_bus(DEVICE(pci_dev));
DeviceState *qdev = bus->parent;
Q35PCIHost *s = Q35_HOST_DEVICE(qdev);
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [Qemu-devel] [RFT PATCH v1 30/30] i386/*: substitute ->qdev casts with DEVICE()
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
` (28 preceding siblings ...)
2013-06-11 7:01 ` [Qemu-devel] [RFT PATCH v1 29/30] pci-host/*: " peter.crosthwaite
@ 2013-06-11 7:02 ` peter.crosthwaite
29 siblings, 0 replies; 37+ messages in thread
From: peter.crosthwaite @ 2013-06-11 7:02 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/i386/kvm/pci-assign.c | 21 ++++++++++++---------
hw/i386/pc.c | 4 ++--
hw/i386/pc_piix.c | 4 ++--
hw/i386/pc_q35.c | 4 ++--
4 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
index ff85590..d9c2436 100644
--- a/hw/i386/kvm/pci-assign.c
+++ b/hw/i386/kvm/pci-assign.c
@@ -491,7 +491,7 @@ static int assigned_dev_register_regions(PCIRegion *io_regions,
name, cur_region->size,
virtbase);
vmstate_register_ram(&pci_dev->v_addrs[i].real_iomem,
- &pci_dev->dev.qdev);
+ DEVICE(&pci_dev->dev));
}
assigned_dev_iomem_setup(&pci_dev->dev, i, cur_region->size);
@@ -817,6 +817,7 @@ fail:
static int assign_device(AssignedDevice *dev)
{
+ DeviceState *d = DEVICE(&dev->dev);
uint32_t flags = KVM_DEV_ASSIGN_ENABLE_IOMMU;
int r;
@@ -830,7 +831,7 @@ static int assign_device(AssignedDevice *dev)
if (!kvm_check_extension(kvm_state, KVM_CAP_IOMMU)) {
error_report("No IOMMU found. Unable to assign device \"%s\"",
- dev->dev.qdev.id);
+ d->id);
return -ENODEV;
}
@@ -842,7 +843,7 @@ static int assign_device(AssignedDevice *dev)
r = kvm_device_pci_assign(kvm_state, &dev->host, flags, &dev->dev_id);
if (r < 0) {
error_report("Failed to assign device \"%s\" : %s",
- dev->dev.qdev.id, strerror(-r));
+ d->id, strerror(-r));
switch (r) {
case -EBUSY:
@@ -867,6 +868,7 @@ static bool check_irqchip_in_kernel(void)
static int assign_intx(AssignedDevice *dev)
{
+ DeviceState *d = DEVICE(&dev->dev);
AssignedIRQType new_type;
PCIINTxRoute intx_route;
bool intx_host_msi;
@@ -942,7 +944,7 @@ retry:
goto retry;
}
error_report("Failed to assign irq for \"%s\": %s",
- dev->dev.qdev.id, strerror(-r));
+ d->id, strerror(-r));
error_report("Perhaps you are assigning a device "
"that shares an IRQ with another device?");
return r;
@@ -972,7 +974,7 @@ static void assigned_dev_update_irq_routing(PCIDevice *dev)
r = assign_intx(assigned_dev);
if (r < 0) {
- qdev_unplug(&dev->qdev, &err);
+ qdev_unplug(DEVICE(dev), &err);
assert(!err);
}
}
@@ -1675,7 +1677,7 @@ static const VMStateDescription vmstate_assigned_device = {
static void reset_assigned_device(DeviceState *dev)
{
- PCIDevice *pci_dev = DO_UPCAST(PCIDevice, qdev, dev);
+ PCIDevice *pci_dev = PCI_DEVICE(dev);
AssignedDevice *adev = DO_UPCAST(AssignedDevice, dev, pci_dev);
char reset_file[64];
const char reset[] = "1";
@@ -1731,6 +1733,7 @@ static void reset_assigned_device(DeviceState *dev)
static int assigned_initfn(struct PCIDevice *pci_dev)
{
+ DeviceState *d = DEVICE(pci_dev);
AssignedDevice *dev = DO_UPCAST(AssignedDevice, dev, pci_dev);
uint8_t e_intx;
int r;
@@ -1769,7 +1772,7 @@ static int assigned_initfn(struct PCIDevice *pci_dev)
if (get_real_device(dev, dev->host.domain, dev->host.bus,
dev->host.slot, dev->host.function)) {
error_report("pci-assign: Error: Couldn't get real device (%s)!",
- dev->dev.qdev.id);
+ d->id);
goto out;
}
@@ -1811,7 +1814,7 @@ static int assigned_initfn(struct PCIDevice *pci_dev)
assigned_dev_load_option_rom(dev);
- add_boot_device_path(dev->bootindex, &pci_dev->qdev, NULL);
+ add_boot_device_path(dev->bootindex, d, NULL);
return 0;
@@ -1916,7 +1919,7 @@ static void assigned_dev_load_option_rom(AssignedDevice *dev)
snprintf(name, sizeof(name), "%s.rom",
object_get_typename(OBJECT(dev)));
memory_region_init_ram(&dev->dev.rom, name, st.st_size);
- vmstate_register_ram(&dev->dev.rom, &dev->dev.qdev);
+ vmstate_register_ram(&dev->dev.rom, DEVICE(&dev->dev));
ptr = memory_region_get_ram_ptr(&dev->dev.rom);
memset(ptr, 0xff, st.st_size);
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 4844a6b..120f02c 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1085,10 +1085,10 @@ DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus)
if (pci_bus) {
PCIDevice *pcidev = pci_vga_init(pci_bus);
- dev = pcidev ? &pcidev->qdev : NULL;
+ dev = DEVICE(pcidev);
} else if (isa_bus) {
ISADevice *isadev = isa_vga_init(isa_bus);
- dev = isadev ? &isadev->qdev : NULL;
+ dev = DEVICE(isadev);
}
return dev;
}
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index d618570..1b40f24 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -191,8 +191,8 @@ static void pc_init1(MemoryRegion *system_memory,
} else {
dev = pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1);
}
- idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0");
- idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1");
+ idebus[0] = qdev_get_child_bus(DEVICE(dev), "ide.0");
+ idebus[1] = qdev_get_child_bus(DEVICE(dev), "ide.1");
} else {
for(i = 0; i < MAX_IDE_BUS; i++) {
ISADevice *dev;
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 7888dfe..ff48bbf 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -179,8 +179,8 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
PCI_DEVFN(ICH9_SATA1_DEV,
ICH9_SATA1_FUNC),
true, "ich9-ahci");
- idebus[0] = qdev_get_child_bus(&ahci->qdev, "ide.0");
- idebus[1] = qdev_get_child_bus(&ahci->qdev, "ide.1");
+ idebus[0] = qdev_get_child_bus(DEVICE(ahci), "ide.0");
+ idebus[1] = qdev_get_child_bus(DEVICE(ahci), "ide.1");
if (usb_enabled(false)) {
/* Should we create 6 UHCI according to ich9 spec? */
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 37+ messages in thread
* Re: [Qemu-devel] [RFT PATCH v1 12/30] virtio/virtio-pci: QOM casting sweep
2013-06-11 6:49 ` [Qemu-devel] [RFT PATCH v1 12/30] virtio/virtio-pci: QOM casting sweep peter.crosthwaite
@ 2013-06-11 7:09 ` Frederic Konrad
2013-06-24 5:00 ` Peter Crosthwaite
0 siblings, 1 reply; 37+ messages in thread
From: Frederic Konrad @ 2013-06-11 7:09 UTC (permalink / raw)
To: peter.crosthwaite; +Cc: pbonzini, aliguori, qemu-devel, afaerber
Hi,
On 11/06/2013 08:49, peter.crosthwaite@xilinx.com wrote:
> From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>
> Use standard QOM cast macro. Remove usages of container_of() and
> direct -> style upcasting.
>
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
[...]
> static inline VirtIOPCIProxy *to_virtio_pci_proxy(DeviceState *d)
> {
> - return container_of(d, VirtIOPCIProxy, pci_dev.qdev);
> + return VIRTIO_PCI(d);
> }
Maybe you can replace each to_virtio_pci_proxy directly with VIRTIO_PCI?
>
> /* DeviceState to VirtIOPCIProxy. Note: used on datapath,
> @@ -106,7 +106,7 @@ static inline VirtIOPCIProxy *to_virtio_pci_proxy(DeviceState *d)
> */
> static inline VirtIOPCIProxy *to_virtio_pci_proxy_fast(DeviceState *d)
> {
> - return container_of(d, VirtIOPCIProxy, pci_dev.qdev);
> + return VIRTIO_PCI(d);
> }
>
> static void virtio_pci_notify(DeviceState *d, uint16_t vector)
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [Qemu-devel] [RFT PATCH v1 16/30] isa/*: QOM casting sweep
2013-06-11 6:52 ` [Qemu-devel] [RFT PATCH v1 16/30] isa/*: " peter.crosthwaite
@ 2013-06-11 9:58 ` Andreas Färber
2013-06-24 4:55 ` Peter Crosthwaite
0 siblings, 1 reply; 37+ messages in thread
From: Andreas Färber @ 2013-06-11 9:58 UTC (permalink / raw)
To: peter.crosthwaite; +Cc: pbonzini, aliguori, qemu-devel
Am 11.06.2013 08:52, schrieb peter.crosthwaite@xilinx.com:
> From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>
> Use standard QOM cast macros. Remove usage of DO_UPCAST and
> direct -> style upcasting.
>
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
>
> hw/isa/i82378.c | 8 ++++----
> hw/isa/lpc_ich9.c | 6 +++---
> hw/isa/piix4.c | 4 ++--
> hw/isa/vt82c686.c | 14 +++++++-------
> 4 files changed, 16 insertions(+), 16 deletions(-)
[...]
> diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
> index d750413..1eb05b2 100644
> --- a/hw/isa/piix4.c
> +++ b/hw/isa/piix4.c
[...]
> @@ -98,7 +98,7 @@ int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn)
> PCIDevice *d;
>
> d = pci_create_simple_multifunction(bus, devfn, true, "PIIX4");
> - *isa_bus = DO_UPCAST(ISABus, qbus, qdev_get_child_bus(&d->qdev, "isa.0"));
> + *isa_bus = DO_UPCAST(ISABus, qbus, qdev_get_child_bus(DEVICE(d), "isa.0"));
Conflict, my ISABus patch does ISA_BUS() in addition:
http://patchwork.ozlabs.org/patch/249705/
> return d->devfn;
> }
>
> diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
> index 5261927..8ec0d84 100644
> --- a/hw/isa/vt82c686.c
> +++ b/hw/isa/vt82c686.c
[...]
> @@ -450,7 +450,7 @@ ISABus *vt82c686b_init(PCIBus *bus, int devfn)
>
> d = pci_create_simple_multifunction(bus, devfn, true, "VT82C686B");
>
> - return DO_UPCAST(ISABus, qbus, qdev_get_child_bus(&d->qdev, "isa.0"));
> + return DO_UPCAST(ISABus, qbus, qdev_get_child_bus(DEVICE(d), "isa.0"));
Ditto.
> }
>
> static void via_class_init(ObjectClass *klass, void *data)
Otherwise looks fine.
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [Qemu-devel] [RFT PATCH v1 01/30] net/e1000: QOM Upcast Sweep
2013-06-11 6:40 ` [Qemu-devel] [RFT PATCH v1 01/30] net/e1000: QOM Upcast Sweep peter.crosthwaite
@ 2013-06-24 3:42 ` Peter Crosthwaite
0 siblings, 0 replies; 37+ messages in thread
From: Peter Crosthwaite @ 2013-06-24 3:42 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
On Tue, Jun 11, 2013 at 4:40 PM, <peter.crosthwaite@xilinx.com> wrote:
> From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>
> Define and use standard QOM cast macro. Remove usages of DO_UPCAST
> and direct -> style upcasting.
>
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
>
> hw/net/e1000.c | 20 +++++++++++++-------
> 1 file changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/hw/net/e1000.c b/hw/net/e1000.c
> index e6f46f0..a7de400 100644
> --- a/hw/net/e1000.c
> +++ b/hw/net/e1000.c
> @@ -138,6 +138,11 @@ typedef struct E1000State_st {
> uint32_t compat_flags;
> } E1000State;
>
> +#define TYPE_E1000 "e1000"
> +
> +#define E1000(obj) \
> + OBJECT_CHECK(E1000State, (obj), TYPE_E1000)
> +
> #define defreg(x) x = (E1000_##x>>2)
> enum {
> defreg(CTRL), defreg(EECD), defreg(EERD), defreg(GPRC),
> @@ -1175,7 +1180,7 @@ static int e1000_post_load(void *opaque, int version_id)
> }
>
> static const VMStateDescription vmstate_e1000 = {
> - .name = "e1000",
> + .name = TYPE_E1000,
Will fix v2 as per discussion recent discussion on type string usages.
Regards,
Peter
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [Qemu-devel] [RFT PATCH v1 06/30] scsi/megasas: QOM Upcast Sweep
2013-06-11 6:44 ` [Qemu-devel] [RFT PATCH v1 06/30] scsi/megasas: " peter.crosthwaite
@ 2013-06-24 3:42 ` Peter Crosthwaite
0 siblings, 0 replies; 37+ messages in thread
From: Peter Crosthwaite @ 2013-06-24 3:42 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, aliguori, afaerber
On Tue, Jun 11, 2013 at 4:44 PM, <peter.crosthwaite@xilinx.com> wrote:
> From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>
> Define and use standard QOM cast macro. Remove usages of DO_UPCAST
> and direct -> style upcasting.
>
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
>
> hw/scsi/megasas.c | 17 +++++++++++------
> 1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
> index fe6550c..21eaf4f 100644
> --- a/hw/scsi/megasas.c
> +++ b/hw/scsi/megasas.c
> @@ -108,6 +108,11 @@ typedef struct MegasasState {
> SCSIBus bus;
> } MegasasState;
>
> +#define TYPE_MEGASAS "megasas"
> +
> +#define MEGASAS(obj) \
> + OBJECT_CHECK(MegasasState, (obj), TYPE_MEGASAS)
> +
> #define MEGASAS_INTR_DISABLED_MASK 0xFFFFFFFF
>
> static bool megasas_intr_enabled(MegasasState *s)
> @@ -2039,13 +2044,13 @@ static void megasas_soft_reset(MegasasState *s)
>
> static void megasas_scsi_reset(DeviceState *dev)
> {
> - MegasasState *s = DO_UPCAST(MegasasState, dev.qdev, dev);
> + MegasasState *s = MEGASAS(dev);
>
> megasas_soft_reset(s);
> }
>
> static const VMStateDescription vmstate_megasas = {
> - .name = "megasas",
> + .name = TYPE_MEGASAS,
Will fix v2.
Regards,
Peter
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [Qemu-devel] [RFT PATCH v1 16/30] isa/*: QOM casting sweep
2013-06-11 9:58 ` Andreas Färber
@ 2013-06-24 4:55 ` Peter Crosthwaite
0 siblings, 0 replies; 37+ messages in thread
From: Peter Crosthwaite @ 2013-06-24 4:55 UTC (permalink / raw)
To: Andreas Färber; +Cc: pbonzini, aliguori, qemu-devel
Hi Andreas,
On Tue, Jun 11, 2013 at 7:58 PM, Andreas Färber <afaerber@suse.de> wrote:
> Am 11.06.2013 08:52, schrieb peter.crosthwaite@xilinx.com:
>> From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>>
>> Use standard QOM cast macros. Remove usage of DO_UPCAST and
>> direct -> style upcasting.
>>
>> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>> ---
>>
>> hw/isa/i82378.c | 8 ++++----
>> hw/isa/lpc_ich9.c | 6 +++---
>> hw/isa/piix4.c | 4 ++--
>> hw/isa/vt82c686.c | 14 +++++++-------
>> 4 files changed, 16 insertions(+), 16 deletions(-)
> [...]
>> diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
>> index d750413..1eb05b2 100644
>> --- a/hw/isa/piix4.c
>> +++ b/hw/isa/piix4.c
> [...]
>> @@ -98,7 +98,7 @@ int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn)
>> PCIDevice *d;
>>
>> d = pci_create_simple_multifunction(bus, devfn, true, "PIIX4");
>> - *isa_bus = DO_UPCAST(ISABus, qbus, qdev_get_child_bus(&d->qdev, "isa.0"));
>> + *isa_bus = DO_UPCAST(ISABus, qbus, qdev_get_child_bus(DEVICE(d), "isa.0"));
>
> Conflict, my ISABus patch does ISA_BUS() in addition:
> http://patchwork.ozlabs.org/patch/249705/
>
>> return d->devfn;
>> }
>>
>> diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
>> index 5261927..8ec0d84 100644
>> --- a/hw/isa/vt82c686.c
>> +++ b/hw/isa/vt82c686.c
> [...]
>> @@ -450,7 +450,7 @@ ISABus *vt82c686b_init(PCIBus *bus, int devfn)
>>
>> d = pci_create_simple_multifunction(bus, devfn, true, "VT82C686B");
>>
>> - return DO_UPCAST(ISABus, qbus, qdev_get_child_bus(&d->qdev, "isa.0"));
>> + return DO_UPCAST(ISABus, qbus, qdev_get_child_bus(DEVICE(d), "isa.0"));
>
> Ditto.
>
All come out in the wash in the rebase.
Regards,
Peter
>> }
>>
>> static void via_class_init(ObjectClass *klass, void *data)
>
> Otherwise looks fine.
>
> Andreas
>
> --
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
>
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [Qemu-devel] [RFT PATCH v1 12/30] virtio/virtio-pci: QOM casting sweep
2013-06-11 7:09 ` Frederic Konrad
@ 2013-06-24 5:00 ` Peter Crosthwaite
0 siblings, 0 replies; 37+ messages in thread
From: Peter Crosthwaite @ 2013-06-24 5:00 UTC (permalink / raw)
To: Frederic Konrad; +Cc: pbonzini, aliguori, qemu-devel, afaerber
Hi Frederic,
On Tue, Jun 11, 2013 at 5:09 PM, Frederic Konrad
<fred.konrad@greensocs.com> wrote:
> Hi,
>
>
> On 11/06/2013 08:49, peter.crosthwaite@xilinx.com wrote:
>>
>> From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>>
>> Use standard QOM cast macro. Remove usages of container_of() and
>> direct -> style upcasting.
>>
>> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>
> [...]
>
>> static inline VirtIOPCIProxy *to_virtio_pci_proxy(DeviceState *d)
>> {
>> - return container_of(d, VirtIOPCIProxy, pci_dev.qdev);
>> + return VIRTIO_PCI(d);
>> }
>
>
> Maybe you can replace each to_virtio_pci_proxy directly with VIRTIO_PCI?
>
I'm going to drop this one V2 for the moment and revisit is later. Its
more complicated, given the replications between the fast and slow
versions and needs a little more research (and a mini series of its
own).
Regards,
Peter
^ permalink raw reply [flat|nested] 37+ messages in thread
end of thread, other threads:[~2013-06-24 5:00 UTC | newest]
Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-11 6:40 [Qemu-devel] [RFT PATCH v1 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
2013-06-11 6:40 ` [Qemu-devel] [RFT PATCH v1 01/30] net/e1000: QOM Upcast Sweep peter.crosthwaite
2013-06-24 3:42 ` Peter Crosthwaite
2013-06-11 6:41 ` [Qemu-devel] [RFT PATCH v1 02/30] net/rtl8139: " peter.crosthwaite
2013-06-11 6:42 ` [Qemu-devel] [RFT PATCH v1 03/30] net/pcnet-pci: " peter.crosthwaite
2013-06-11 6:43 ` [Qemu-devel] [RFT PATCH v1 04/30] usb/hcd-xhci: " peter.crosthwaite
2013-06-11 6:43 ` [Qemu-devel] [RFT PATCH v1 05/30] scsi/lsi53c895a: " peter.crosthwaite
2013-06-11 6:44 ` [Qemu-devel] [RFT PATCH v1 06/30] scsi/megasas: " peter.crosthwaite
2013-06-24 3:42 ` Peter Crosthwaite
2013-06-11 6:45 ` [Qemu-devel] [RFT PATCH v1 07/30] scsi/esp-pci: " peter.crosthwaite
2013-06-11 6:46 ` [Qemu-devel] [RFT PATCH v1 08/30] ide/ich: " peter.crosthwaite
2013-06-11 6:46 ` [Qemu-devel] [RFT PATCH v1 09/30] ide/piix: QOM casting sweep peter.crosthwaite
2013-06-11 6:47 ` [Qemu-devel] [RFT PATCH v1 10/30] acpi/piix4: QOM Upcast Sweep peter.crosthwaite
2013-06-11 6:48 ` [Qemu-devel] [RFT PATCH v1 11/30] misc/pci-testdev: " peter.crosthwaite
2013-06-11 6:49 ` [Qemu-devel] [RFT PATCH v1 12/30] virtio/virtio-pci: QOM casting sweep peter.crosthwaite
2013-06-11 7:09 ` Frederic Konrad
2013-06-24 5:00 ` Peter Crosthwaite
2013-06-11 6:49 ` [Qemu-devel] [RFT PATCH v1 13/30] virtio/vmware_vga: " peter.crosthwaite
2013-06-11 6:50 ` [Qemu-devel] [RFT PATCH v1 14/30] misc/ivshmem: QOM Upcast Sweep peter.crosthwaite
2013-06-11 6:51 ` [Qemu-devel] [RFT PATCH v1 15/30] xen/xen_platform: QOM casting sweep peter.crosthwaite
2013-06-11 6:52 ` [Qemu-devel] [RFT PATCH v1 16/30] isa/*: " peter.crosthwaite
2013-06-11 9:58 ` Andreas Färber
2013-06-24 4:55 ` Peter Crosthwaite
2013-06-11 6:52 ` [Qemu-devel] [RFT PATCH v1 17/30] pci/*: " peter.crosthwaite
2013-06-11 6:53 ` [Qemu-devel] [RFT PATCH v1 18/30] pci-bridge/pci_bridge_dev: Don't use DO_UPCAST peter.crosthwaite
2013-06-11 6:54 ` [Qemu-devel] [RFT PATCH v1 19/30] pci-bridge/*: substitute ->qdev casts with DEVICE() peter.crosthwaite
2013-06-11 6:55 ` [Qemu-devel] [RFT PATCH v1 20/30] misc/vfio: " peter.crosthwaite
2013-06-11 6:55 ` [Qemu-devel] [RFT PATCH v1 21/30] net/eepro100: " peter.crosthwaite
2013-06-11 6:56 ` [Qemu-devel] [RFT PATCH v1 22/30] net/ne2000: " peter.crosthwaite
2013-06-11 6:57 ` [Qemu-devel] [RFT PATCH v1 23/30] usb/*: " peter.crosthwaite
2013-06-11 6:58 ` [Qemu-devel] [RFT PATCH v1 24/30] watchdog/wdt_i6300esb: " peter.crosthwaite
2013-06-11 6:58 ` [Qemu-devel] [RFT PATCH v1 25/30] scsi/vmw_pvscsi: " peter.crosthwaite
2013-06-11 6:59 ` [Qemu-devel] [RFT PATCH v1 26/30] i2c/smbus_ich9: " peter.crosthwaite
2013-06-11 7:00 ` [Qemu-devel] [RFT PATCH v1 27/30] ide/cmd646: " peter.crosthwaite
2013-06-11 7:01 ` [Qemu-devel] [RFT PATCH v1 28/30] ide/via: " peter.crosthwaite
2013-06-11 7:01 ` [Qemu-devel] [RFT PATCH v1 29/30] pci-host/*: " peter.crosthwaite
2013-06-11 7:02 ` [Qemu-devel] [RFT PATCH v1 30/30] i386/*: " peter.crosthwaite
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).