Skip to contentSkip to conversation

hw/scsi/vmw_pvscsi: Use qbus_reset_all() directly

PATCH Superseded Philippe Mathieu-Daudé 2 participants 3 messages May 28, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/scsi/vmw_pvscsi: Use qbus_reset_all() directly

Since the BusState is accesible from the SCSIBus object, it is pointless to use qbus_reset_all_fn.
Use qbus_reset_all() directly.

---
One step toward removing qbus_reset_all_fn()

---
 hw/scsi/vmw_pvscsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/scsi/vmw_pvscsi.c +2 -2
index 584b4be07e..6f571d0d19 100644
@@ -440,7 +440,7 @@ static void
 pvscsi_reset_adapter(PVSCSIState *s)
 {
     s->resetting++;
-    qbus_reset_all_fn(&s->bus);
+    qbus_reset_all(&s->bus.qbus);
     s->resetting--;
     pvscsi_process_completion_queue(s);
     assert(QTAILQ_EMPTY(&s->pending_queue));
@@ -848,7 +848,7 @@ pvscsi_on_cmd_reset_bus(PVSCSIState *s)
     trace_pvscsi_on_cmd_arrived("PVSCSI_CMD_RESET_BUS");
 
     s->resetting++;
-    qbus_reset_all_fn(&s->bus);
+    qbus_reset_all(&s->bus.qbus);
     s->resetting--;
     return PVSCSI_COMMAND_PROCESSING_SUCCEEDED;
 }
Signature · 1 line
2.20.1
#1 lore raw
Quoted 17 lines · Philippe Mathieu-Daudé

Since the BusState is accesible from the SCSIBus object, it is pointless to use qbus_reset_all_fn.
Use qbus_reset_all() directly.

---
One step toward removing qbus_reset_all_fn()

---
 hw/scsi/vmw_pvscsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/scsi/vmw_pvscsi.c +0 -0
index 584b4be07e..6f571d0d19 100644

hw/scsi/vmw_pvscsi.c static void · line 443

Quoted 5 lines
hw/scsi/vmw_pvscsi.c +1 -1
@@ -440,7 +440,7 @@ static void
 pvscsi_reset_adapter(PVSCSIState *s)
 {
     s->resetting++;
-    qbus_reset_all_fn(&s->bus);
+    qbus_reset_all(&s->bus.qbus);

I thought our QOM style prefers using "BUS(&s->bus)" rather than looking inside the definition of the SCSIBus struct with "s->bus.qbus" ? (Compare preferring "DEVICE(s)" to "s->qdev".)

thanks
-- PMM

#2 lore raw
Quoted 13 lines · Peter Maydell
Quoted 12 lines · Philippe Mathieu-Daudé

Since the BusState is accesible from the SCSIBus object, it is pointless to use qbus_reset_all_fn.
Use qbus_reset_all() directly.

---
One step toward removing qbus_reset_all_fn()

---
 hw/scsi/vmw_pvscsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 15 lines

hw/scsi/vmw_pvscsi.c static void · line 443

Quoted 10 lines
hw/scsi/vmw_pvscsi.c +1 -1
index 584b4be07e..6f571d0d19 100644
@@ -440,7 +440,7 @@ static void
 pvscsi_reset_adapter(PVSCSIState *s)
 {
     s->resetting++;
-    qbus_reset_all_fn(&s->bus);
+    qbus_reset_all(&s->bus.qbus);

I thought our QOM style prefers using "BUS(&s->bus)" rather than looking inside the definition of the SCSIBus struct with "s->bus.qbus" ? (Compare preferring "DEVICE(s)" to "s->qdev".)

This is not explicit in HACKING/CODING_STYLE, but I agree this is cleaner and better to treat the generic QOM objects as opaque, and use the macros to check for the QOM type.

I'll respin.