[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 11/14] hw/scsi/scsi-bus: Replace DO_UPCAST(SCSIBus) by SCSI_BU
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v3 11/14] hw/scsi/scsi-bus: Replace DO_UPCAST(SCSIBus) by SCSI_BUS() |
Date: |
Mon, 13 Feb 2023 19:43:35 +0100 |
Use the SCSI_BUS() QOM type-checking macro to avoid DO_UPCAST().
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/scsi/scsi-bus.c | 12 ++++++------
include/hw/scsi/scsi.h | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index 7b2a82b335..c4525515ab 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -104,7 +104,7 @@ static void scsi_device_unrealize(SCSIDevice *s)
int scsi_bus_parse_cdb(SCSIDevice *dev, SCSICommand *cmd, uint8_t *buf,
size_t buf_len, void *hba_private)
{
- SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(dev)));
+ SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(DEVICE(dev)));
int rc;
assert(cmd->len == 0);
@@ -250,7 +250,7 @@ static bool scsi_bus_check_address(BusState *qbus,
DeviceState *qdev, Error **er
static void scsi_qdev_realize(DeviceState *qdev, Error **errp)
{
SCSIDevice *dev = SCSI_DEVICE(qdev);
- SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(dev)));
+ SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(qdev));
bool is_free;
Error *local_err = NULL;
@@ -705,7 +705,7 @@ SCSIRequest *scsi_req_alloc(const SCSIReqOps *reqops,
SCSIDevice *d,
SCSIRequest *scsi_req_new(SCSIDevice *d, uint32_t tag, uint32_t lun,
uint8_t *buf, size_t buf_len, void *hba_private)
{
- SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(d)));
+ SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(DEVICE(d)));
const SCSIReqOps *ops;
SCSIDeviceClass *sc = SCSI_DEVICE_GET_CLASS(d);
SCSIRequest *req;
@@ -1353,7 +1353,7 @@ int scsi_req_parse_cdb(SCSIDevice *dev, SCSICommand *cmd,
uint8_t *buf,
void scsi_device_report_change(SCSIDevice *dev, SCSISense sense)
{
- SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(dev)));
+ SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(DEVICE(dev)));
scsi_device_set_ua(dev, sense);
if (bus->info->change) {
@@ -1698,7 +1698,7 @@ static int put_scsi_requests(QEMUFile *f, void *pv,
size_t size,
const VMStateField *field, JSONWriter *vmdesc)
{
SCSIDevice *s = pv;
- SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(s)));
+ SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(DEVICE(s)));
SCSIRequest *req;
QTAILQ_FOREACH(req, &s->requests, next) {
@@ -1726,7 +1726,7 @@ static int get_scsi_requests(QEMUFile *f, void *pv,
size_t size,
const VMStateField *field)
{
SCSIDevice *s = pv;
- SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(s)));
+ SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(DEVICE(s)));
int8_t sbyte;
while ((sbyte = qemu_get_sbyte(f)) > 0) {
diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h
index 843dde8851..eb558c145a 100644
--- a/include/hw/scsi/scsi.h
+++ b/include/hw/scsi/scsi.h
@@ -177,7 +177,7 @@ static inline void scsi_bus_init(SCSIBus *bus, size_t
bus_size,
static inline SCSIBus *scsi_bus_from_device(SCSIDevice *d)
{
- return DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(d)));
+ return SCSI_BUS(qdev_get_parent_bus(DEVICE(d)));
}
SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk,
--
2.38.1
- [PATCH v3 04/14] hw/char/serial-pci-multi: Factor multi_serial_class_initfn() out, (continued)
- [PATCH v3 04/14] hw/char/serial-pci-multi: Factor multi_serial_class_initfn() out, Philippe Mathieu-Daudé, 2023/02/13
- [PATCH v3 05/14] hw/char/serial-pci-multi: Replace DO_UPCAST() by PCI_MULTISERIAL(), Philippe Mathieu-Daudé, 2023/02/13
- [PATCH v3 06/14] hw/ide/qdev: Replace DO_UPCAST(IDEDevice) by IDE_DEVICE(), Philippe Mathieu-Daudé, 2023/02/13
- [PATCH v3 07/14] hw/ide/qdev: Replace DO_UPCAST(IDEBus) by IDE_BUS(), Philippe Mathieu-Daudé, 2023/02/13
- [PATCH v3 08/14] hw/net/ne2000-pci: Replace DO_UPCAST(PCINE2000State) by PCI_NE2000(), Philippe Mathieu-Daudé, 2023/02/13
- [PATCH v3 09/14] hw/net/tulip: Finish QOM conversion, Philippe Mathieu-Daudé, 2023/02/13
- [PATCH v3 10/14] hw/pci/pci: Replace DO_UPCAST(PCIBus) by PCI_BUS(), Philippe Mathieu-Daudé, 2023/02/13
- [PATCH v3 11/14] hw/scsi/scsi-bus: Replace DO_UPCAST(SCSIBus) by SCSI_BUS(),
Philippe Mathieu-Daudé <=
- [PATCH v3 12/14] hw/scsi/scsi-bus: Inline two uses of scsi_bus_from_device(), Philippe Mathieu-Daudé, 2023/02/13
- [PATCH v3 13/14] hw/usb/dev-hub: Use QOM USB_HUB() macro instead of casting, Philippe Mathieu-Daudé, 2023/02/13
- [PATCH v3 14/14] hw/usb: Replace DO_UPCAST(USBBus) by USB_BUS(), Philippe Mathieu-Daudé, 2023/02/13
- Re: [PATCH v3 00/14] hw: Use QOM macros and remove DO_UPCAST() uses, Philippe Mathieu-Daudé, 2023/02/28