Hi Andrew,
These patches are getting mangled and do not apply. There is an extra space added in column 2 which normal patch tools (patch, stg import, git-apply) do not like. Would you please regenerate them and/or fix your mail client.
Sorry, but now I've no idea how to fix mail client. Please forgive me for sending patchset as an atachment. Best regards, Taku Izumi
Cleanup _OSC evaluation code. Signed-off-by: Kenji Kaneshige <kaneshige.kenji@xxxxxxxxxxxxxx> Signed-off-by: Taku Izumi <izumi.taku@xxxxxxxxxxxxxx> drivers/pci/pci-acpi.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) Index: linux-next.28rc4/drivers/pci/pci-acpi.c =================================================================== --- linux-next.28rc4.orig/drivers/pci/pci-acpi.c +++ linux-next.28rc4/drivers/pci/pci-acpi.c @@ -24,15 +24,14 @@ struct acpi_osc_data { acpi_handle handle; u32 support_set; u32 control_set; + u32 control_query; 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 query_result; }; static DEFINE_MUTEX(pci_acpi_lock); @@ -58,7 +57,7 @@ static u8 OSC_UUID[16] = {0x5B, 0x4D, 0x 0x96, 0x57, 0x74, 0x41, 0xC0, 0x3D, 0xD7, 0x66}; static acpi_status acpi_run_osc(acpi_handle handle, - struct acpi_osc_args *osc_args) + struct acpi_osc_args *osc_args, u32 *retval) { acpi_status status; struct acpi_object_list input; @@ -113,9 +112,7 @@ static acpi_status acpi_run_osc(acpi_han goto out_kfree; } out_success: - if (flags & OSC_QUERY_ENABLE) - osc_args->query_result = - *((u32 *)(out_obj->buffer.pointer + 8)); + *retval = *((u32 *)(out_obj->buffer.pointer + 8)); status = AE_OK; out_kfree: @@ -126,7 +123,7 @@ out_kfree: static acpi_status __acpi_query_osc(u32 flags, struct acpi_osc_data *osc_data) { acpi_status status; - u32 support_set; + u32 support_set, result; struct acpi_osc_args osc_args; /* do _OSC query for all possible controls */ @@ -135,10 +132,10 @@ static acpi_status __acpi_query_osc(u32 osc_args.capbuf[OSC_SUPPORT_TYPE] = support_set; osc_args.capbuf[OSC_CONTROL_TYPE] = OSC_CONTROL_MASKS; - status = acpi_run_osc(osc_data->handle, &osc_args); + status = acpi_run_osc(osc_data->handle, &osc_args, &result); if (ACPI_SUCCESS(status)) { osc_data->support_set = support_set; - osc_data->query_result = osc_args.query_result; + osc_data->control_query = result; osc_data->is_queried = 1; } @@ -186,7 +183,7 @@ out: acpi_status pci_osc_control_set(acpi_handle handle, u32 flags) { acpi_status status; - u32 ctrlset, control_set; + u32 control_req, control_set, result; acpi_handle tmp; struct acpi_osc_data *osc_data; struct acpi_osc_args osc_args; @@ -203,14 +200,14 @@ acpi_status pci_osc_control_set(acpi_han goto out; } - ctrlset = (flags & OSC_CONTROL_MASKS); - if (!ctrlset) { + control_req = (flags & OSC_CONTROL_MASKS); + if (!control_req) { status = AE_TYPE; goto out; } /* No need to evaluate _OSC if the control was already granted. */ - if ((osc_data->control_set & ctrlset) == ctrlset) + if ((osc_data->control_set & control_req) == control_req) goto out; if (!osc_data->is_queried) { @@ -219,18 +216,18 @@ acpi_status pci_osc_control_set(acpi_han goto out; } - if ((osc_data->query_result & ctrlset) != ctrlset) { + if ((osc_data->control_query & control_req) != control_req) { status = AE_SUPPORT; goto out; } - control_set = osc_data->control_set | ctrlset; + control_set = osc_data->control_set | control_req; osc_args.capbuf[OSC_QUERY_TYPE] = 0; osc_args.capbuf[OSC_SUPPORT_TYPE] = osc_data->support_set; osc_args.capbuf[OSC_CONTROL_TYPE] = control_set; - status = acpi_run_osc(handle, &osc_args); + status = acpi_run_osc(handle, &osc_args, &result); if (ACPI_SUCCESS(status)) - osc_data->control_set = control_set; + osc_data->control_set = result; out: mutex_unlock(&pci_acpi_lock); return status;
Remove unnecessary _OSC evaluation for control request. If a control had already been granted, we don't need to re-evaluate _OSC for it because firmware may not reject control of any feature it has previously granted control to. Signed-off-by: Kenji Kaneshige <kaneshige.kenji@xxxxxxxxxxxxxx> Signed-off-by: Taku Izumi <izumi.taku@xxxxxxxxxxxxxx> drivers/pci/pci-acpi.c | 4 ++++ 1 file changed, 4 insertions(+) Index: linux-next.28rc4/drivers/pci/pci-acpi.c =================================================================== --- linux-next.28rc4.orig/drivers/pci/pci-acpi.c +++ linux-next.28rc4/drivers/pci/pci-acpi.c @@ -209,6 +209,10 @@ acpi_status pci_osc_control_set(acpi_han goto out; } + /* No need to evaluate _OSC if the control was already granted. */ + if ((osc_data->control_set & ctrlset) == ctrlset) + goto out; + if (!osc_data->is_queried) { status = __acpi_query_osc(osc_data->support_set, osc_data); if (ACPI_FAILURE(status))
Revert adf411b819adc9fa96e9b3e638c7480d5e71d270. The commit adf411b819adc9fa96e9b3e638c7480d5e71d270 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 adf411b819adc9fa96e9b3e638c7480d5e71d270 only introduced unnecessary additional _OSC evaluation... Signed-off-by: Kenji Kaneshige <kaneshige.kenji@xxxxxxxxxxxxxx> Signed-off-by: Taku Izumi <izumi.taku@xxxxxxxxxxxxxx> drivers/pci/pci-acpi.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) Index: linux-next.28rc4/drivers/pci/pci-acpi.c =================================================================== --- linux-next.28rc4.orig/drivers/pci/pci-acpi.c +++ linux-next.28rc4/drivers/pci/pci-acpi.c @@ -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); @@ -111,8 +113,9 @@ static acpi_status acpi_run_osc(acpi_han 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: @@ -120,8 +123,7 @@ out_kfree: 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; @@ -136,7 +138,8 @@ static acpi_status __acpi_query_osc(u32 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; @@ -150,7 +153,6 @@ static acpi_status __acpi_query_osc(u32 */ int pci_acpi_osc_support(acpi_handle handle, u32 flags) { - u32 dummy; acpi_status status; acpi_handle tmp; struct acpi_osc_data *osc_data; @@ -168,7 +170,7 @@ int pci_acpi_osc_support(acpi_handle han goto out; } - __acpi_query_osc(flags, osc_data, &dummy); + __acpi_query_osc(flags, osc_data); out: mutex_unlock(&pci_acpi_lock); return rc; @@ -184,7 +186,7 @@ out: 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; @@ -207,11 +209,13 @@ acpi_status pci_osc_control_set(acpi_han 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; }