Skip to contentSkip to conversation

qom: Use BUS()/DEVICE() macros instead of looking inside definitions

PATCH Applied Philippe Mathieu-Daudé 8 participants 31 messages May 28, 2019 – Jun 6, 2019

lore
Share & tools
lore
#0 lore raw

v2 cover qom: Use BUS()/DEVICE() macros instead of looking inside definitions

v1 was a simple patch:
'use qbus_reset_all() directly instead of qbus_reset_all_fn' where I was looking inside the definition of BusState.

Peter suggested to use the prefered QOM style, using the BUS/DEVICE macros. While here, I also cleaned the rest of the codebase.

Philippe Mathieu-Daudé (10):
hw/scsi/vmw_pvscsi: Use qbus_reset_all() directly
hw/scsi: Use the QOM BUS() macro to access BusState.qbus hw/pci-bridge: Use the QOM BUS() macro to access BusState.qbus hw/s390x/event-facility: Use the QOM BUS() macro to access
BusState.qbus
hw/sd: Use the QOM BUS() macro to access BusState.qbus hw/audio/ac97: Use the QOM DEVICE() macro to access DeviceState.qdev hw/isa: Use the QOM DEVICE() macro to access DeviceState.qdev hw/usb-storage: Use the QOM DEVICE() macro to access DeviceState.qdev hw/vfio/pci: Use the QOM DEVICE() macro to access DeviceState.qdev hw/watchdog/wdt_i6300esb: Use DEVICE() macro to access
DeviceState.qdev

 hw/audio/ac97.c            | 2 +-
 hw/isa/lpc_ich9.c          | 2 +-
 hw/isa/vt82c686.c          | 2 +-
 hw/pci/pci_bridge.c        | 2 +-
 hw/s390x/event-facility.c  | 4 ++--
 hw/scsi/lsi53c895a.c       | 2 +-
 hw/scsi/mptsas.c           | 4 ++--
 hw/scsi/virtio-scsi.c      | 2 +-
 hw/scsi/vmw_pvscsi.c       | 4 ++--
 hw/sd/milkymist-memcard.c  | 2 +-
 hw/sd/ssi-sd.c             | 2 +-
 hw/usb/dev-storage.c       | 2 +-
 hw/vfio/pci.c              | 4 ++--
 hw/watchdog/wdt_i6300esb.c | 2 +-
 14 files changed, 18 insertions(+), 18 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH v2 1/10 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.

---
v2: Use BUS() macro (Peter Maydell)

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..c39e33fa35 100644
@@ -440,7 +440,7 @@ static void
 pvscsi_reset_adapter(PVSCSIState *s)
 {
     s->resetting++;
-    qbus_reset_all_fn(&s->bus);
+    qbus_reset_all(BUS(&s->bus));
     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(BUS(&s->bus));
     s->resetting--;
     return PVSCSI_COMMAND_PROCESSING_SUCCEEDED;
 }
Signature · 1 line
2.20.1
Reviewed-by on v2 1/10
#2 lore raw

Re: [Qemu-devel] [PATCH v2 01/10] hw/scsi/vmw_pvscsi: Use qbus_reset_all() directly

Quoted 40 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.

---
v2: Use BUS() macro (Peter Maydell)

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..c39e33fa35 100644
@@ -440,7 +440,7 @@ static void
 pvscsi_reset_adapter(PVSCSIState *s)
 {
    s->resetting++;
-    qbus_reset_all_fn(&s->bus);
+    qbus_reset_all(BUS(&s->bus));
    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(BUS(&s->bus));
    s->resetting--;
    return PVSCSI_COMMAND_PROCESSING_SUCCEEDED;
 }
Signature · 1 line
2.20.1
#3 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH v2 01/10] hw/scsi/vmw_pvscsi: Use qbus_reset_all() directly

In reply to Philippe Mathieu-Daudé

Le 28/05/2019 à 18:40, Philippe Mathieu-Daudé a écrit :

Quoted 28 lines

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

---
v2: Use BUS() macro (Peter Maydell)

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 +1 -1
index 584b4be07e..c39e33fa35 100644
@@ -440,7 +440,7 @@ static void
 pvscsi_reset_adapter(PVSCSIState *s)
 {
     s->resetting++;
-    qbus_reset_all_fn(&s->bus);
+    qbus_reset_all(BUS(&s->bus));
     s->resetting--;
     pvscsi_process_completion_queue(s);
     assert(QTAILQ_EMPTY(&s->pending_queue));

hw/scsi/vmw_pvscsi.c pvscsi_on_cmd_reset_bus(PVSCSIState *s) · line 854

Quoted 8 lines
hw/scsi/vmw_pvscsi.c +1 -1
@@ -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(BUS(&s->bus));
     s->resetting--;
     return PVSCSI_COMMAND_PROCESSING_SUCCEEDED;
 }

Applied to my trivial-patches branch.

Thanks,
Laurent

#4 lore raw

PATCH v2 2/10 hw/scsi: Use the QOM BUS() macro to access BusState.qbus

In reply to Philippe Mathieu-Daudé

Rather than looking inside the definition of a BusState with "s->bus.qbus", use the QOM prefered style: "BUS(&s->bus)".

This patch was generated using the following Coccinelle script:

    // Use BUS() macros to access BusState.qbus
    @use_bus_macro_to_access_qbus@
    expression obj;
    identifier bus;
    @@
    -&obj->bus.qbus
    +BUS(&obj->bus)
---
 hw/scsi/lsi53c895a.c  | 2 +-
 hw/scsi/mptsas.c      | 4 ++--
 hw/scsi/virtio-scsi.c | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
