mirror of https://gitee.com/openkylin/linux.git
PCI: shpchp: Rely on previous _OSC results
If _OSC exists, we evaluated it when adding the ACPI host bridge, and we requested SHPC control if the SHPC driver is present. Use the result of that _OSC evaluation instead of evaluating it again. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> [bhelgaas: split to separate patch] Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
parent
1df81a6d6e
commit
aa6be07c27
|
@ -69,16 +69,12 @@ static acpi_status acpi_run_oshp(acpi_handle handle)
|
||||||
*/
|
*/
|
||||||
int acpi_get_hp_hw_control_from_firmware(struct pci_dev *pdev, u32 flags)
|
int acpi_get_hp_hw_control_from_firmware(struct pci_dev *pdev, u32 flags)
|
||||||
{
|
{
|
||||||
|
const struct pci_host_bridge *host;
|
||||||
|
const struct acpi_pci_root *root;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
acpi_handle chandle, handle;
|
acpi_handle chandle, handle;
|
||||||
struct acpi_buffer string = { ACPI_ALLOCATE_BUFFER, NULL };
|
struct acpi_buffer string = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||||
|
|
||||||
flags &= OSC_PCI_SHPC_NATIVE_HP_CONTROL;
|
|
||||||
if (!flags) {
|
|
||||||
err("Invalid flags %u specified!\n", flags);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Per PCI firmware specification, we should run the ACPI _OSC
|
* Per PCI firmware specification, we should run the ACPI _OSC
|
||||||
* method to get control of hotplug hardware before using it. If
|
* method to get control of hotplug hardware before using it. If
|
||||||
|
@ -88,19 +84,14 @@ int acpi_get_hp_hw_control_from_firmware(struct pci_dev *pdev, u32 flags)
|
||||||
* OSHP within the scope of the hotplug controller and its parents,
|
* OSHP within the scope of the hotplug controller and its parents,
|
||||||
* up to the host bridge under which this controller exists.
|
* up to the host bridge under which this controller exists.
|
||||||
*/
|
*/
|
||||||
handle = acpi_find_root_bridge_handle(pdev);
|
host = pci_find_host_bridge(pdev->bus);
|
||||||
if (handle) {
|
if (host->native_shpc_hotplug)
|
||||||
acpi_get_name(handle, ACPI_FULL_PATHNAME, &string);
|
return 0;
|
||||||
dbg("Trying to get hotplug control for %s\n",
|
|
||||||
(char *)string.pointer);
|
/* If _OSC exists, we should not evaluate OSHP */
|
||||||
status = acpi_pci_osc_control_set(handle, &flags, flags);
|
root = acpi_pci_find_root(ACPI_HANDLE(&host->dev));
|
||||||
if (ACPI_SUCCESS(status))
|
if (root->osc_support_set)
|
||||||
goto got_one;
|
|
||||||
if (status == AE_SUPPORT)
|
|
||||||
goto no_control;
|
goto no_control;
|
||||||
kfree(string.pointer);
|
|
||||||
string = (struct acpi_buffer){ ACPI_ALLOCATE_BUFFER, NULL };
|
|
||||||
}
|
|
||||||
|
|
||||||
handle = ACPI_HANDLE(&pdev->dev);
|
handle = ACPI_HANDLE(&pdev->dev);
|
||||||
if (!handle) {
|
if (!handle) {
|
||||||
|
|
Loading…
Reference in New Issue