mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 03:10:12 +00:00
![Kenji Kaneshige](/assets/img/avatar_default.png)
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>
36 lines
846 B
C
36 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_ */
|