Commit b879dc4b authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by Jesse Barnes

ACPI/PCI: Reorder checks in acpi_pci_osc_control_set()

Make acpi_pci_osc_control_set() attempt to find the handle of the
_OSC object under the given PCI root bridge object after verifying
that its second argument is correct and that there is a struct
acpi_pci_root object for the given root bridge handle, which is
more logical than the old code.
Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
Reviewed-by: default avatarHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 79dd9182
...@@ -378,10 +378,6 @@ acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags) ...@@ -378,10 +378,6 @@ acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags)
acpi_handle tmp; acpi_handle tmp;
struct acpi_pci_root *root; struct acpi_pci_root *root;
status = acpi_get_handle(handle, "_OSC", &tmp);
if (ACPI_FAILURE(status))
return status;
control_req = (flags & OSC_PCI_CONTROL_MASKS); control_req = (flags & OSC_PCI_CONTROL_MASKS);
if (!control_req) if (!control_req)
return AE_TYPE; return AE_TYPE;
...@@ -390,6 +386,10 @@ acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags) ...@@ -390,6 +386,10 @@ acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags)
if (!root) if (!root)
return AE_NOT_EXIST; return AE_NOT_EXIST;
status = acpi_get_handle(handle, "_OSC", &tmp);
if (ACPI_FAILURE(status))
return status;
mutex_lock(&osc_lock); mutex_lock(&osc_lock);
/* No need to evaluate _OSC if the control was already granted. */ /* No need to evaluate _OSC if the control was already granted. */
if ((root->osc_control_set & control_req) == control_req) if ((root->osc_control_set & control_req) == control_req)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment