Commit 753e3aca authored by Taku Izumi's avatar Taku Izumi Committed by Jesse Barnes

PCI: revert additional _OSC evaluation

Reverts adf411b8.

The commit adf411b8 was based on the
improper assumption that queried result was not updated when _OSC
support field was changed. But, in fact, queried result is updated
whenever _OSC support field was changed through __acpi_query_osc().
As a result, the commit adf411b8 only
introduced unnecessary additional _OSC evaluation...
Tested-by: default avatarAndrew Patterson <andrew.patterson@hp.com>
Reviewed-by: default avatarAndrew Patterson <andrew.patterson@hp.com>
Signed-off-by: default avatarKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: default avatarTaku Izumi <izumi.taku@jp.fujitsu.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 4ba7d0f0
...@@ -24,13 +24,15 @@ struct acpi_osc_data { ...@@ -24,13 +24,15 @@ struct acpi_osc_data {
acpi_handle handle; acpi_handle handle;
u32 support_set; u32 support_set;
u32 control_set; u32 control_set;
int is_queried;
u32 query_result;
struct list_head sibiling; struct list_head sibiling;
}; };
static LIST_HEAD(acpi_osc_data_list); static LIST_HEAD(acpi_osc_data_list);
struct acpi_osc_args { struct acpi_osc_args {
u32 capbuf[3]; u32 capbuf[3];
u32 ctrl_result; u32 query_result;
}; };
static DEFINE_MUTEX(pci_acpi_lock); static DEFINE_MUTEX(pci_acpi_lock);
...@@ -112,8 +114,9 @@ static acpi_status acpi_run_osc(acpi_handle handle, ...@@ -112,8 +114,9 @@ static acpi_status acpi_run_osc(acpi_handle handle,
goto out_kfree; goto out_kfree;
} }
out_success: out_success:
osc_args->ctrl_result = if (flags & OSC_QUERY_ENABLE)
*((u32 *)(out_obj->buffer.pointer + 8)); osc_args->query_result =
*((u32 *)(out_obj->buffer.pointer + 8));
status = AE_OK; status = AE_OK;
out_kfree: out_kfree:
...@@ -121,8 +124,7 @@ static acpi_status acpi_run_osc(acpi_handle handle, ...@@ -121,8 +124,7 @@ static acpi_status acpi_run_osc(acpi_handle handle,
return status; return status;
} }
static acpi_status __acpi_query_osc(u32 flags, struct acpi_osc_data *osc_data, static acpi_status __acpi_query_osc(u32 flags, struct acpi_osc_data *osc_data)
u32 *result)
{ {
acpi_status status; acpi_status status;
u32 support_set; u32 support_set;
...@@ -137,7 +139,8 @@ static acpi_status __acpi_query_osc(u32 flags, struct acpi_osc_data *osc_data, ...@@ -137,7 +139,8 @@ static acpi_status __acpi_query_osc(u32 flags, struct acpi_osc_data *osc_data,
status = acpi_run_osc(osc_data->handle, &osc_args); status = acpi_run_osc(osc_data->handle, &osc_args);
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
osc_data->support_set = support_set; osc_data->support_set = support_set;
*result = osc_args.ctrl_result; osc_data->query_result = osc_args.query_result;
osc_data->is_queried = 1;
} }
return status; return status;
...@@ -151,7 +154,6 @@ static acpi_status __acpi_query_osc(u32 flags, struct acpi_osc_data *osc_data, ...@@ -151,7 +154,6 @@ static acpi_status __acpi_query_osc(u32 flags, struct acpi_osc_data *osc_data,
*/ */
int pci_acpi_osc_support(acpi_handle handle, u32 flags) int pci_acpi_osc_support(acpi_handle handle, u32 flags)
{ {
u32 dummy;
acpi_status status; acpi_status status;
acpi_handle tmp; acpi_handle tmp;
struct acpi_osc_data *osc_data; struct acpi_osc_data *osc_data;
...@@ -169,7 +171,7 @@ int pci_acpi_osc_support(acpi_handle handle, u32 flags) ...@@ -169,7 +171,7 @@ int pci_acpi_osc_support(acpi_handle handle, u32 flags)
goto out; goto out;
} }
__acpi_query_osc(flags, osc_data, &dummy); __acpi_query_osc(flags, osc_data);
out: out:
mutex_unlock(&pci_acpi_lock); mutex_unlock(&pci_acpi_lock);
return rc; return rc;
...@@ -185,7 +187,7 @@ int pci_acpi_osc_support(acpi_handle handle, u32 flags) ...@@ -185,7 +187,7 @@ int pci_acpi_osc_support(acpi_handle handle, u32 flags)
acpi_status pci_osc_control_set(acpi_handle handle, u32 flags) acpi_status pci_osc_control_set(acpi_handle handle, u32 flags)
{ {
acpi_status status; acpi_status status;
u32 ctrlset, control_set, result; u32 ctrlset, control_set;
acpi_handle tmp; acpi_handle tmp;
struct acpi_osc_data *osc_data; struct acpi_osc_data *osc_data;
struct acpi_osc_args osc_args; struct acpi_osc_args osc_args;
...@@ -208,11 +210,13 @@ acpi_status pci_osc_control_set(acpi_handle handle, u32 flags) ...@@ -208,11 +210,13 @@ acpi_status pci_osc_control_set(acpi_handle handle, u32 flags)
goto out; goto out;
} }
status = __acpi_query_osc(osc_data->support_set, osc_data, &result); if (!osc_data->is_queried) {
if (ACPI_FAILURE(status)) status = __acpi_query_osc(osc_data->support_set, osc_data);
goto out; if (ACPI_FAILURE(status))
goto out;
}
if ((result & ctrlset) != ctrlset) { if ((osc_data->query_result & ctrlset) != ctrlset) {
status = AE_SUPPORT; status = AE_SUPPORT;
goto out; goto out;
} }
......
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