mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
ACPI / hotplug / PCI: Drop acpiphp_bus_trim()
If trim_stale_devices() calls acpi_bus_trim() directly, we can save a potentially costly acpi_bus_get_device() invocation. After making that change acpiphp_bus_trim() would only be called from one place, so move the code from it to that place and drop it. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
This commit is contained in:
parent
146fc68a4b
commit
4dc3082dc1
@ -488,19 +488,6 @@ static unsigned char acpiphp_max_busnr(struct pci_bus *bus)
|
|||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* acpiphp_bus_trim - Trim device objects in an ACPI namespace subtree.
|
|
||||||
* @handle: ACPI device object handle to start from.
|
|
||||||
*/
|
|
||||||
static void acpiphp_bus_trim(acpi_handle handle)
|
|
||||||
{
|
|
||||||
struct acpi_device *adev = NULL;
|
|
||||||
|
|
||||||
acpi_bus_get_device(handle, &adev);
|
|
||||||
if (adev)
|
|
||||||
acpi_bus_trim(adev);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* acpiphp_bus_add - Scan ACPI namespace subtree.
|
* acpiphp_bus_add - Scan ACPI namespace subtree.
|
||||||
* @handle: ACPI object handle to start the scan from.
|
* @handle: ACPI object handle to start the scan from.
|
||||||
@ -641,8 +628,12 @@ static void disable_slot(struct acpiphp_slot *slot)
|
|||||||
if (PCI_SLOT(dev->devfn) == slot->device)
|
if (PCI_SLOT(dev->devfn) == slot->device)
|
||||||
pci_stop_and_remove_bus_device(dev);
|
pci_stop_and_remove_bus_device(dev);
|
||||||
|
|
||||||
list_for_each_entry(func, &slot->funcs, sibling)
|
list_for_each_entry(func, &slot->funcs, sibling) {
|
||||||
acpiphp_bus_trim(func_to_handle(func));
|
struct acpi_device *adev;
|
||||||
|
|
||||||
|
if (!acpi_bus_get_device(func_to_handle(func), &adev))
|
||||||
|
acpi_bus_trim(adev);
|
||||||
|
}
|
||||||
|
|
||||||
slot->flags &= (~SLOT_ENABLED);
|
slot->flags &= (~SLOT_ENABLED);
|
||||||
}
|
}
|
||||||
@ -714,11 +705,12 @@ static unsigned int get_slot_status(struct acpiphp_slot *slot)
|
|||||||
*/
|
*/
|
||||||
static void trim_stale_devices(struct pci_dev *dev)
|
static void trim_stale_devices(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
acpi_handle handle = ACPI_HANDLE(&dev->dev);
|
struct acpi_device *adev = ACPI_COMPANION(&dev->dev);
|
||||||
struct pci_bus *bus = dev->subordinate;
|
struct pci_bus *bus = dev->subordinate;
|
||||||
bool alive = false;
|
bool alive = false;
|
||||||
|
|
||||||
if (handle) {
|
if (adev) {
|
||||||
|
acpi_handle handle = adev->handle;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
unsigned long long sta;
|
unsigned long long sta;
|
||||||
|
|
||||||
@ -734,8 +726,8 @@ static void trim_stale_devices(struct pci_dev *dev)
|
|||||||
}
|
}
|
||||||
if (!alive) {
|
if (!alive) {
|
||||||
pci_stop_and_remove_bus_device(dev);
|
pci_stop_and_remove_bus_device(dev);
|
||||||
if (handle)
|
if (adev)
|
||||||
acpiphp_bus_trim(handle);
|
acpi_bus_trim(adev);
|
||||||
} else if (bus) {
|
} else if (bus) {
|
||||||
struct pci_dev *child, *tmp;
|
struct pci_dev *child, *tmp;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user