hw/scsi/lsi53c895a.c +1 -1
index da7239d94f..a8b7a199f9 100644
@@ -1860,7 +1860,7 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val)
         }
         if (val & LSI_SCNTL1_RST) {
             if (!(s->sstat0 & LSI_SSTAT0_RST)) {
-                qbus_reset_all(&s->bus.qbus);
+                qbus_reset_all(BUS(&s->bus));
                 s->sstat0 |= LSI_SSTAT0_RST;
                 lsi_script_scsi_interrupt(s, LSI_SIST0_RST, 0);
             }
hw/scsi/mptsas.c +2 -2
index 929404fb48..e800683e91 100644
@@ -540,7 +540,7 @@ reply_maybe_async:
         break;
 
     case MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS:
-        qbus_reset_all(&s->bus.qbus);
+        qbus_reset_all(BUS(&s->bus));
         break;
 
     default:
@@ -803,7 +803,7 @@ static void mptsas_soft_reset(MPTSASState *s)
     s->intr_mask = MPI_HIM_DIM | MPI_HIM_RIM;
     mptsas_update_interrupt(s);
 
-    qbus_reset_all(&s->bus.qbus);
+    qbus_reset_all(BUS(&s->bus));
     s->intr_status = 0;
     s->intr_mask = save_mask;
 
hw/scsi/virtio-scsi.c +1 -1
index 839f120256..2a71b78e22 100644
@@ -696,7 +696,7 @@ static void virtio_scsi_reset(VirtIODevice *vdev)
 
     assert(!s->dataplane_started);
     s->resetting++;
-    qbus_reset_all(&s->bus.qbus);
+    qbus_reset_all(BUS(&s->bus));
     s->resetting--;
 
     vs->sense_size = VIRTIO_SCSI_SENSE_DEFAULT_SIZE;
Signature · 1 line
2.20.1
Reviewed-by on v2 2/10
#5 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH v2 02/10] hw/scsi: Use the QOM BUS() macro to access BusState.qbus

Le 28/05/2019 à 18:40, Philippe Mathieu-Daudé a écrit :

Quoted 13 lines

Rather than looking inside the definition of a BusState with "s->bus.qbus", use the QOM prefered style: "BUS(&s->bus)".

This patch was generated using the following Coccinelle script:

    // Use BUS() macros to access BusState.qbus
    @use_bus_macro_to_access_qbus@
    expression obj;
    identifier bus;
    @@
    -&obj->bus.qbus
    +BUS(&obj->bus)
Quoted 8 lines
---
 hw/scsi/lsi53c895a.c  | 2 +-
 hw/scsi/mptsas.c      | 4 ++--
 hw/scsi/virtio-scsi.c | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
#6 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH v2 02/10] hw/scsi: Use the QOM BUS() macro to access BusState.qbus

In reply to Philippe Mathieu-Daudé

Le 28/05/2019 à 18:40, Philippe Mathieu-Daudé a écrit :

Quoted 62 lines

Rather than looking inside the definition of a BusState with "s->bus.qbus", use the QOM prefered style: "BUS(&s->bus)".

This patch was generated using the following Coccinelle script:

    // Use BUS() macros to access BusState.qbus
    @use_bus_macro_to_access_qbus@
    expression obj;
    identifier bus;
    @@
    -&obj->bus.qbus
    +BUS(&obj->bus)
---
 hw/scsi/lsi53c895a.c  | 2 +-
 hw/scsi/mptsas.c      | 4 ++--
 hw/scsi/virtio-scsi.c | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
hw/scsi/lsi53c895a.c +1 -1
index da7239d94f..a8b7a199f9 100644
@@ -1860,7 +1860,7 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val)
         }
         if (val & LSI_SCNTL1_RST) {
             if (!(s->sstat0 & LSI_SSTAT0_RST)) {
-                qbus_reset_all(&s->bus.qbus);
+                qbus_reset_all(BUS(&s->bus));
                 s->sstat0 |= LSI_SSTAT0_RST;
                 lsi_script_scsi_interrupt(s, LSI_SIST0_RST, 0);
             }
hw/scsi/mptsas.c +2 -2
index 929404fb48..e800683e91 100644
@@ -540,7 +540,7 @@ reply_maybe_async:
         break;
 
     case MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS:
-        qbus_reset_all(&s->bus.qbus);
+        qbus_reset_all(BUS(&s->bus));
         break;
 
     default:
@@ -803,7 +803,7 @@ static void mptsas_soft_reset(MPTSASState *s)
     s->intr_mask = MPI_HIM_DIM | MPI_HIM_RIM;
     mptsas_update_interrupt(s);
 
-    qbus_reset_all(&s->bus.qbus);
+    qbus_reset_all(BUS(&s->bus));
     s->intr_status = 0;
     s->intr_mask = save_mask;
 
hw/scsi/virtio-scsi.c +0 -0
index 839f120256..2a71b78e22 100644

hw/scsi/virtio-scsi.c static void virtio_scsi_reset(VirtIODevice *vdev) · line 702

Quoted 8 lines
hw/scsi/virtio-scsi.c +1 -1
@@ -696,7 +696,7 @@ static void virtio_scsi_reset(VirtIODevice *vdev)
 
     assert(!s->dataplane_started);
     s->resetting++;
-    qbus_reset_all(&s->bus.qbus);
+    qbus_reset_all(BUS(&s->bus));
     s->resetting--;
 
     vs->sense_size = VIRTIO_SCSI_SENSE_DEFAULT_SIZE;

Applied to my trivial-patches branch.

Thanks,
Laurent

#7 lore raw

PATCH v2 3/10 hw/pci-bridge: Use the QOM BUS() macro to access BusState.qbus

In reply to Philippe Mathieu-Daudé

Rather than looking inside the definition of a BusState with "s->bus.qbus", use the QOM prefered style: "BUS(&s->bus)".

This patch was generated using the following Coccinelle script:

    // Use BUS() macros to access BusState.qbus
    @use_bus_macro_to_access_qbus@
    expression obj;
    identifier bus;
    @@
    -&obj->bus.qbus
    +BUS(&obj->bus)
---
 hw/pci/pci_bridge.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci/pci_bridge.c +1 -1
index c6d9ded320..8d954885c0 100644
@@ -273,7 +273,7 @@ void pci_bridge_write_config(PCIDevice *d,
     newctl = pci_get_word(d->config + PCI_BRIDGE_CONTROL);
     if (~oldctl & newctl & PCI_BRIDGE_CTL_BUS_RESET) {
         /* Trigger hot reset on 0->1 transition. */
-        qbus_reset_all(&s->sec_bus.qbus);
+        qbus_reset_all(BUS(&s->sec_bus));
     }
 }
 
Signature · 1 line
2.20.1
Reviewed-by on v2 3/10
#8 lore raw

Re: [Qemu-devel] [PATCH v2 03/10] hw/pci-bridge: Use the QOM BUS() macro to access BusState.qbus

Quoted 24 lines · Philippe Mathieu-Daudé

Rather than looking inside the definition of a BusState with "s->bus.qbus", use the QOM prefered style: "BUS(&s->bus)".

This patch was generated using the following Coccinelle script:

     // Use BUS() macros to access BusState.qbus
     @use_bus_macro_to_access_qbus@
     expression obj;
     identifier bus;
     @@
     -&obj->bus.qbus
     +BUS(&obj->bus)
---
  hw/pci/pci_bridge.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci/pci_bridge.c +0 -0
index c6d9ded320..8d954885c0 100644

hw/pci/pci_bridge.c void pci_bridge_write_config(PCIDevice *d, · line 279

Quoted 8 lines
hw/pci/pci_bridge.c +1 -1
@@ -273,7 +273,7 @@ void pci_bridge_write_config(PCIDevice *d,
      newctl = pci_get_word(d->config + PCI_BRIDGE_CONTROL);
      if (~oldctl & newctl & PCI_BRIDGE_CTL_BUS_RESET) {
          /* Trigger hot reset on 0->1 transition. */
-        qbus_reset_all(&s->sec_bus.qbus);
+        qbus_reset_all(BUS(&s->sec_bus));
      }
  }
 

Thanks,
Marcel

#9 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH v2 03/10] hw/pci-bridge: Use the QOM BUS() macro to access BusState.qbus

In reply to Philippe Mathieu-Daudé

Le 28/05/2019 à 18:40, Philippe Mathieu-Daudé a écrit :

Quoted 25 lines

Rather than looking inside the definition of a BusState with "s->bus.qbus", use the QOM prefered style: "BUS(&s->bus)".

This patch was generated using the following Coccinelle script:

    // Use BUS() macros to access BusState.qbus
    @use_bus_macro_to_access_qbus@
    expression obj;
    identifier bus;
    @@
    -&obj->bus.qbus
    +BUS(&obj->bus)
---
 hw/pci/pci_bridge.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci/pci_bridge.c +0 -0
index c6d9ded320..8d954885c0 100644

hw/pci/pci_bridge.c void pci_bridge_write_config(PCIDevice *d, · line 279

Quoted 8 lines
hw/pci/pci_bridge.c +1 -1
@@ -273,7 +273,7 @@ void pci_bridge_write_config(PCIDevice *d,
     newctl = pci_get_word(d->config + PCI_BRIDGE_CONTROL);
     if (~oldctl & newctl & PCI_BRIDGE_CTL_BUS_RESET) {
         /* Trigger hot reset on 0->1 transition. */
-        qbus_reset_all(&s->sec_bus.qbus);
+        qbus_reset_all(BUS(&s->sec_bus));
     }
 }
 

Applied to my trivial-patches branch.

Thanks,
Laurent

#10 lore raw

PATCH v2 4/10 hw/s390x/event-facility: Use the QOM BUS() macro to access BusState.qbus

In reply to Philippe Mathieu-Daudé

Rather than looking inside the definition of a BusState with "s->bus.qbus", use the QOM prefered style: "BUS(&s->bus)".

This patch was generated using the following Coccinelle script:

    // Use BUS() macros to access BusState.qbus
    @use_bus_macro_to_access_qbus@
    expression obj;
    identifier bus;
    @@
    -&obj->bus.qbus
    +BUS(&obj->bus)
---
 hw/s390x/event-facility.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/s390x/event-facility.c +2 -2
index ee5b83448b..e574223a22 100644
@@ -466,12 +466,12 @@ static void init_event_facility(Object *obj)
     new = object_new(TYPE_SCLP_QUIESCE);
     object_property_add_child(obj, TYPE_SCLP_QUIESCE, new, NULL);
     object_unref(new);
-    qdev_set_parent_bus(DEVICE(new), &event_facility->sbus.qbus);
+    qdev_set_parent_bus(DEVICE(new), BUS(&event_facility->sbus));
 
     new = object_new(TYPE_SCLP_CPU_HOTPLUG);
     object_property_add_child(obj, TYPE_SCLP_CPU_HOTPLUG, new, NULL);
     object_unref(new);
-    qdev_set_parent_bus(DEVICE(new), &event_facility->sbus.qbus);
+    qdev_set_parent_bus(DEVICE(new), BUS(&event_facility->sbus));
     /* the facility will automatically realize the devices via the bus */
 }
 
Signature · 1 line
2.20.1
Reviewed-by on v2 4/10
#11 lore raw

Re: [Qemu-devel] [PATCH v2 04/10] hw/s390x/event-facility: Use the QOM BUS() macro to access BusState.qbus

Quoted 13 lines · On Tue, 28 May 2019 18:40:14 +0200 Philippe Mathieu-Daudé <[email protected]>…

Rather than looking inside the definition of a BusState with "s->bus.qbus", use the QOM prefered style: "BUS(&s->bus)".

This patch was generated using the following Coccinelle script:

    // Use BUS() macros to access BusState.qbus
    @use_bus_macro_to_access_qbus@
    expression obj;
    identifier bus;
    @@
    -&obj->bus.qbus
    +BUS(&obj->bus)
Quoted 5 lines
---
 hw/s390x/event-facility.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(I assume this will go through the trivial tree?)

#12 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH v2 04/10] hw/s390x/event-facility: Use the QOM BUS() macro to access BusState.qbus

In reply to Philippe Mathieu-Daudé

Le 28/05/2019 à 18:40, Philippe Mathieu-Daudé a écrit :

Quoted 29 lines

Rather than looking inside the definition of a BusState with "s->bus.qbus", use the QOM prefered style: "BUS(&s->bus)".

This patch was generated using the following Coccinelle script:

    // Use BUS() macros to access BusState.qbus
    @use_bus_macro_to_access_qbus@
    expression obj;
    identifier bus;
    @@
    -&obj->bus.qbus
    +BUS(&obj->bus)
---
 hw/s390x/event-facility.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/s390x/event-facility.c +0 -1
index ee5b83448b..e574223a22 100644
@@ -466,12 +466,12 @@ static void init_event_facility(Object *obj)
     new = object_new(TYPE_SCLP_QUIESCE);
     object_property_add_child(obj, TYPE_SCLP_QUIESCE, new, NULL);
     object_unref(new);
-    qdev_set_parent_bus(DEVICE(new), &event_facility->sbus.qbus);

hw/s390x/event-facility.c static void init_event_facility(Object *obj) · line 477

Quoted 10 lines
hw/s390x/event-facility.c +2 -1
+    qdev_set_parent_bus(DEVICE(new), BUS(&event_facility->sbus));
 
     new = object_new(TYPE_SCLP_CPU_HOTPLUG);
     object_property_add_child(obj, TYPE_SCLP_CPU_HOTPLUG, new, NULL);
     object_unref(new);
-    qdev_set_parent_bus(DEVICE(new), &event_facility->sbus.qbus);
+    qdev_set_parent_bus(DEVICE(new), BUS(&event_facility->sbus));
     /* the facility will automatically realize the devices via the bus */
 }
 

Applied to my trivial-patches branch.

Thanks,
Laurent

#13 lore raw

PATCH v2 5/10 hw/sd: Use the QOM BUS() macro to access BusState.qbus

In reply to Philippe Mathieu-Daudé

Rather than looking inside the definition of a BusState with "s->bus.qbus", use the QOM prefered style: "BUS(&s->bus)".

This patch was generated using the following Coccinelle script:

    // Use BUS() macros to access BusState.qbus
    @use_bus_macro_to_access_qbus@
    expression obj;
    identifier bus;
    @@
    -&obj->bus.qbus
    +BUS(&obj->bus)
---
 hw/sd/milkymist-memcard.c | 2 +-
 hw/sd/ssi-sd.c            | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
hw/sd/milkymist-memcard.c +1 -1
index df42aa1c54..dd1ba649d9 100644
@@ -277,7 +277,7 @@ static void milkymist_memcard_realize(DeviceState *dev, Error **errp)
     /* FIXME use a qdev drive property instead of drive_get_next() */
     dinfo = drive_get_next(IF_SD);
     blk = dinfo ? blk_by_legacy_dinfo(dinfo) : NULL;
-    carddev = qdev_create(&s->sdbus.qbus, TYPE_SD_CARD);
+    carddev = qdev_create(BUS(&s->sdbus), TYPE_SD_CARD);
     qdev_prop_set_drive(carddev, "drive", blk, &err);
     object_property_set_bool(OBJECT(carddev), true, "realized", &err);
     if (err) {
hw/sd/ssi-sd.c +1 -1
index 623d0333e8..25e1009277 100644
@@ -249,7 +249,7 @@ static void ssi_sd_realize(SSISlave *d, Error **errp)
     /* Create and plug in the sd card */
     /* FIXME use a qdev drive property instead of drive_get_next() */
     dinfo = drive_get_next(IF_SD);
-    carddev = qdev_create(&s->sdbus.qbus, TYPE_SD_CARD);
+    carddev = qdev_create(BUS(&s->sdbus), TYPE_SD_CARD);
     if (dinfo) {
         qdev_prop_set_drive(carddev, "drive", blk_by_legacy_dinfo(dinfo), &err);
     }
Signature · 1 line
2.20.1
Reviewed-by on v2 5/10
#14 lore raw

Re: [Qemu-devel] [PATCH v2 05/10] hw/sd: Use the QOM BUS() macro to access BusState.qbus

Quoted 14 lines · Philippe Mathieu-Daudé

Rather than looking inside the definition of a BusState with "s->bus.qbus", use the QOM prefered style: "BUS(&s->bus)".

This patch was generated using the following Coccinelle script:

    // Use BUS() macros to access BusState.qbus
    @use_bus_macro_to_access_qbus@
    expression obj;
    identifier bus;
    @@
    -&obj->bus.qbus
    +BUS(&obj->bus)
Quoted 6 lines
---
 hw/sd/milkymist-memcard.c | 2 +-
 hw/sd/ssi-sd.c            | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

thanks
-- PMM

#15 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH v2 05/10] hw/sd: Use the QOM BUS() macro to access BusState.qbus

In reply to Philippe Mathieu-Daudé

Le 28/05/2019 à 18:40, Philippe Mathieu-Daudé a écrit :

Quoted 39 lines

Rather than looking inside the definition of a BusState with "s->bus.qbus", use the QOM prefered style: "BUS(&s->bus)".

This patch was generated using the following Coccinelle script:

    // Use BUS() macros to access BusState.qbus
    @use_bus_macro_to_access_qbus@
    expression obj;
    identifier bus;
    @@
    -&obj->bus.qbus
    +BUS(&obj->bus)
---
 hw/sd/milkymist-memcard.c | 2 +-
 hw/sd/ssi-sd.c            | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
hw/sd/milkymist-memcard.c +1 -1
index df42aa1c54..dd1ba649d9 100644
@@ -277,7 +277,7 @@ static void milkymist_memcard_realize(DeviceState *dev, Error **errp)
     /* FIXME use a qdev drive property instead of drive_get_next() */
     dinfo = drive_get_next(IF_SD);
     blk = dinfo ? blk_by_legacy_dinfo(dinfo) : NULL;
-    carddev = qdev_create(&s->sdbus.qbus, TYPE_SD_CARD);
+    carddev = qdev_create(BUS(&s->sdbus), TYPE_SD_CARD);
     qdev_prop_set_drive(carddev, "drive", blk, &err);
     object_property_set_bool(OBJECT(carddev), true, "realized", &err);
     if (err) {
hw/sd/ssi-sd.c +0 -0
index 623d0333e8..25e1009277 100644

hw/sd/ssi-sd.c static void ssi_sd_realize(SSISlave *d, Error **errp) · line 255

Quoted 8 lines
hw/sd/ssi-sd.c +1 -1
@@ -249,7 +249,7 @@ static void ssi_sd_realize(SSISlave *d, Error **errp)
     /* Create and plug in the sd card */
     /* FIXME use a qdev drive property instead of drive_get_next() */
     dinfo = drive_get_next(IF_SD);
-    carddev = qdev_create(&s->sdbus.qbus, TYPE_SD_CARD);
+    carddev = qdev_create(BUS(&s->sdbus), TYPE_SD_CARD);
     if (dinfo) {
         qdev_prop_set_drive(carddev, "drive", blk_by_legacy_dinfo(dinfo), &err);
     }

Applied to my trivial-patches branch.

Thanks,
Laurent

#16 lore raw

PATCH v2 6/10 hw/audio/ac97: Use the QOM DEVICE() macro to access DeviceState.qdev

In reply to Philippe Mathieu-Daudé

Rather than looking inside the definition of a DeviceState with "s->qdev", use the QOM prefered style: "DEVICE(s)".

This patch was generated using the following Coccinelle script (with a bit of manual fix-up, removing an extra space to please checkpatch.pl):

    // Use DEVICE() macros to access DeviceState.qdev
    @use_device_macro_to_access_qdev@
    expression obj;
    identifier dev;
    @@
    -&obj->dev.qdev
    +DEVICE(obj)
---
 hw/audio/ac97.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/audio/ac97.c +1 -1
index 2265622d44..a4e8d99e77 100644
@@ -1388,7 +1388,7 @@ static void ac97_realize(PCIDevice *dev, Error **errp)
     pci_register_bar (&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nam);
     pci_register_bar (&s->dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nabm);
     AUD_register_card ("ac97", &s->card);
-    ac97_on_reset (&s->dev.qdev);
+    ac97_on_reset(DEVICE(s));
 }
 
 static void ac97_exit(PCIDevice *dev)
Signature · 1 line
2.20.1
Reviewed-by on v2 6/10
#17 lore raw

Re: [Qemu-devel] [PATCH v2 06/10] hw/audio/ac97: Use the QOM DEVICE() macro to access DeviceState.qdev

Quoted 27 lines · Philippe Mathieu-Daudé

Rather than looking inside the definition of a DeviceState with "s->qdev", use the QOM prefered style: "DEVICE(s)".

This patch was generated using the following Coccinelle script (with a bit of manual fix-up, removing an extra space to please checkpatch.pl):

    // Use DEVICE() macros to access DeviceState.qdev
    @use_device_macro_to_access_qdev@
    expression obj;
    identifier dev;
    @@
    -&obj->dev.qdev
    +DEVICE(obj)
---
 hw/audio/ac97.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/audio/ac97.c +0 -0
index 2265622d44..a4e8d99e77 100644

hw/audio/ac97.c static void ac97_realize(PCIDevice *dev, Error **errp) · line 1392

Quoted 6 lines
hw/audio/ac97.c +1 -1
@@ -1388,7 +1388,7 @@ static void ac97_realize(PCIDevice *dev, Error **errp)
     pci_register_bar (&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nam);
     pci_register_bar (&s->dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nabm);
     AUD_register_card ("ac97", &s->card);
-    ac97_on_reset (&s->dev.qdev);
+    ac97_on_reset(DEVICE(s));
 }

As an aside, this function has a lot of uses of "&s->dev" to get the PCIDevice* given an AC97LinkState*. This isn't necessary as the function has been passed the PCIDevice* as its argument, so all the uses of "&s->dev" here could just be written as "dev".

thanks
-- PMM

#18 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH v2 06/10] hw/audio/ac97: Use the QOM DEVICE() macro to access DeviceState.qdev

In reply to Philippe Mathieu-Daudé

Le 28/05/2019 à 18:40, Philippe Mathieu-Daudé a écrit :

Quoted 27 lines

Rather than looking inside the definition of a DeviceState with "s->qdev", use the QOM prefered style: "DEVICE(s)".

This patch was generated using the following Coccinelle script (with a bit of manual fix-up, removing an extra space to please checkpatch.pl):

    // Use DEVICE() macros to access DeviceState.qdev
    @use_device_macro_to_access_qdev@
    expression obj;
    identifier dev;
    @@
    -&obj->dev.qdev
    +DEVICE(obj)
---
 hw/audio/ac97.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/audio/ac97.c +0 -0
index 2265622d44..a4e8d99e77 100644

hw/audio/ac97.c static void ac97_realize(PCIDevice *dev, Error **errp) · line 1394

Quoted 8 lines
hw/audio/ac97.c +1 -1
@@ -1388,7 +1388,7 @@ static void ac97_realize(PCIDevice *dev, Error **errp)
     pci_register_bar (&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nam);
     pci_register_bar (&s->dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nabm);
     AUD_register_card ("ac97", &s->card);
-    ac97_on_reset (&s->dev.qdev);
+    ac97_on_reset(DEVICE(s));
 }
 
 static void ac97_exit(PCIDevice *dev)

