Skip to contentSkip to conversation

qom: Fix broken OBJECT_CHECK usage

PATCH In review Eduardo Habkost 6 participants 21 messages Aug 5, 2021 – Aug 9, 2021

lore
Share & tools
lore
#0 lore raw

cover qom: Fix broken OBJECT_CHECK usage

This series removes some broken OBJECT_CHECK macros and fix cases where OBJECT_CHECK is being used directly in the code.

Eduardo Habkost (6):
acpi: Delete broken ACPI_GED_X86 macro
sbsa_gwdt: Delete broken SBSA_*CLASS macros
s390-sclp-events-bus: Set instance_size
s390-sclp-events-bus: Use OBJECT_DECLARE_SIMPLE_TYPE
s390x: event-facility: Use SCLP_EVENT_BUS macro Use PCI_HOST_BRIDGE macro

 include/hw/acpi/generic_event_device.h | 2 --
 include/hw/watchdog/sbsa_gwdt.h        | 4 ----
 hw/i386/acpi-build.c                   | 8 ++------
 hw/pci-host/i440fx.c                   | 4 +---
 hw/s390x/event-facility.c              | 4 +++-
 5 files changed, 6 insertions(+), 16 deletions(-)
Signature · 1 line
2.31.1
#1 lore raw

PATCH 1/6 acpi: Delete broken ACPI_GED_X86 macro

The macro never worked and never will, because the AcpiGedX86State type never existed.

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Igor Mammedov <[email protected]>
Cc: [email protected]

---
 include/hw/acpi/generic_event_device.h | 2 --
 1 file changed, 2 deletions(-)
include/hw/acpi/generic_event_device.h +0 -2
index 6bed92e8fc5..d49217c445f 100644
@@ -70,8 +70,6 @@
 OBJECT_DECLARE_SIMPLE_TYPE(AcpiGedState, ACPI_GED)
 
 #define TYPE_ACPI_GED_X86 "acpi-ged-x86"
-#define ACPI_GED_X86(obj) \
-    OBJECT_CHECK(AcpiGedX86State, (obj), TYPE_ACPI_GED_X86)
 
 #define ACPI_GED_EVT_SEL_OFFSET    0x0
 #define ACPI_GED_EVT_SEL_LEN       0x4
Signature · 1 line
2.31.1
Reviewed-by on v1 1/6
#2 lore raw

Re: [PATCH for-6.2 1/6] acpi: Delete broken ACPI_GED_X86 macro

Quoted 4 lines · On Thu, 5 Aug 2021 15:34:26 -0400 Eduardo Habkost <[email protected]> wrote:

The macro never worked and never will, because the AcpiGedX86State type never existed.

Quoted 21 lines

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Igor Mammedov <[email protected]>
Cc: [email protected]

---
 include/hw/acpi/generic_event_device.h | 2 --
 1 file changed, 2 deletions(-)
include/hw/acpi/generic_event_device.h +0 -2
index 6bed92e8fc5..d49217c445f 100644
@@ -70,8 +70,6 @@
 OBJECT_DECLARE_SIMPLE_TYPE(AcpiGedState, ACPI_GED)
 
 #define TYPE_ACPI_GED_X86 "acpi-ged-x86"
-#define ACPI_GED_X86(obj) \
-    OBJECT_CHECK(AcpiGedX86State, (obj), TYPE_ACPI_GED_X86)
 
 #define ACPI_GED_EVT_SEL_OFFSET    0x0
 #define ACPI_GED_EVT_SEL_LEN       0x4
Reviewed-by on v1 1/6
#3 lore raw

Re: [PATCH for-6.2 1/6] acpi: Delete broken ACPI_GED_X86 macro

In reply to Eduardo Habkost

include/hw/acpi/generic_event_device.h line 74

Quoted 7 lines · Eduardo Habkost

The macro never worked and never will, because the AcpiGedX86State type never existed.

include/hw/acpi/generic_event_device.h +0 -2
-#define ACPI_GED_X86(obj) \
-    OBJECT_CHECK(AcpiGedX86State, (obj), TYPE_ACPI_GED_X86)

