diff mbox

[v4,02/13] qdev: change first argument of qbus_create_inplace to void *

Message ID 1359119559-19075-3-git-send-email-pbonzini@redhat.com
State New
Headers show

Commit Message

Paolo Bonzini Jan. 25, 2013, 1:12 p.m. UTC
Make it clear that no BUS() macro is needed in the callers (in fact it
wouldn't work because the object has not been initialized yet with the
right class).

Suggested-by: Andreas Faerber <afaerber@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/qdev-core.h | 2 +-
 hw/qdev.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Andreas Färber Jan. 25, 2013, 2:04 p.m. UTC | #1
Am 25.01.2013 14:12, schrieb Paolo Bonzini:
> Make it clear that no BUS() macro is needed in the callers (in fact it
> wouldn't work because the object has not been initialized yet with the
> right class).
> 
> Suggested-by: Andreas Faerber <afaerber@suse.de>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Acked-by: Andreas Färber <afaerber@suse.de>

But we should adjust most current callers then:

hw/ide/qdev.c:    qbus_create_inplace(&idebus->qbus, TYPE_IDE_BUS, dev,
NULL);

..._inplace(idebus, ...)

hw/intel-hda.c:    qbus_create_inplace(&bus->qbus, TYPE_HDA_BUS, dev, NULL);
hw/ipack.c:    qbus_create_inplace(&bus->qbus, TYPE_IPACK_BUS, parent,
name);
hw/pci/pci.c:    qbus_create_inplace(&bus->qbus, TYPE_PCI_BUS, parent,
name);
hw/pci/pci_bridge.c:    qbus_create_inplace(&sec_bus->qbus,
TYPE_PCI_BUS, &dev->qdev,
hw/s390-virtio-bus.c:    qbus_create_inplace((BusState *)bus,
TYPE_VIRTIO_S390_BUS, qdev, NULL);

..._inplace(bus, ...)

hw/s390x/event-facility.c:
qbus_create_inplace(&event_facility->sbus.qbus,
hw/scsi-bus.c:    qbus_create_inplace(&bus->qbus, TYPE_SCSI_BUS, host,
NULL);
hw/usb/bus.c:    qbus_create_inplace(&bus->qbus, TYPE_USB_BUS, host, NULL);
hw/usb/dev-smartcard-reader.c:    qbus_create_inplace(&s->bus.qbus,
TYPE_CCID_BUS, &dev->qdev, NULL);
hw/virtio-pci.c:    qbus_create_inplace((BusState *)bus,
TYPE_VIRTIO_PCI_BUS, qdev, NULL);
hw/virtio-serial-bus.c:    qbus_create_inplace(&vser->bus.qbus,
TYPE_VIRTIO_SERIAL_BUS, dev, NULL);

Should I send a follow-up patch for that or do you want to squash it
into yours to show the utility of your change?

Another caller with a cast is arriving in today's ppc pull (ADB in
cuda.c - 10/21).

Andreas
Paolo Bonzini Feb. 5, 2013, 6:20 a.m. UTC | #2
Il 25/01/2013 15:04, Andreas Färber ha scritto:
> Am 25.01.2013 14:12, schrieb Paolo Bonzini:
>> Make it clear that no BUS() macro is needed in the callers (in fact it
>> wouldn't work because the object has not been initialized yet with the
>> right class).
>>
>> Suggested-by: Andreas Faerber <afaerber@suse.de>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> 
> Acked-by: Andreas Färber <afaerber@suse.de>
> 
> But we should adjust most current callers then:
> 
> hw/ide/qdev.c:    qbus_create_inplace(&idebus->qbus, TYPE_IDE_BUS, dev,
> NULL);
> 
> ..._inplace(idebus, ...)
> 
> hw/intel-hda.c:    qbus_create_inplace(&bus->qbus, TYPE_HDA_BUS, dev, NULL);
> hw/ipack.c:    qbus_create_inplace(&bus->qbus, TYPE_IPACK_BUS, parent,
> name);
> hw/pci/pci.c:    qbus_create_inplace(&bus->qbus, TYPE_PCI_BUS, parent,
> name);
> hw/pci/pci_bridge.c:    qbus_create_inplace(&sec_bus->qbus,
> TYPE_PCI_BUS, &dev->qdev,
> hw/s390-virtio-bus.c:    qbus_create_inplace((BusState *)bus,
> TYPE_VIRTIO_S390_BUS, qdev, NULL);
> 
> ..._inplace(bus, ...)
> 
> hw/s390x/event-facility.c:
> qbus_create_inplace(&event_facility->sbus.qbus,
> hw/scsi-bus.c:    qbus_create_inplace(&bus->qbus, TYPE_SCSI_BUS, host,
> NULL);
> hw/usb/bus.c:    qbus_create_inplace(&bus->qbus, TYPE_USB_BUS, host, NULL);
> hw/usb/dev-smartcard-reader.c:    qbus_create_inplace(&s->bus.qbus,
> TYPE_CCID_BUS, &dev->qdev, NULL);
> hw/virtio-pci.c:    qbus_create_inplace((BusState *)bus,
> TYPE_VIRTIO_PCI_BUS, qdev, NULL);
> hw/virtio-serial-bus.c:    qbus_create_inplace(&vser->bus.qbus,
> TYPE_VIRTIO_SERIAL_BUS, dev, NULL);
> 
> Should I send a follow-up patch for that or do you want to squash it
> into yours to show the utility of your change?

Sorry, I missed this message.  I'll send a follow-up for 1.5.

Paolo
diff mbox

Patch

diff --git a/hw/qdev-core.h b/hw/qdev-core.h
index d1b8e37..2486f36 100644
--- a/hw/qdev-core.h
+++ b/hw/qdev-core.h
@@ -231,7 +231,7 @@  DeviceState *qdev_find_recursive(BusState *bus, const char *id);
 typedef int (qbus_walkerfn)(BusState *bus, void *opaque);
 typedef int (qdev_walkerfn)(DeviceState *dev, void *opaque);
 
-void qbus_create_inplace(BusState *bus, const char *typename,
+void qbus_create_inplace(void *bus, const char *typename,
                          DeviceState *parent, const char *name);
 BusState *qbus_create(const char *typename, DeviceState *parent, const char *name);
 /* Returns > 0 if either devfn or busfn skip walk somewhere in cursion,
diff --git a/hw/qdev.c b/hw/qdev.c
index 59dce62..b80b082 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -428,7 +428,7 @@  static void qbus_realize(BusState *bus, DeviceState *parent, const char *name)
     }
 }
 
-void qbus_create_inplace(BusState *bus, const char *typename,
+void qbus_create_inplace(void *bus, const char *typename,
                          DeviceState *parent, const char *name)
 {
     object_initialize(bus, typename);