Applied to my trivial-patches branch.

Thanks,
Laurent

#19 lore raw

PATCH v2 7/10 hw/isa: Use the QOM DEVICE() macro to access DeviceState.qdev

In reply to Philippe Mathieu-Daudé

Rather than looking inside the definition of a DeviceState with "s->qdev", use the QOM prefered style: "DEVICE(s)".

This patch was generated using the following Coccinelle script:

    // Use DEVICE() macros to access DeviceState.qdev
    @use_device_macro_to_access_qdev@
    expression obj;
    identifier dev;
    @@
    -&obj->dev.qdev
    +DEVICE(obj)
---
 hw/isa/lpc_ich9.c | 2 +-
 hw/isa/vt82c686.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
hw/isa/lpc_ich9.c +1 -1
index 031ee9cd93..35d17246e9 100644
@@ -412,7 +412,7 @@ void ich9_lpc_pm_init(PCIDevice *lpc_pci, bool smm_enabled)
                                  true);
     }
 
-    ich9_lpc_reset(&lpc->d.qdev);
+    ich9_lpc_reset(DEVICE(lpc));
 }
 
 /* APM */
hw/isa/vt82c686.c +1 -1
index 85d0532dd5..d46754f61c 100644
@@ -369,7 +369,7 @@ static void vt82c686b_pm_realize(PCIDevice *dev, Error **errp)
     pci_conf[0x90] = s->smb_io_base | 1;
     pci_conf[0x91] = s->smb_io_base >> 8;
     pci_conf[0xd2] = 0x90;
-    pm_smbus_init(&s->dev.qdev, &s->smb, false);
+    pm_smbus_init(DEVICE(s), &s->smb, false);
     memory_region_add_subregion(get_system_io(), s->smb_io_base, &s->smb.io);
 
     apm_init(dev, &s->apm, NULL, s);
Signature · 1 line
2.20.1
Reviewed-by on v2 7/10
#20 lore raw

Re: [Qemu-devel] [PATCH v2 07/10] hw/isa: Use the QOM DEVICE() macro to access DeviceState.qdev

Quoted 38 lines · Philippe Mathieu-Daudé

Rather than looking inside the definition of a DeviceState with "s->qdev", use the QOM prefered style: "DEVICE(s)".

This patch was generated using the following Coccinelle script:

     // Use DEVICE() macros to access DeviceState.qdev
     @use_device_macro_to_access_qdev@
     expression obj;
     identifier dev;
     @@
     -&obj->dev.qdev
     +DEVICE(obj)
---
  hw/isa/lpc_ich9.c | 2 +-
  hw/isa/vt82c686.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
hw/isa/lpc_ich9.c +1 -1
index 031ee9cd93..35d17246e9 100644
@@ -412,7 +412,7 @@ void ich9_lpc_pm_init(PCIDevice *lpc_pci, bool smm_enabled)
                                   true);
      }
 
-    ich9_lpc_reset(&lpc->d.qdev);
+    ich9_lpc_reset(DEVICE(lpc));
  }
 
  /* APM */
hw/isa/vt82c686.c +0 -0
index 85d0532dd5..d46754f61c 100644

hw/isa/vt82c686.c static void vt82c686b_pm_realize(PCIDevice *dev, Error **errp) · line 375

Quoted 8 lines
hw/isa/vt82c686.c +1 -1
@@ -369,7 +369,7 @@ static void vt82c686b_pm_realize(PCIDevice *dev, Error **errp)
      pci_conf[0x90] = s->smb_io_base | 1;
      pci_conf[0x91] = s->smb_io_base >> 8;
      pci_conf[0xd2] = 0x90;
-    pm_smbus_init(&s->dev.qdev, &s->smb, false);
+    pm_smbus_init(DEVICE(s), &s->smb, false);
      memory_region_add_subregion(get_system_io(), s->smb_io_base, &s->smb.io);
 
      apm_init(dev, &s->apm, NULL, s);

Thanks,
Marcel

#21 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH v2 07/10] hw/isa: Use the QOM DEVICE() macro to access DeviceState.qdev

In reply to Philippe Mathieu-Daudé

Le 28/05/2019 à 18:40, Philippe Mathieu-Daudé a écrit :

