Skip to content

Commit

Permalink
PCI: revert additional _OSC evaluation
Browse files Browse the repository at this point in the history
Reverts adf411b.

The commit adf411b 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 adf411b only
introduced unnecessary additional _OSC evaluation...

Tested-by: Andrew Patterson <[email protected]>
Reviewed-by: Andrew Patterson <[email protected]>
Signed-off-by: Kenji Kaneshige <[email protected]>
Signed-off-by: Taku Izumi <[email protected]>
Signed-off-by: Jesse Barnes <[email protected]>
  • Loading branch information
izumi777 authored and jbarnes993 committed Jan 7, 2009
1 parent 4ba7d0f commit 753e3ac
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions drivers/pci/pci-acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ struct acpi_osc_data {
acpi_handle handle;
u32 support_set;
u32 control_set;
int is_queried;
u32 query_result;
struct list_head sibiling;
};
static LIST_HEAD(acpi_osc_data_list);

struct acpi_osc_args {
u32 capbuf[3];
u32 ctrl_result;
u32 query_result;
};

static DEFINE_MUTEX(pci_acpi_lock);
Expand Down Expand Up @@ -112,17 +114,17 @@ static acpi_status acpi_run_osc(acpi_handle handle,
goto out_kfree;
}
out_success:
osc_args->ctrl_result =
*((u32 *)(out_obj->buffer.pointer + 8));
if (flags & OSC_QUERY_ENABLE)
osc_args->query_result =
*((u32 *)(out_obj->buffer.pointer + 8));
status = AE_OK;

out_kfree:
kfree(output.pointer);
return status;
}

static acpi_status __acpi_query_osc(u32 flags, struct acpi_osc_data *osc_data,
u32 *result)
static acpi_status __acpi_query_osc(u32 flags, struct acpi_osc_data *osc_data)
{
acpi_status status;
u32 support_set;
Expand All @@ -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);
if (ACPI_SUCCESS(status)) {
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;
Expand All @@ -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)
{
u32 dummy;
acpi_status status;
acpi_handle tmp;
struct acpi_osc_data *osc_data;
Expand All @@ -169,7 +171,7 @@ int pci_acpi_osc_support(acpi_handle handle, u32 flags)
goto out;
}

__acpi_query_osc(flags, osc_data, &dummy);
__acpi_query_osc(flags, osc_data);
out:
mutex_unlock(&pci_acpi_lock);
return rc;
Expand All @@ -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 status;
u32 ctrlset, control_set, result;
u32 ctrlset, control_set;
acpi_handle tmp;
struct acpi_osc_data *osc_data;
struct acpi_osc_args osc_args;
Expand All @@ -208,11 +210,13 @@ acpi_status pci_osc_control_set(acpi_handle handle, u32 flags)
goto out;
}

status = __acpi_query_osc(osc_data->support_set, osc_data, &result);
if (ACPI_FAILURE(status))
goto out;
if (!osc_data->is_queried) {
status = __acpi_query_osc(osc_data->support_set, osc_data);
if (ACPI_FAILURE(status))
goto out;
}

if ((result & ctrlset) != ctrlset) {
if ((osc_data->query_result & ctrlset) != ctrlset) {
status = AE_SUPPORT;
goto out;
}
Expand Down

0 comments on commit 753e3ac

Please sign in to comment.