mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-25 08:40:53 +07:00
d18690af62
Current acpi_find_root_bridge_handle() has a assumption that pci_bus->self is NULL on the root pci bus. But it might not be true on some platforms. Because of this wrong assumption, current acpi_find_root_bridge_handle() might cause endless loop. We must check pci_bus->parent instead. Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
37 lines
846 B
C
37 lines
846 B
C
/*
|
|
* File pci-acpi.h
|
|
*
|
|
* Copyright (C) 2004 Intel
|
|
* Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com)
|
|
*/
|
|
|
|
#ifndef _PCI_ACPI_H_
|
|
#define _PCI_ACPI_H_
|
|
|
|
#include <linux/acpi.h>
|
|
|
|
#ifdef CONFIG_ACPI
|
|
static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
|
|
{
|
|
struct pci_bus *pbus = pdev->bus;
|
|
/* Find a PCI root bus */
|
|
while (pbus->parent)
|
|
pbus = pbus->parent;
|
|
return acpi_get_pci_rootbridge_handle(pci_domain_nr(pbus),
|
|
pbus->number);
|
|
}
|
|
|
|
static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)
|
|
{
|
|
if (pbus->parent)
|
|
return DEVICE_ACPI_HANDLE(&(pbus->self->dev));
|
|
return acpi_get_pci_rootbridge_handle(pci_domain_nr(pbus),
|
|
pbus->number);
|
|
}
|
|
#else
|
|
static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
|
|
{ return NULL; }
|
|
#endif
|
|
|
|
#endif /* _PCI_ACPI_H_ */
|