Quoted 39 lines

Rather than looking inside the definition of a DeviceState with "s->qdev", use the QOM prefered style: "DEVICE(s)".

This patch was generated using the following Coccinelle script:

    // Use DEVICE() macros to access DeviceState.qdev
    @use_device_macro_to_access_qdev@
    expression obj;
    identifier dev;
    @@
    -&obj->dev.qdev
    +DEVICE(obj)
---
 hw/isa/lpc_ich9.c | 2 +-
 hw/isa/vt82c686.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
hw/isa/lpc_ich9.c +1 -1
index 031ee9cd93..35d17246e9 100644
@@ -412,7 +412,7 @@ void ich9_lpc_pm_init(PCIDevice *lpc_pci, bool smm_enabled)
                                  true);
     }
 
-    ich9_lpc_reset(&lpc->d.qdev);
+    ich9_lpc_reset(DEVICE(lpc));
 }
 
 /* APM */
hw/isa/vt82c686.c +0 -0
index 85d0532dd5..d46754f61c 100644

hw/isa/vt82c686.c static void vt82c686b_pm_realize(PCIDevice *dev, Error **errp) · line 375

Quoted 8 lines
hw/isa/vt82c686.c +1 -1
@@ -369,7 +369,7 @@ static void vt82c686b_pm_realize(PCIDevice *dev, Error **errp)
     pci_conf[0x90] = s->smb_io_base | 1;
     pci_conf[0x91] = s->smb_io_base >> 8;
     pci_conf[0xd2] = 0x90;
-    pm_smbus_init(&s->dev.qdev, &s->smb, false);
+    pm_smbus_init(DEVICE(s), &s->smb, false);
     memory_region_add_subregion(get_system_io(), s->smb_io_base, &s->smb.io);
 
     apm_init(dev, &s->apm, NULL, s);

Applied to my trivial-patches branch.

Thanks,
Laurent

#22 lore raw

PATCH v2 8/10 hw/usb-storage: Use the QOM DEVICE() macro to access DeviceState.qdev

In reply to Philippe Mathieu-Daudé

Rather than looking inside the definition of a DeviceState with "s->qdev", use the QOM prefered style: "DEVICE(s)".