Oops. Leftover from an earlier patch revision where the struct did actually exist. Thanks for cleaning up.

take care,
Gerd

#4 lore raw

PATCH 2/6 sbsa_gwdt: Delete broken SBSA_*CLASS macros

In reply to Eduardo Habkost

Those macros never worked and never will, because the SBSA_GWDTClass type never existed.

---
Cc: [email protected]
Cc: Peter Maydell <[email protected]>
Cc: Shashi Mallela <[email protected]>

---
 include/hw/watchdog/sbsa_gwdt.h | 4 ----
 1 file changed, 4 deletions(-)
include/hw/watchdog/sbsa_gwdt.h +0 -4
index 70b137de301..dcb13bc29dc 100644
@@ -19,10 +19,6 @@
 #define TYPE_WDT_SBSA "sbsa_gwdt"
 #define SBSA_GWDT(obj) \
     OBJECT_CHECK(SBSA_GWDTState, (obj), TYPE_WDT_SBSA)
-#define SBSA_GWDT_CLASS(klass) \
-    OBJECT_CLASS_CHECK(SBSA_GWDTClass, (klass), TYPE_WDT_SBSA)
-#define SBSA_GWDT_GET_CLASS(obj) \
-    OBJECT_GET_CLASS(SBSA_GWDTClass, (obj), TYPE_WDT_SBSA)
 
 /* SBSA Generic Watchdog register definitions */
 /* refresh frame */
Signature · 1 line
2.31.1
#5 lore raw

PATCH 3/6 s390-sclp-events-bus: Set instance_size

In reply to Eduardo Habkost

We have a SCLPEventsBus struct defined, but the struct is not used at the TypeInfo definition. This works today but will break silently if anybody adds a new field to SCLPEventsBus.

Set instance_size properly to avoid problems in the future.

---
Cc: Cornelia Huck <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: Halil Pasic <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 hw/s390x/event-facility.c | 1 +
 1 file changed, 1 insertion(+)
hw/s390x/event-facility.c +1 -0
index ed92ce510d9..0a65e16cdd9 100644
@@ -332,6 +332,7 @@ static void write_event_mask(SCLPEventFacility *ef, SCCB *sccb)
 static const TypeInfo sclp_events_bus_info = {
     .name = TYPE_SCLP_EVENTS_BUS,
     .parent = TYPE_BUS,
+    .instance_size = sizeof(SCLPEventsBus),
 };
 
 static void command_handler(SCLPEventFacility *ef, SCCB *sccb, uint64_t code)
Signature · 1 line
2.31.1
Reviewed-by on v1 3/6
#6 lore raw

Re: [PATCH for-6.2 3/6] s390-sclp-events-bus: Set instance_size

Quoted 26 lines · Eduardo Habkost

We have a SCLPEventsBus struct defined, but the struct is not used at the TypeInfo definition. This works today but will break silently if anybody adds a new field to SCLPEventsBus.

Set instance_size properly to avoid problems in the future.

---
Cc: Cornelia Huck <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: Halil Pasic <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
  hw/s390x/event-facility.c | 1 +
  1 file changed, 1 insertion(+)
hw/s390x/event-facility.c +0 -0
index ed92ce510d9..0a65e16cdd9 100644

hw/s390x/event-facility.c static void write_event_mask(SCLPEventFacility *ef, SCCB *sccb) · line 338

Quoted 7 lines
hw/s390x/event-facility.c +1 -0
@@ -332,6 +332,7 @@ static void write_event_mask(SCLPEventFacility *ef, SCCB *sccb)
  static const TypeInfo sclp_events_bus_info = {
      .name = TYPE_SCLP_EVENTS_BUS,
      .parent = TYPE_BUS,
+    .instance_size = sizeof(SCLPEventsBus),
  };
 
  static void command_handler(SCLPEventFacility *ef, SCCB *sccb, uint64_t code)
Reviewed-by on v1 3/6
#7 lore raw

Re: [PATCH for-6.2 3/6] s390-sclp-events-bus: Set instance_size

