From: Paolo Bonzini <pbonzini@redhat.com>
To: "Andreas Färber" <afaerber@suse.de>
Cc: peter.maydell@linaro.org, Alexander Graf <agraf@suse.de>,
qemu-devel@nongnu.org, sPAPR <qemu-ppc@nongnu.org>,
Gerd Hoffmann <kraxel@redhat.com>,
anthony@codemonkey.ws, Paul Brook <paul@codesourcery.com>
Subject: Re: [Qemu-devel] [PATCH 06/16] scsi: Pass size to scsi_bus_new()
Date: Mon, 26 Aug 2013 10:01:07 +0200 [thread overview]
Message-ID: <521B0B43.2090202@redhat.com> (raw)
In-Reply-To: <1377302436-25193-7-git-send-email-afaerber@suse.de>
Il 24/08/2013 02:00, Andreas Färber ha scritto:
> To be passed to qbus_create_inplace().
>
> Use DEVICE() casts instead of direct parent field access.
>
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
> hw/scsi/esp-pci.c | 2 +-
> hw/scsi/esp.c | 2 +-
> hw/scsi/lsi53c895a.c | 2 +-
> hw/scsi/megasas.c | 3 ++-
> hw/scsi/scsi-bus.c | 4 ++--
> hw/scsi/spapr_vscsi.c | 3 ++-
> hw/scsi/virtio-scsi.c | 3 ++-
> hw/scsi/vmw_pvscsi.c | 3 ++-
> hw/usb/dev-storage.c | 6 ++++--
> hw/usb/dev-uas.c | 3 ++-
> include/hw/scsi/scsi.h | 4 ++--
> 11 files changed, 21 insertions(+), 14 deletions(-)
>
> diff --git a/hw/scsi/esp-pci.c b/hw/scsi/esp-pci.c
> index d7ec173..99bf8ec 100644
> --- a/hw/scsi/esp-pci.c
> +++ b/hw/scsi/esp-pci.c
> @@ -363,7 +363,7 @@ static int esp_pci_scsi_init(PCIDevice *dev)
> pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &pci->io);
> s->irq = dev->irq[0];
>
> - scsi_bus_new(&s->bus, d, &esp_pci_scsi_info, NULL);
> + scsi_bus_new(&s->bus, sizeof(s->bus), d, &esp_pci_scsi_info, NULL);
> if (!d->hotplugged) {
> scsi_bus_legacy_handle_cmdline(&s->bus, &err);
> if (err != NULL) {
> diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
> index 101e957..2d150bf 100644
> --- a/hw/scsi/esp.c
> +++ b/hw/scsi/esp.c
> @@ -688,7 +688,7 @@ static void sysbus_esp_realize(DeviceState *dev, Error **errp)
>
> qdev_init_gpio_in(dev, sysbus_esp_gpio_demux, 2);
>
> - scsi_bus_new(&s->bus, dev, &esp_scsi_info, NULL);
> + scsi_bus_new(&s->bus, sizeof(s->bus), dev, &esp_scsi_info, NULL);
> scsi_bus_legacy_handle_cmdline(&s->bus, &err);
> if (err != NULL) {
> error_propagate(errp, err);
> diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
> index 611f2aa..0c36842 100644
> --- a/hw/scsi/lsi53c895a.c
> +++ b/hw/scsi/lsi53c895a.c
> @@ -2117,7 +2117,7 @@ static int lsi_scsi_init(PCIDevice *dev)
> pci_register_bar(dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->ram_io);
> QTAILQ_INIT(&s->queue);
>
> - scsi_bus_new(&s->bus, d, &lsi_scsi_info, NULL);
> + scsi_bus_new(&s->bus, sizeof(s->bus), d, &lsi_scsi_info, NULL);
> if (!d->hotplugged) {
> scsi_bus_legacy_handle_cmdline(&s->bus, &err);
> if (err != NULL) {
> diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
> index a6d5285..09b51b3 100644
> --- a/hw/scsi/megasas.c
> +++ b/hw/scsi/megasas.c
> @@ -2171,7 +2171,8 @@ static int megasas_scsi_init(PCIDevice *dev)
> s->frames[i].state = s;
> }
>
> - scsi_bus_new(&s->bus, DEVICE(dev), &megasas_scsi_info, NULL);
> + scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(dev),
> + &megasas_scsi_info, NULL);
> if (!d->hotplugged) {
> scsi_bus_legacy_handle_cmdline(&s->bus, &err);
> if (err != NULL) {
> diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
> index fbf9173..968bf23 100644
> --- a/hw/scsi/scsi-bus.c
> +++ b/hw/scsi/scsi-bus.c
> @@ -72,8 +72,8 @@ static void scsi_device_unit_attention_reported(SCSIDevice *s)
> }
>
> /* Create a scsi bus, and attach devices to it. */
> -void scsi_bus_new(SCSIBus *bus, DeviceState *host, const SCSIBusInfo *info,
> - const char *bus_name)
> +void scsi_bus_new(SCSIBus *bus, size_t bus_size, DeviceState *host,
> + const SCSIBusInfo *info, const char *bus_name)
> {
> qbus_create_inplace(&bus->qbus, TYPE_SCSI_BUS, host, bus_name);
> bus->busnr = next_scsi_bus++;
> diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c
> index e9090e5..b2fcd4b 100644
> --- a/hw/scsi/spapr_vscsi.c
> +++ b/hw/scsi/spapr_vscsi.c
> @@ -1020,7 +1020,8 @@ static int spapr_vscsi_init(VIOsPAPRDevice *dev)
>
> dev->crq.SendFunc = vscsi_do_crq;
>
> - scsi_bus_new(&s->bus, &dev->qdev, &vscsi_scsi_info, NULL);
> + scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(dev),
> + &vscsi_scsi_info, NULL);
> if (!dev->qdev.hotplugged) {
> scsi_bus_legacy_handle_cmdline(&s->bus, &err);
> if (err != NULL) {
> diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
> index 05da56b..3bd690d 100644
> --- a/hw/scsi/virtio-scsi.c
> +++ b/hw/scsi/virtio-scsi.c
> @@ -627,7 +627,8 @@ static int virtio_scsi_device_init(VirtIODevice *vdev)
> return ret;
> }
>
> - scsi_bus_new(&s->bus, qdev, &virtio_scsi_scsi_info, vdev->bus_name);
> + scsi_bus_new(&s->bus, sizeof(s->bus), qdev,
> + &virtio_scsi_scsi_info, vdev->bus_name);
>
> if (!qdev->hotplugged) {
> scsi_bus_legacy_handle_cmdline(&s->bus, &err);
> diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
> index d42b359..819d671 100644
> --- a/hw/scsi/vmw_pvscsi.c
> +++ b/hw/scsi/vmw_pvscsi.c
> @@ -1088,7 +1088,8 @@ pvscsi_init(PCIDevice *pci_dev)
> return -ENOMEM;
> }
>
> - scsi_bus_new(&s->bus, &pci_dev->qdev, &pvscsi_scsi_info, NULL);
> + scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(pci_dev),
> + &pvscsi_scsi_info, NULL);
> pvscsi_reset_state(s);
>
> return 0;
> diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
> index a8dc2fa..1d81ac2 100644
> --- a/hw/usb/dev-storage.c
> +++ b/hw/usb/dev-storage.c
> @@ -618,7 +618,8 @@ static int usb_msd_initfn_storage(USBDevice *dev)
>
> usb_desc_create_serial(dev);
> usb_desc_init(dev);
> - scsi_bus_new(&s->bus, &s->dev.qdev, &usb_msd_scsi_info_storage, NULL);
> + scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(dev),
> + &usb_msd_scsi_info_storage, NULL);
> scsi_dev = scsi_bus_legacy_add_drive(&s->bus, bs, 0, !!s->removable,
> s->conf.bootindex, dev->serial,
> &err);
> @@ -646,7 +647,8 @@ static int usb_msd_initfn_bot(USBDevice *dev)
>
> usb_desc_create_serial(dev);
> usb_desc_init(dev);
> - scsi_bus_new(&s->bus, &s->dev.qdev, &usb_msd_scsi_info_bot, NULL);
> + scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(dev),
> + &usb_msd_scsi_info_bot, NULL);
> s->bus.qbus.allow_hotplug = 0;
> usb_msd_handle_reset(dev);
>
> diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c
> index 63ad12e..1569d6e 100644
> --- a/hw/usb/dev-uas.c
> +++ b/hw/usb/dev-uas.c
> @@ -888,7 +888,8 @@ static int usb_uas_init(USBDevice *dev)
> QTAILQ_INIT(&uas->requests);
> uas->status_bh = qemu_bh_new(usb_uas_send_status_bh, uas);
>
> - scsi_bus_new(&uas->bus, &uas->dev.qdev, &usb_uas_scsi_info, NULL);
> + scsi_bus_new(&uas->bus, sizeof(uas->bus), DEVICE(dev),
> + &usb_uas_scsi_info, NULL);
>
> return 0;
> }
> diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h
> index 8786531..1b66510 100644
> --- a/include/hw/scsi/scsi.h
> +++ b/include/hw/scsi/scsi.h
> @@ -152,8 +152,8 @@ struct SCSIBus {
> const SCSIBusInfo *info;
> };
>
> -void scsi_bus_new(SCSIBus *bus, DeviceState *host, const SCSIBusInfo *info,
> - const char *bus_name);
> +void scsi_bus_new(SCSIBus *bus, size_t bus_size, DeviceState *host,
> + const SCSIBusInfo *info, const char *bus_name);
>
> static inline SCSIBus *scsi_bus_from_device(SCSIDevice *d)
> {
>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
next prev parent reply other threads:[~2013-08-26 8:01 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-24 0:00 [Qemu-devel] [PATCH 00/16] qom: Assert sufficient object instance size Andreas Färber
2013-08-24 0:00 ` [Qemu-devel] [PATCH 01/16] qom: Fix object_initialize_with_type() argument name in documentation Andreas Färber
2013-08-24 0:00 ` [Qemu-devel] [PATCH 02/16] intel-hda: Pass size to hda_codec_bus_init() Andreas Färber
2013-08-24 0:00 ` [Qemu-devel] [PATCH 03/16] ipack: Pass size to ipack_bus_new_inplace() Andreas Färber
2013-08-26 7:23 ` Wenchao Xia
2013-08-24 0:00 ` [Qemu-devel] [PATCH 04/16] ide: Pass size to ide_bus_new() Andreas Färber
2013-08-24 0:00 ` [Qemu-devel] [PATCH 05/16] pci: Pass size to pci_bus_new_inplace() Andreas Färber
2013-08-24 0:00 ` [Qemu-devel] [PATCH 06/16] scsi: Pass size to scsi_bus_new() Andreas Färber
2013-08-26 8:01 ` Paolo Bonzini [this message]
2013-08-24 0:00 ` [Qemu-devel] [PATCH 07/16] usb: Pass size to usb_bus_new() Andreas Färber
2013-08-24 0:00 ` [Qemu-devel] [PATCH 08/16] virtio-pci: Pass size to virtio_pci_bus_new() Andreas Färber
2013-08-24 0:00 ` [Qemu-devel] [PATCH 09/16] s390-virtio-bus: Pass size to virtio_s390_bus_new() Andreas Färber
2013-08-24 0:00 ` [Qemu-devel] [PATCH 10/16] virtio-ccw: Pass size to virtio_ccw_bus_new() Andreas Färber
2013-08-26 8:00 ` Cornelia Huck
2013-08-24 0:00 ` [Qemu-devel] [PATCH 11/16] virtio-mmio: Pass size to virtio_mmio_bus_new() Andreas Färber
2013-08-24 0:00 ` [Qemu-devel] [PATCH 12/16] qdev: Pass size to qbus_create_inplace() Andreas Färber
2013-08-26 7:44 ` Wenchao Xia
2013-08-30 17:12 ` Andreas Färber
2013-08-26 8:03 ` Cornelia Huck
2013-08-30 17:05 ` Andreas Färber
2013-08-24 0:00 ` [Qemu-devel] [PATCH 13/16] qom: Pass available size to object_initialize() Andreas Färber
2013-08-26 8:09 ` Cornelia Huck
2013-08-26 8:11 ` Wenchao Xia
2013-08-30 17:14 ` Andreas Färber
2013-08-24 0:00 ` [Qemu-devel] [PATCH 14/16] qom: Introduce type_get_instance_size() Andreas Färber
2013-08-24 0:00 ` [Qemu-devel] [PATCH 15/16] qdev-monitor: Clean up qdev_device_add() variable naming Andreas Färber
2013-08-26 7:52 ` Wenchao Xia
2013-08-30 17:19 ` Andreas Färber
2013-09-12 14:40 ` Andreas Färber
2013-08-24 0:00 ` [Qemu-devel] [PATCH 16/16] qdev-monitor: Avoid aborting on out-of-memory in qdev_device_add() Andreas Färber
2013-08-26 8:12 ` [Qemu-devel] [PATCH 00/16] qom: Assert sufficient object instance size Wenchao Xia
2013-08-30 19:37 ` Andreas Färber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=521B0B43.2090202@redhat.com \
--to=pbonzini@redhat.com \
--cc=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=anthony@codemonkey.ws \
--cc=kraxel@redhat.com \
--cc=paul@codesourcery.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).