This patch was generated using the following Coccinelle script:

    // Use DEVICE() macros to access DeviceState.qdev
    @use_device_macro_to_access_qdev@
    expression obj;
    identifier dev;
    @@
    -&obj->dev.qdev
    +DEVICE(obj)
---
 hw/usb/dev-storage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/usb/dev-storage.c +1 -1
index cd5551d94f..0e4e93ef16 100644
@@ -616,7 +616,7 @@ static void usb_msd_storage_realize(USBDevice *dev, Error **errp)
      * The hack is probably a bad idea.
      */
     blk_ref(blk);
-    blk_detach_dev(blk, &s->dev.qdev);
+    blk_detach_dev(blk, DEVICE(s));
     s->conf.blk = NULL;
 
     usb_desc_create_serial(dev);
Signature · 1 line
2.20.1
Reviewed-by on v2 8/10
#23 lore raw

Re: [Qemu-devel] [PATCH v2 08/10] hw/usb-storage: Use the QOM DEVICE() macro to access DeviceState.qdev

Quoted 13 lines · Philippe Mathieu-Daudé

Rather than looking inside the definition of a DeviceState with "s->qdev", use the QOM prefered style: "DEVICE(s)".

This patch was generated using the following Coccinelle script:

    // Use DEVICE() macros to access DeviceState.qdev
    @use_device_macro_to_access_qdev@
    expression obj;
    identifier dev;
    @@
    -&obj->dev.qdev
    +DEVICE(obj)
Quoted 2 lines
#24 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH v2 08/10] hw/usb-storage: Use the QOM DEVICE() macro to access DeviceState.qdev

In reply to Philippe Mathieu-Daudé

Le 28/05/2019 à 18:40, Philippe Mathieu-Daudé a écrit :

Quoted 25 lines

Rather than looking inside the definition of a DeviceState with "s->qdev", use the QOM prefered style: "DEVICE(s)".

This patch was generated using the following Coccinelle script:

    // Use DEVICE() macros to access DeviceState.qdev
    @use_device_macro_to_access_qdev@
    expression obj;
    identifier dev;
    @@
    -&obj->dev.qdev
    +DEVICE(obj)
---
 hw/usb/dev-storage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/usb/dev-storage.c +0 -0
index cd5551d94f..0e4e93ef16 100644

hw/usb/dev-storage.c static void usb_msd_storage_realize(USBDevice *dev, Error **errp) · line 622

Quoted 8 lines
hw/usb/dev-storage.c +1 -1
@@ -616,7 +616,7 @@ static void usb_msd_storage_realize(USBDevice *dev, Error **errp)
      * The hack is probably a bad idea.
      */
     blk_ref(blk);
-    blk_detach_dev(blk, &s->dev.qdev);
+    blk_detach_dev(blk, DEVICE(s));
     s->conf.blk = NULL;
 
     usb_desc_create_serial(dev);

Applied to my trivial-patches branch.

Thanks,
Laurent

#25 lore raw

PATCH v2 9/10 hw/vfio/pci: Use the QOM DEVICE() macro to access DeviceState.qdev

In reply to Philippe Mathieu-Daudé

Rather than looking inside the definition of a DeviceState with "s->qdev", use the QOM prefered style: "DEVICE(s)".

This patch was generated using the following Coccinelle script:

    // Use DEVICE() macros to access DeviceState.qdev
    @use_device_macro_to_access_qdev@
    expression obj;
    identifier dev;
    @@
    -&obj->dev.qdev
    +DEVICE(obj)
---
 hw/vfio/pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/vfio/pci.c +2 -2
index 8e555db12e..2a4091d216 100644
@@ -2717,7 +2717,7 @@ static void vfio_req_notifier_handler(void *opaque)
         return;
     }
 
-    qdev_unplug(&vdev->pdev.qdev, &err);
+    qdev_unplug(DEVICE(vdev), &err);
     if (err) {
         warn_reportf_err(err, VFIO_MSG_PREFIX, vdev->vbasedev.name);
     }
@@ -2839,7 +2839,7 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
     vdev->vbasedev.name = g_path_get_basename(vdev->vbasedev.sysfsdev);
     vdev->vbasedev.ops = &vfio_pci_ops;
     vdev->vbasedev.type = VFIO_DEVICE_TYPE_PCI;
-    vdev->vbasedev.dev = &vdev->pdev.qdev;
+    vdev->vbasedev.dev = DEVICE(vdev);
 
     tmp = g_strdup_printf("%s/iommu_group", vdev->vbasedev.sysfsdev);
     len = readlink(tmp, group_path, sizeof(group_path));
Signature · 1 line
2.20.1
Acked-by on v2 9/10
#26 lore raw

Re: [Qemu-devel] [PATCH v2 09/10] hw/vfio/pci: Use the QOM DEVICE() macro to access DeviceState.qdev

Quoted 13 lines · On Tue, 28 May 2019 18:40:19 +0200 Philippe Mathieu-Daudé <[email protected]>…

Rather than looking inside the definition of a DeviceState with "s->qdev", use the QOM prefered style: "DEVICE(s)".

This patch was generated using the following Coccinelle script:

    // Use DEVICE() macros to access DeviceState.qdev
    @use_device_macro_to_access_qdev@
    expression obj;
    identifier dev;
    @@
    -&obj->dev.qdev
    +DEVICE(obj)
Quoted 5 lines
---
 hw/vfio/pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 22 lines
hw/vfio/pci.c +2 -2
index 8e555db12e..2a4091d216 100644
@@ -2717,7 +2717,7 @@ static void vfio_req_notifier_handler(void *opaque)
         return;
     }
 
-    qdev_unplug(&vdev->pdev.qdev, &err);
+    qdev_unplug(DEVICE(vdev), &err);
     if (err) {
         warn_reportf_err(err, VFIO_MSG_PREFIX, vdev->vbasedev.name);
     }
