From: Eric Farman <farman@linux.ibm.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
qemu-devel@nongnu.org, "Eduardo Habkost" <eduardo@habkost.net>
Cc: qemu-block@nongnu.org, Thomas Huth <thuth@redhat.com>,
Li Qiang <liq3ea@163.com>,
qemu-s390x@nongnu.org, Hu Tao <hutao@cn.fujitsu.com>,
Gonglei Arei <arei.gonglei@huawei.com>,
Cao jin <caoj.fnst@cn.fujitsu.com>,
xiaoqiang zhao <zxq_yx_007@163.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <richard.henderson@linaro.org>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Halil Pasic <pasic@linux.ibm.com>,
David Hildenbrand <david@redhat.com>,
Ilya Leoshkevich <iii@linux.ibm.com>, Fam Zheng <fam@euphon.net>
Subject: Re: [PATCH v2 14/19] hw/scsi/scsi-bus: Inline two uses of scsi_bus_from_device()
Date: Mon, 13 Feb 2023 10:28:31 -0500 [thread overview]
Message-ID: <93702d8efee3b8b7123ca13ea5c7512669cbc3ad.camel@linux.ibm.com> (raw)
In-Reply-To: <20230213070820.76881-15-philmd@linaro.org>
On Mon, 2023-02-13 at 08:08 +0100, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: Eric Farman <farman@linux.ibm.com>
> ---
> hw/s390x/ipl.c | 7 ++-----
> hw/scsi/scsi-bus.c | 2 +-
> include/hw/scsi/scsi.h | 5 -----
> 3 files changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
> index 8612684d48..4f7f4e60d6 100644
> --- a/hw/s390x/ipl.c
> +++ b/hw/s390x/ipl.c
> @@ -366,11 +366,8 @@ static CcwDevice
> *s390_get_ccw_device(DeviceState *dev_st, int *devtype)
> ccw_dev = CCW_DEVICE(vfio_ccw_dev);
> tmp_dt = CCW_DEVTYPE_VFIO;
> } else {
> - SCSIDevice *sd = (SCSIDevice *)
> - object_dynamic_cast(OBJECT(dev_st),
> - TYPE_SCSI_DEVICE);
> - if (sd) {
> - SCSIBus *sbus = scsi_bus_from_device(sd);
> + if (object_dynamic_cast(OBJECT(dev_st),
> TYPE_SCSI_DEVICE)) {
> + SCSIBus *sbus =
> SCSI_BUS(qdev_get_parent_bus(dev_st));
> VirtIODevice *vdev = (VirtIODevice *)
> object_dynamic_cast(OBJECT(sbus->qbus.parent),
> TYPE_VIRTIO_DEVICE);
> diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
> index c4525515ab..ee72b86b13 100644
> --- a/hw/scsi/scsi-bus.c
> +++ b/hw/scsi/scsi-bus.c
> @@ -679,7 +679,7 @@ SCSIRequest *scsi_req_alloc(const SCSIReqOps
> *reqops, SCSIDevice *d,
> uint32_t tag, uint32_t lun, void
> *hba_private)
> {
> SCSIRequest *req;
> - SCSIBus *bus = scsi_bus_from_device(d);
> + SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(DEVICE(d)));
> BusState *qbus = BUS(bus);
> const int memset_off = offsetof(SCSIRequest, sense)
> + sizeof(req->sense);
> diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h
> index eb558c145a..e3263dec0d 100644
> --- a/include/hw/scsi/scsi.h
> +++ b/include/hw/scsi/scsi.h
> @@ -175,11 +175,6 @@ static inline void scsi_bus_init(SCSIBus *bus,
> size_t bus_size,
> scsi_bus_init_named(bus, bus_size, host, info, NULL);
> }
>
> -static inline SCSIBus *scsi_bus_from_device(SCSIDevice *d)
> -{
> - return SCSI_BUS(qdev_get_parent_bus(DEVICE(d)));
> -}
> -
> SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend
> *blk,
> int unit, bool removable, int
> bootindex,
> bool share_rw,
next prev parent reply other threads:[~2023-02-13 15:33 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-13 7:08 [PATCH v2 00/19] hw: Use QOM macros and remove DO_UPCAST() uses Philippe Mathieu-Daudé
2023-02-13 7:08 ` [PATCH v2 01/19] hw/char/serial-pci: Replace DO_UPCAST(PCISerialState) by PCI_SERIAL() Philippe Mathieu-Daudé
2023-02-13 7:08 ` [PATCH v2 02/19] hw/char/serial-pci-multi: Batch register types using DEFINE_TYPES macro Philippe Mathieu-Daudé
2023-02-13 7:08 ` [PATCH v2 03/19] hw/char/serial-pci-multi: Introduce PCI_MULTISERIAL QOM abstract parent Philippe Mathieu-Daudé
2023-02-13 7:51 ` Philippe Mathieu-Daudé
2023-02-13 7:08 ` [PATCH v2 04/19] hw/char/serial-pci-multi: Factor multi_serial_class_initfn() out Philippe Mathieu-Daudé
2023-02-13 7:08 ` [PATCH v2 05/19] hw/char/serial-pci-multi: Replace DO_UPCAST() by PCI_MULTISERIAL() Philippe Mathieu-Daudé
2023-02-13 7:08 ` [PATCH v2 06/19] hw/ide/qdev: Replace DO_UPCAST(IDEDevice) by IDE_DEVICE() Philippe Mathieu-Daudé
2023-02-13 7:08 ` [PATCH v2 07/19] hw/ide/qdev: Replace DO_UPCAST(IDEBus) by IDE_BUS() Philippe Mathieu-Daudé
2023-02-13 7:08 ` [PATCH v2 08/19] hw/net/eepro100: Introduce TYPE_EEPRO100 QOM abstract parent Philippe Mathieu-Daudé
2023-02-13 8:36 ` Philippe Mathieu-Daudé
2023-02-13 10:12 ` Philippe Mathieu-Daudé
2023-02-13 7:08 ` [PATCH v2 09/19] hw/net/eepro100: Replace DO_UPCAST(EEPRO100State) by EEPRO100() Philippe Mathieu-Daudé
2023-02-13 7:08 ` [PATCH v2 10/19] hw/net/ne2000-pci: Replace DO_UPCAST(PCINE2000State) by PCI_NE2000() Philippe Mathieu-Daudé
2023-02-13 7:08 ` [PATCH v2 11/19] hw/net/tulip: Finish QOM conversion Philippe Mathieu-Daudé
2023-02-13 7:08 ` [PATCH v2 12/19] hw/pci/pci: Replace DO_UPCAST(PCIBus) by PCI_BUS() Philippe Mathieu-Daudé
2023-02-13 7:08 ` [PATCH v2 13/19] hw/scsi/scsi-bus: Replace DO_UPCAST(SCSIBus) by SCSI_BUS() Philippe Mathieu-Daudé
2023-02-13 7:08 ` [PATCH v2 14/19] hw/scsi/scsi-bus: Inline two uses of scsi_bus_from_device() Philippe Mathieu-Daudé
2023-02-13 15:28 ` Eric Farman [this message]
2023-02-13 7:08 ` [PATCH v2 15/19] hw/s390x/event-facility: Replace DO_UPCAST(SCLPEvent) by SCLP_EVENT() Philippe Mathieu-Daudé
2023-02-13 15:28 ` Eric Farman
2023-02-13 7:08 ` [PATCH v2 16/19] hw/vfio/ccw: Replace DO_UPCAST(VFIOCCWDevice) by VFIO_CCW() Philippe Mathieu-Daudé
2023-02-13 15:29 ` Eric Farman
2023-02-13 15:51 ` Philippe Mathieu-Daudé
2023-02-13 16:10 ` Philippe Mathieu-Daudé
2023-02-13 16:24 ` Eric Farman
2023-02-13 17:03 ` Philippe Mathieu-Daudé
2023-02-13 7:08 ` [PATCH v2 17/19] hw/usb/dev-hub: Use QOM USB_HUB() macro instead of casting Philippe Mathieu-Daudé
2023-02-13 7:08 ` [PATCH v2 18/19] hw/usb: Replace DO_UPCAST(USBBus) by USB_BUS() Philippe Mathieu-Daudé
2023-02-13 7:08 ` [RFC PATCH v2 19/19] hw/usb: Inline usb_bus_from_device() Philippe Mathieu-Daudé
2023-02-13 8:11 ` Thomas Huth
2023-02-13 8:44 ` Philippe Mathieu-Daudé
2023-02-13 9:11 ` Thomas Huth
2023-02-13 9:49 ` Philippe Mathieu-Daudé
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=93702d8efee3b8b7123ca13ea5c7512669cbc3ad.camel@linux.ibm.com \
--to=farman@linux.ibm.com \
--cc=arei.gonglei@huawei.com \
--cc=borntraeger@linux.ibm.com \
--cc=caoj.fnst@cn.fujitsu.com \
--cc=david@redhat.com \
--cc=eduardo@habkost.net \
--cc=fam@euphon.net \
--cc=hutao@cn.fujitsu.com \
--cc=iii@linux.ibm.com \
--cc=liq3ea@163.com \
--cc=pasic@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
--cc=zxq_yx_007@163.com \
/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).