qom: Fix broken OBJECT_CHECK usage
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
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
@@ -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
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.
Signed-off-by Eduardo Habkost <[email protected]>
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@@ -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
Re: [PATCH for-6.2 1/6] acpi: Delete broken ACPI_GED_X86 macro
In reply to Eduardo Habkostinclude/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.
Signed-off-by Eduardo Habkost <[email protected]>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
PATCH 2/6 sbsa_gwdt: Delete broken SBSA_*CLASS macros
In reply to Eduardo HabkostThose 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
@@ -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
PATCH 3/6 s390-sclp-events-bus: Set instance_size
In reply to Eduardo HabkostWe 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
@@ -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
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_sizeproperly to avoid problems in the future.Signed-off-by Eduardo Habkost <[email protected]>---
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
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)
Re: [PATCH for-6.2 3/6] s390-sclp-events-bus: Set instance_size
In reply to Eduardo HabkostQuoted 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_sizeproperly to avoid problems in the future.Signed-off-by Eduardo Habkost <[email protected]>---
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
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
Re: [PATCH for-6.2 3/6] s390-sclp-events-bus: Set instance_size
In reply to Eduardo HabkostQuoted 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_sizeproperly to avoid problems in the future.Signed-off-by Eduardo Habkost <[email protected]>---
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?)
PATCH 4/6 s390-sclp-events-bus: Use OBJECT_DECLARE_SIMPLE_TYPE
In reply to Eduardo HabkostWe 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
@@ -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
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_TYPEto declare the struct type and have aSCLP_EVENT_BUStypecast wrapper defined.Signed-off-by Eduardo Habkost <[email protected]>---
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
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
PATCH v2 1/1 s390-sclp-events-bus: Use OBJECT_DECLARE_SIMPLE_TYPE
In reply to Eduardo HabkostWe 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/)
--- hw/s390x/event-facility.c | 1 + 1 file changed, 1 insertion(+)
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 · 1 line
2.31.1
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_TYPEto declare the struct type and have aSCLP_EVENT_BUStypecast wrapper defined.Signed-off-by Eduardo Habkost <[email protected]>---
Changes v1 -> v2:
* v1 was previously submitted as part of series:
[PATCH for-6.2 0/6] qom: Fix brokenOBJECT_CHECKusage
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
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 ,
Re: [PATCH for-6.2 v2] s390-sclp-events-bus: Use OBJECT_DECLARE_SIMPLE_TYPE
In reply to Eduardo HabkostQuoted 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_TYPEto declare the struct type and have aSCLP_EVENT_BUStypecast wrapper defined.Signed-off-by Eduardo Habkost <[email protected]>---
Changes v1 -> v2:
* v1 was previously submitted as part of series:
[PATCH for-6.2 0/6] qom: Fix brokenOBJECT_CHECKusage
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
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
Re: [PATCH for-6.2 v2] s390-sclp-events-bus: Use OBJECT_DECLARE_SIMPLE_TYPE
In reply to Eduardo HabkostQuoted 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_TYPEto declare the struct type and have aSCLP_EVENT_BUStypecast wrapper defined.Signed-off-by Eduardo Habkost <[email protected]>---
Changes v1 -> v2:
* v1 was previously submitted as part of series:
[PATCH for-6.2 0/6] qom: Fix brokenOBJECT_CHECKusage
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(+)
PATCH 5/6 s390x: event-facility: Use SCLP_EVENT_BUS macro
In reply to Eduardo HabkostUse 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
@@ -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
Re: [PATCH for-6.2 5/6] s390x: event-facility: Use SCLP_EVENT_BUS macro
Quoted 23 lines · Eduardo Habkost
Use the
SCLP_EVENT_BUSmacro instead of manually callingOBJECT_CHECK.Signed-off-by Eduardo Habkost <[email protected]>---
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
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:
David Hildenbrand
Reviewed-byRe: [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_BUSmacro instead of manually callingOBJECT_CHECK.Signed-off-by Eduardo Habkost <[email protected]>---
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
-0hw/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
Reviewed-by Thomas Huth <[email protected]>
+1
Signature · 3 lines
Thanks, David / dhildenb
Cornelia Huck
Reviewed-byRe: [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_BUSmacro instead of manually callingOBJECT_CHECK.Signed-off-by Eduardo Habkost <[email protected]>---
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:
Reviewed-by Thomas Huth <[email protected]>+1
Reviewed-by David Hildenbrand <[email protected]>
+1 :)
PATCH 6/6 Use PCI_HOST_BRIDGE macro
In reply to Eduardo HabkostOBJECT_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
@@ -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
@@ -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
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 thePCI_HOST_BRIDGEmacro does. We can just use the macro instead of usingOBJECT_CHECKmanually.Signed-off-by Eduardo Habkost <[email protected]>
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@@ -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@@ -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 ; }