Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b91182a6 authored by Kirill A. Shutemov's avatar Kirill A. Shutemov Committed by Rafael J. Wysocki
Browse files

ACPI / hotplug / PCI: Allow slots without new devices to be rescanned



Currently, enable_device() checks the return value of pci_scan_slot()
and returns immediately if that's 0 (meaning that no new functions
have been found in the slot).  However, if one of the functions in
the slot is a bridge, some new devices may appear below it even if
the bridge itself is present continuously, so it generally is
necessary to do the rescan anyway just in case.  [In particular,
that's necessary with the Thunderbolt daisy chaining in which case
new devices may be connected to the existing ones down the chain.]

The correctness of this change relies on the ability of
pcibios_resource_survey_bus() to detect if it has already been called
for the given bus and to skip it if so.  Failure to do that will lead
to resource allocation conflicts.

[rjw: Changelog]
Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 55502ddb
Loading
Loading
Loading
Loading
+2 −9
Original line number Original line Diff line number Diff line
@@ -542,18 +542,13 @@ static int __ref enable_device(struct acpiphp_slot *slot)
	struct pci_dev *dev;
	struct pci_dev *dev;
	struct pci_bus *bus = slot->bus;
	struct pci_bus *bus = slot->bus;
	struct acpiphp_func *func;
	struct acpiphp_func *func;
	int num, max, pass;
	int max, pass;
	LIST_HEAD(add_list);
	LIST_HEAD(add_list);


	list_for_each_entry(func, &slot->funcs, sibling)
	list_for_each_entry(func, &slot->funcs, sibling)
		acpiphp_bus_add(func_to_handle(func));
		acpiphp_bus_add(func_to_handle(func));


	num = pci_scan_slot(bus, PCI_DEVFN(slot->device, 0));
	pci_scan_slot(bus, PCI_DEVFN(slot->device, 0));
	if (num == 0) {
		/* Maybe only part of funcs are added. */
		dbg("No new device found\n");
		goto err_exit;
	}


	max = acpiphp_max_busnr(bus);
	max = acpiphp_max_busnr(bus);
	for (pass = 0; pass < 2; pass++) {
	for (pass = 0; pass < 2; pass++) {
@@ -599,8 +594,6 @@ static int __ref enable_device(struct acpiphp_slot *slot)
		}
		}
	}
	}



 err_exit:
	return 0;
	return 0;
}
}