In reply to Eduardo Habkost
Quoted 26 lines · Eduardo Habkost

We have a SCLPEventsBus struct defined, but the struct is not used at the TypeInfo definition. This works today but will break silently if anybody adds a new field to SCLPEventsBus.

Set instance_size properly to avoid problems in the future.

---
Cc: Cornelia Huck <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: Halil Pasic <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
  hw/s390x/event-facility.c | 1 +
  1 file changed, 1 insertion(+)
hw/s390x/event-facility.c +0 -0
index ed92ce510d9..0a65e16cdd9 100644

hw/s390x/event-facility.c static void write_event_mask(SCLPEventFacility *ef, SCCB *sccb) · line 338

Quoted 7 lines
hw/s390x/event-facility.c +1 -0
@@ -332,6 +332,7 @@ static void write_event_mask(SCLPEventFacility *ef, SCCB *sccb)
  static const TypeInfo sclp_events_bus_info = {
      .name = TYPE_SCLP_EVENTS_BUS,
      .parent = TYPE_BUS,
+    .instance_size = sizeof(SCLPEventsBus),
  };
 
  static void command_handler(SCLPEventFacility *ef, SCCB *sccb, uint64_t code)
Signature · 3 lines
Thanks,

David / dhildenb
Reviewed-by on v1 3/6
#8 lore raw

Re: [PATCH for-6.2 3/6] s390-sclp-events-bus: Set instance_size

In reply to Eduardo Habkost
Quoted 16 lines · Eduardo Habkost

We have a SCLPEventsBus struct defined, but the struct is not used at the TypeInfo definition. This works today but will break silently if anybody adds a new field to SCLPEventsBus.

Set instance_size properly to avoid problems in the future.

---
Cc: Cornelia Huck <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: Halil Pasic <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: [email protected]
Cc: [email protected]

Quoted 3 lines
---
 hw/s390x/event-facility.c | 1 +
 1 file changed, 1 insertion(+)

