qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 14/19] hw/scsi/scsi-bus: Inline two uses of scsi_bus_from_


From: Eric Farman
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
User-agent: Evolution 3.46.3 (3.46.3-1.fc37)

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,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]