Use PCI_HOST_BRIDGE macro
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. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20210805193431.307761-7-ehabkost@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
3a83db5df3
commit
b914e741e9
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user