(I assume that you'll queue the whole series yourself? Or should we pick the s390x parts separately?)

#9 lore raw

PATCH 4/6 s390-sclp-events-bus: Use OBJECT_DECLARE_SIMPLE_TYPE

In reply to Eduardo Habkost

We have a SCLPEventsBus struct type defined, but no QOM type checkers are declared for the type.

Use OBJECT_DECLARE_SIMPLE_TYPE to declare the struct type and have a SCLP_EVENT_BUS typecast wrapper defined.

---
Cc: Richard Henderson <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Cornelia Huck <[email protected]>
Cc: Halil Pasic <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 hw/s390x/event-facility.c | 1 +
 1 file changed, 1 insertion(+)
hw/s390x/event-facility.c +1 -0
index 0a65e16cdd9..9f7883d6e20 100644
@@ -328,6 +328,7 @@ static void write_event_mask(SCLPEventFacility *ef, SCCB *sccb)
 /* qemu object creation and initialization functions */
 
 #define TYPE_SCLP_EVENTS_BUS "s390-sclp-events-bus"
+OBJECT_DECLARE_SIMPLE_TYPE(SCLPEventsBus, SCLP_EVENT_BUS)
 
 static const TypeInfo sclp_events_bus_info = {
     .name = TYPE_SCLP_EVENTS_BUS,
Signature · 1 line
2.31.1
#10 lore raw

Re: [PATCH for-6.2 4/6] s390-sclp-events-bus: Use OBJECT_DECLARE_SIMPLE_TYPE

Quoted 25 lines · Eduardo Habkost

We have a SCLPEventsBus struct type defined, but no QOM type checkers are declared for the type.

Use OBJECT_DECLARE_SIMPLE_TYPE to declare the struct type and have a SCLP_EVENT_BUS typecast wrapper defined.

---
Cc: Richard Henderson <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Cornelia Huck <[email protected]>
Cc: Halil Pasic <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 hw/s390x/event-facility.c | 1 +
 1 file changed, 1 insertion(+)
hw/s390x/event-facility.c +0 -0
index 0a65e16cdd9..9f7883d6e20 100644

hw/s390x/event-facility.c static void write_event_mask(SCLPEventFacility *ef, SCCB *sccb) · line 331

Quoted 4 lines
hw/s390x/event-facility.c +1 -0
@@ -328,6 +328,7 @@ static void write_event_mask(SCLPEventFacility *ef, SCCB *sccb)
 /* qemu object creation and initialization functions */
 
 #define TYPE_SCLP_EVENTS_BUS "s390-sclp-events-bus"
+OBJECT_DECLARE_SIMPLE_TYPE(SCLPEventsBus, SCLP_EVENT_BUS)

Oops, a typo (should be SCLP_EVENTS_BUS instead). I will submit v2 later as a standalone patch.

Signature · 1 line
Eduardo
#11 lore raw

PATCH v2 1/1 s390-sclp-events-bus: Use OBJECT_DECLARE_SIMPLE_TYPE

In reply to Eduardo Habkost

We have a SCLPEventsBus struct type defined, but no QOM type checkers are declared for the type.

Use OBJECT_DECLARE_SIMPLE_TYPE to declare the struct type and have a SCLP_EVENT_BUS typecast wrapper defined.

---
Changes v1 -> v2:
* v1 was previously submitted as part of series:
[PATCH for-6.2 0/6] qom: Fix broken OBJECT_CHECK usage
at https://lore.kernel.org/qemu-devel/[email protected]
* Fix typo (s/SCLP_EVENT_BUS/SCLP_EVENTS_BUS/)

Cc Richard Henderson <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Cornelia Huck <[email protected]>
Cc Halil Pasic <[email protected]>
Cc Christian Borntraeger <[email protected]>
Cc Thomas Huth <[email protected]>
---
 hw/s390x/event-facility.c | 1 +
 1 file changed, 1 insertion(+)
hw/s390x/event-facility.c +1 -0
index ed92ce510d9..4bfd0b194b4 100644
@@ -328,6 +328,7 @@ static void write_event_mask(SCLPEventFacility *ef, SCCB *sccb)
 /* qemu object creation and initialization functions */
 
 #define TYPE_SCLP_EVENTS_BUS "s390-sclp-events-bus"
+OBJECT_DECLARE_SIMPLE_TYPE(SCLPEventsBus, SCLP_EVENTS_BUS)
 
 static const TypeInfo sclp_events_bus_info = {
     .name = TYPE_SCLP_EVENTS_BUS,
Signature · 1 line
2.31.1
Reviewed-by on v2 1/1
#12 lore raw

Re: [PATCH for-6.2 v2] s390-sclp-events-bus: Use OBJECT_DECLARE_SIMPLE_TYPE

Quoted 32 lines · Eduardo Habkost

We have a SCLPEventsBus struct type defined, but no QOM type checkers are declared for the type.

Use OBJECT_DECLARE_SIMPLE_TYPE to declare the struct type and have a SCLP_EVENT_BUS typecast wrapper defined.

---
Changes v1 -> v2:
* v1 was previously submitted as part of series:
[PATCH for-6.2 0/6] qom: Fix broken OBJECT_CHECK usage
at https://lore.kernel.org/qemu-devel/[email protected]
* Fix typo (s/SCLP_EVENT_BUS/SCLP_EVENTS_BUS/)

Cc Richard Henderson <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Cornelia Huck <[email protected]>
Cc Halil Pasic <[email protected]>
Cc Christian Borntraeger <[email protected]>
Cc Thomas Huth <[email protected]>
---
  hw/s390x/event-facility.c | 1 +
  1 file changed, 1 insertion(+)
hw/s390x/event-facility.c +0 -0
index ed92ce510d9..4bfd0b194b4 100644

hw/s390x/event-facility.c static void write_event_mask(SCLPEventFacility *ef, SCCB *sccb) · line 334

Quoted 7 lines
hw/s390x/event-facility.c +1 -0
@@ -328,6 +328,7 @@ static void write_event_mask(SCLPEventFacility *ef, SCCB *sccb)
  /* qemu object creation and initialization functions */
 
  #define TYPE_SCLP_EVENTS_BUS "s390-sclp-events-bus"
+OBJECT_DECLARE_SIMPLE_TYPE(SCLPEventsBus, SCLP_EVENTS_BUS)
 
  static const TypeInfo sclp_events_bus_info = {
      .name = TYPE_SCLP_EVENTS_BUS,
Reviewed-by on v2 1/1
#13 lore raw

Re: [PATCH for-6.2 v2] s390-sclp-events-bus: Use OBJECT_DECLARE_SIMPLE_TYPE

In reply to Eduardo Habkost
Quoted 32 lines · Eduardo Habkost

We have a SCLPEventsBus struct type defined, but no QOM type checkers are declared for the type.

Use OBJECT_DECLARE_SIMPLE_TYPE to declare the struct type and have a SCLP_EVENT_BUS typecast wrapper defined.

---
Changes v1 -> v2:
* v1 was previously submitted as part of series:
[PATCH for-6.2 0/6] qom: Fix broken OBJECT_CHECK usage
at https://lore.kernel.org/qemu-devel/[email protected]
* Fix typo (s/SCLP_EVENT_BUS/SCLP_EVENTS_BUS/)

Cc Richard Henderson <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Cornelia Huck <[email protected]>
Cc Halil Pasic <[email protected]>
Cc Christian Borntraeger <[email protected]>
Cc Thomas Huth <[email protected]>
---
  hw/s390x/event-facility.c | 1 +
  1 file changed, 1 insertion(+)
hw/s390x/event-facility.c +0 -0
index ed92ce510d9..4bfd0b194b4 100644

hw/s390x/event-facility.c static void write_event_mask(SCLPEventFacility *ef, SCCB *sccb) · line 334

Quoted 7 lines
hw/s390x/event-facility.c +1 -0
@@ -328,6 +328,7 @@ static void write_event_mask(SCLPEventFacility *ef, SCCB *sccb)
  /* qemu object creation and initialization functions */
 
  #define TYPE_SCLP_EVENTS_BUS "s390-sclp-events-bus"
+OBJECT_DECLARE_SIMPLE_TYPE(SCLPEventsBus, SCLP_EVENTS_BUS)
 
  static const TypeInfo sclp_events_bus_info = {
      .name = TYPE_SCLP_EVENTS_BUS,
Signature · 3 lines
Thanks,

David / dhildenb
Reviewed-by on v2 1/1
#14 lore raw

Re: [PATCH for-6.2 v2] s390-sclp-events-bus: Use OBJECT_DECLARE_SIMPLE_TYPE

In reply to Eduardo Habkost
Quoted 22 lines · Eduardo Habkost

We have a SCLPEventsBus struct type defined, but no QOM type checkers are declared for the type.

Use OBJECT_DECLARE_SIMPLE_TYPE to declare the struct type and have a SCLP_EVENT_BUS typecast wrapper defined.

---
Changes v1 -> v2:
* v1 was previously submitted as part of series:
[PATCH for-6.2 0/6] qom: Fix broken OBJECT_CHECK usage
at https://lore.kernel.org/qemu-devel/[email protected]
* Fix typo (s/SCLP_EVENT_BUS/SCLP_EVENTS_BUS/)

Cc Richard Henderson <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Cornelia Huck <[email protected]>
Cc Halil Pasic <[email protected]>
Cc Christian Borntraeger <[email protected]>
Cc Thomas Huth <[email protected]>
Quoted 3 lines
---
 hw/s390x/event-facility.c | 1 +
 1 file changed, 1 insertion(+)
#15 lore raw

PATCH 5/6 s390x: event-facility: Use SCLP_EVENT_BUS macro

In reply to Eduardo Habkost

Use the SCLP_EVENT_BUS macro instead of manually calling OBJECT_CHECK.

---
Cc: Cornelia Huck <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: Halil Pasic <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 hw/s390x/event-facility.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/s390x/event-facility.c +1 -1
index 9f7883d6e20..bc706bd19b4 100644
@@ -532,7 +532,7 @@ BusState *sclp_get_event_facility_bus(void)
     SCLPEventsBus *sbus;
 
     busobj = object_resolve_path_type("", TYPE_SCLP_EVENTS_BUS, NULL);
-    sbus = OBJECT_CHECK(SCLPEventsBus, busobj, TYPE_SCLP_EVENTS_BUS);
+    sbus = SCLP_EVENT_BUS(busobj);
     if (!sbus) {
         return NULL;
     }
Signature · 1 line
2.31.1
Reviewed-by on v1 5/6
#16 lore raw

Re: [PATCH for-6.2 5/6] s390x: event-facility: Use SCLP_EVENT_BUS macro

Quoted 23 lines · Eduardo Habkost

Use the SCLP_EVENT_BUS macro instead of manually calling OBJECT_CHECK.

---
Cc: Cornelia Huck <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: Halil Pasic <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
  hw/s390x/event-facility.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/s390x/event-facility.c +0 -0
index 9f7883d6e20..bc706bd19b4 100644

hw/s390x/event-facility.c BusState *sclp_get_event_facility_bus(void) · line 538

Quoted 8 lines
hw/s390x/event-facility.c +1 -1
@@ -532,7 +532,7 @@ BusState *sclp_get_event_facility_bus(void)
      SCLPEventsBus *sbus;
 
      busobj = object_resolve_path_type("", TYPE_SCLP_EVENTS_BUS, NULL);
-    sbus = OBJECT_CHECK(SCLPEventsBus, busobj, TYPE_SCLP_EVENTS_BUS);
+    sbus = SCLP_EVENT_BUS(busobj);
      if (!sbus) {
          return NULL;
      }

I think this could be merged with the previous patch. Anyway:

Reviewed-by
#17 lore raw

Re: [PATCH for-6.2 5/6] s390x: event-facility: Use SCLP_EVENT_BUS macro

Quoted 34 lines · Thomas Huth
Quoted 23 lines · Eduardo Habkost

Use the SCLP_EVENT_BUS macro instead of manually calling OBJECT_CHECK.

---
Cc: Cornelia Huck <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: Halil Pasic <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
   hw/s390x/event-facility.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
hw/s390x/event-facility.c +0 -0
index 9f7883d6e20..bc706bd19b4 100644

hw/s390x/event-facility.c BusState *sclp_get_event_facility_bus(void) · line 538

Quoted 8 lines
hw/s390x/event-facility.c +1 -1
@@ -532,7 +532,7 @@ BusState *sclp_get_event_facility_bus(void)
       SCLPEventsBus *sbus;
 
       busobj = object_resolve_path_type("", TYPE_SCLP_EVENTS_BUS, NULL);
-    sbus = OBJECT_CHECK(SCLPEventsBus, busobj, TYPE_SCLP_EVENTS_BUS);
+    sbus = SCLP_EVENT_BUS(busobj);
       if (!sbus) {
           return NULL;
       }

I think this could be merged with the previous patch. Anyway:

Quoted 2 lines

+1

Signature · 3 lines
Thanks,

David / dhildenb
Reviewed-by
#18 lore raw

Re: [PATCH for-6.2 5/6] s390x: event-facility: Use SCLP_EVENT_BUS macro

Quoted 18 lines · David Hildenbrand
Quoted 17 lines · Thomas Huth
Quoted 16 lines · Eduardo Habkost

Use the SCLP_EVENT_BUS macro instead of manually calling OBJECT_CHECK.

---
Cc: Cornelia Huck <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: Halil Pasic <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
   hw/s390x/event-facility.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 7 lines
Quoted 3 lines

I think this could be merged with the previous patch. Anyway:

+1

+1 :)

#19 lore raw

PATCH 6/6 Use PCI_HOST_BRIDGE macro

In reply to Eduardo Habkost

OBJECT_CHECK(PciHostState, ..., TYPE_PCI_HOST_BRIDGE) is exactly what the PCI_HOST_BRIDGE macro does. We can just use the macro instead of using OBJECT_CHECK manually.

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Igor Mammedov <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: [email protected]

---
 hw/i386/acpi-build.c | 8 ++------
 hw/pci-host/i440fx.c | 4 +---
 2 files changed, 3 insertions(+), 9 deletions(-)
hw/i386/acpi-build.c +2 -6
index a33ac8b91e1..3c6bbb1beb3 100644
@@ -303,13 +303,9 @@ Object *acpi_get_i386_pci_host(void)
 {
     PCIHostState *host;
 
-    host = OBJECT_CHECK(PCIHostState,
-                        object_resolve_path("/machine/i440fx", NULL),
-                        TYPE_PCI_HOST_BRIDGE);
+    host = PCI_HOST_BRIDGE(object_resolve_path("/machine/i440fx", NULL));
     if (!host) {
-        host = OBJECT_CHECK(PCIHostState,
-                            object_resolve_path("/machine/q35", NULL),
-                            TYPE_PCI_HOST_BRIDGE);
+        host = PCI_HOST_BRIDGE(object_resolve_path("/machine/q35", NULL));
     }
 
     return OBJECT(host);
hw/pci-host/i440fx.c +1 -3
index 28c9bae8994..cd87e21a9b2 100644
@@ -316,9 +316,7 @@ PCIBus *i440fx_init(const char *host_type, const char *pci_type,
 
 PCIBus *find_i440fx(void)
 {
-    PCIHostState *s = OBJECT_CHECK(PCIHostState,
-                                   object_resolve_path("/machine/i440fx", NULL),
-                                   TYPE_PCI_HOST_BRIDGE);
+    PCIHostState *s = PCI_HOST_BRIDGE(object_resolve_path("/machine/i440fx", NULL));
     return s ? s->bus : NULL;
 }
 
Signature · 1 line
2.31.1
Reviewed-by on v1 6/6
#20 lore raw

Re: [PATCH for-6.2 6/6] Use PCI_HOST_BRIDGE macro

Quoted 5 lines · On Thu, 5 Aug 2021 15:34:31 -0400 Eduardo Habkost <[email protected]> wrote:

OBJECT_CHECK(PciHostState, ..., TYPE_PCI_HOST_BRIDGE) is exactly what the PCI_HOST_BRIDGE macro does. We can just use the macro instead of using OBJECT_CHECK manually.

Quoted 47 lines

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Igor Mammedov <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: [email protected]

---
 hw/i386/acpi-build.c | 8 ++------
 hw/pci-host/i440fx.c | 4 +---
 2 files changed, 3 insertions(+), 9 deletions(-)
hw/i386/acpi-build.c +2 -6
index a33ac8b91e1..3c6bbb1beb3 100644
@@ -303,13 +303,9 @@ Object *acpi_get_i386_pci_host(void)
 {
     PCIHostState *host;
 
-    host = OBJECT_CHECK(PCIHostState,
-                        object_resolve_path("/machine/i440fx", NULL),
-                        TYPE_PCI_HOST_BRIDGE);
+    host = PCI_HOST_BRIDGE(object_resolve_path("/machine/i440fx", NULL));
     if (!host) {
-        host = OBJECT_CHECK(PCIHostState,
-                            object_resolve_path("/machine/q35", NULL),
-                            TYPE_PCI_HOST_BRIDGE);
+        host = PCI_HOST_BRIDGE(object_resolve_path("/machine/q35", NULL));
     }
     return OBJECT(host);
hw/pci-host/i440fx.c +1 -3
index 28c9bae8994..cd87e21a9b2 100644
@@ -316,9 +316,7 @@ PCIBus *i440fx_init(const char *host_type, const char *pci_type,
 
 PCIBus *find_i440fx(void)
 {
-    PCIHostState *s = OBJECT_CHECK(PCIHostState,
-                                   object_resolve_path("/machine/i440fx", NULL),
-                                   TYPE_PCI_HOST_BRIDGE);
+    PCIHostState *s = PCI_HOST_BRIDGE(object_resolve_path("/machine/i440fx", NULL));
     return s ? s->bus : NULL;
 }