@@ -2839,7 +2839,7 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
     vdev->vbasedev.name = g_path_get_basename(vdev->vbasedev.sysfsdev);
     vdev->vbasedev.ops = &vfio_pci_ops;
     vdev->vbasedev.type = VFIO_DEVICE_TYPE_PCI;
-    vdev->vbasedev.dev = &vdev->pdev.qdev;
+    vdev->vbasedev.dev = DEVICE(vdev);
 
     tmp = g_strdup_printf("%s/iommu_group", vdev->vbasedev.sysfsdev);
     len = readlink(tmp, group_path, sizeof(group_path));
#27 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH v2 09/10] hw/vfio/pci: Use the QOM DEVICE() macro to access DeviceState.qdev

In reply to Philippe Mathieu-Daudé

Le 28/05/2019 à 18:40, Philippe Mathieu-Daudé a écrit :

Quoted 34 lines

Rather than looking inside the definition of a DeviceState with "s->qdev", use the QOM prefered style: "DEVICE(s)".

This patch was generated using the following Coccinelle script:

    // Use DEVICE() macros to access DeviceState.qdev
    @use_device_macro_to_access_qdev@
    expression obj;
    identifier dev;
    @@
    -&obj->dev.qdev
    +DEVICE(obj)
---
 hw/vfio/pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/vfio/pci.c +1 -1
index 8e555db12e..2a4091d216 100644
@@ -2717,7 +2717,7 @@ static void vfio_req_notifier_handler(void *opaque)
         return;
     }
 
-    qdev_unplug(&vdev->pdev.qdev, &err);
+    qdev_unplug(DEVICE(vdev), &err);
     if (err) {
         warn_reportf_err(err, VFIO_MSG_PREFIX, vdev->vbasedev.name);
     }

hw/vfio/pci.c static void vfio_realize(PCIDevice *pdev, Error **errp) · line 2845

Quoted 8 lines
hw/vfio/pci.c +1 -1
@@ -2839,7 +2839,7 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
     vdev->vbasedev.name = g_path_get_basename(vdev->vbasedev.sysfsdev);
     vdev->vbasedev.ops = &vfio_pci_ops;
     vdev->vbasedev.type = VFIO_DEVICE_TYPE_PCI;
-    vdev->vbasedev.dev = &vdev->pdev.qdev;
+    vdev->vbasedev.dev = DEVICE(vdev);
 
     tmp = g_strdup_printf("%s/iommu_group", vdev->vbasedev.sysfsdev);
     len = readlink(tmp, group_path, sizeof(group_path));

Applied to my trivial-patches branch.

Thanks,
Laurent

#28 lore raw

PATCH v2 10/10 hw/watchdog/wdt_i6300esb: Use DEVICE() macro to access DeviceState.qdev

In reply to Philippe Mathieu-Daudé

Rather than looking inside the definition of a DeviceState with "s->qdev", use the QOM prefered style: "DEVICE(s)".

This patch was generated using the following Coccinelle script:

    // Use DEVICE() macros to access DeviceState.qdev
    @use_device_macro_to_access_qdev@
    expression obj;
    identifier dev;
    @@
    -&obj->dev.qdev
    +DEVICE(obj)
---
 hw/watchdog/wdt_i6300esb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/watchdog/wdt_i6300esb.c +1 -1
index 1c6eddf86a..f2d1e86526 100644
@@ -200,7 +200,7 @@ static void i6300esb_timer_expired(void *vp)
         if (d->reboot_enabled) {
             d->previous_reboot_flag = 1;
             watchdog_perform_action(); /* This reboots, exits, etc */
-            i6300esb_reset(&d->dev.qdev);
+            i6300esb_reset(DEVICE(d));
         }
 
         /* In "free running mode" we start stage 1 again. */
Signature · 1 line
2.20.1
Reviewed-by on v2 10/10
#29 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH v2 10/10] hw/watchdog/wdt_i6300esb: Use DEVICE() macro to access DeviceState.qdev

Le 28/05/2019 à 18:40, Philippe Mathieu-Daudé a écrit :

Quoted 13 lines

Rather than looking inside the definition of a DeviceState with "s->qdev", use the QOM prefered style: "DEVICE(s)".

This patch was generated using the following Coccinelle script:

    // Use DEVICE() macros to access DeviceState.qdev
    @use_device_macro_to_access_qdev@
    expression obj;
    identifier dev;
    @@
    -&obj->dev.qdev
    +DEVICE(obj)
Quoted 5 lines
---
 hw/watchdog/wdt_i6300esb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#30 lore raw

Re: [Qemu-devel] [Qemu-trivial] [PATCH v2 10/10] hw/watchdog/wdt_i6300esb: Use DEVICE() macro to access DeviceState.qdev

In reply to Philippe Mathieu-Daudé

Le 28/05/2019 à 18:40, Philippe Mathieu-Daudé a écrit :

Quoted 25 lines

Rather than looking inside the definition of a DeviceState with "s->qdev", use the QOM prefered style: "DEVICE(s)".

This patch was generated using the following Coccinelle script:

    // Use DEVICE() macros to access DeviceState.qdev
    @use_device_macro_to_access_qdev@
    expression obj;
    identifier dev;
    @@
    -&obj->dev.qdev
    +DEVICE(obj)
---
 hw/watchdog/wdt_i6300esb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/watchdog/wdt_i6300esb.c +0 -0
index 1c6eddf86a..f2d1e86526 100644

hw/watchdog/wdt_i6300esb.c static void i6300esb_timer_expired(void *vp) · line 206

Quoted 8 lines
hw/watchdog/wdt_i6300esb.c +1 -1
@@ -200,7 +200,7 @@ static void i6300esb_timer_expired(void *vp)
         if (d->reboot_enabled) {
             d->previous_reboot_flag = 1;
             watchdog_perform_action(); /* This reboots, exits, etc */
-            i6300esb_reset(&d->dev.qdev);
+            i6300esb_reset(DEVICE(d));
         }
 
         /* In "free running mode" we start stage 1 again. */

Applied to my trivial-patches branch.

Thanks,
Laurent