Skip to content

Commit

Permalink
acer-wmi: fix out of input parameter size when set
Browse files Browse the repository at this point in the history
The input parameter of set device status is different with get device
status. There have volume value element for set status but don't need
for get action.

On Acer TravelMate 4750 creates field on volume value element even
doesn't use it in DSDT. So, add this patch for separate input paramter
between set device status with get status.

Tested on Acer TravelMate 4750

Cc: Carlos Corbacho <carlos@strangeworlds.co.uk>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Dmitry Torokhov <dtor@mail.ru>
Cc: Corentin Chary <corentincj@iksaif.net>
Cc: Thomas Renninger <trenn@suse.de>
Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
  • Loading branch information
Lee, Chun-Yi authored and Matthew Garrett committed Mar 26, 2012
1 parent 34b6cfa commit 996d23b
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions drivers/platform/x86/acer-wmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,14 @@ struct lm_return_value {
u16 reserved;
} __attribute__((packed));

struct wmid3_gds_input_param { /* Get Device Status input parameter */
struct wmid3_gds_set_input_param { /* Set Device Status input parameter */
u8 function_num; /* Function Number */
u8 hotkey_number; /* Hotkey Number */
u16 devices; /* Set Device */
u8 volume_value; /* Volume Value */
} __attribute__((packed));

struct wmid3_gds_get_input_param { /* Get Device Status input parameter */
u8 function_num; /* Function Number */
u8 hotkey_number; /* Hotkey Number */
u16 devices; /* Get Device */
Expand Down Expand Up @@ -922,13 +929,13 @@ static acpi_status wmid3_get_device_status(u32 *value, u16 device)
struct wmid3_gds_return_value return_value;
acpi_status status;
union acpi_object *obj;
struct wmid3_gds_input_param params = {
struct wmid3_gds_get_input_param params = {
.function_num = 0x1,
.hotkey_number = commun_fn_key_number,
.devices = device,
};
struct acpi_buffer input = {
sizeof(struct wmid3_gds_input_param),
sizeof(struct wmid3_gds_get_input_param),
&params
};
struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
Expand Down Expand Up @@ -991,19 +998,28 @@ static acpi_status wmid3_set_device_status(u32 value, u16 device)
acpi_status status;
union acpi_object *obj;
u16 devices;
struct wmid3_gds_input_param params = {
struct wmid3_gds_get_input_param get_params = {
.function_num = 0x1,
.hotkey_number = commun_fn_key_number,
.devices = commun_func_bitmap,
};
struct acpi_buffer input = {
sizeof(struct wmid3_gds_input_param),
&params
struct acpi_buffer get_input = {
sizeof(struct wmid3_gds_get_input_param),
&get_params
};
struct wmid3_gds_set_input_param set_params = {
.function_num = 0x2,
.hotkey_number = commun_fn_key_number,
.devices = commun_func_bitmap,
};
struct acpi_buffer set_input = {
sizeof(struct wmid3_gds_set_input_param),
&set_params
};
struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
struct acpi_buffer output2 = { ACPI_ALLOCATE_BUFFER, NULL };

status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &input, &output);
status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &get_input, &output);
if (ACPI_FAILURE(status))
return status;

Expand Down Expand Up @@ -1032,11 +1048,9 @@ static acpi_status wmid3_set_device_status(u32 value, u16 device)
}

devices = return_value.devices;
params.function_num = 0x2;
params.hotkey_number = commun_fn_key_number;
params.devices = (value) ? (devices | device) : (devices & ~device);
set_params.devices = (value) ? (devices | device) : (devices & ~device);

status = wmi_evaluate_method(WMID_GUID3, 0, 0x1, &input, &output2);
status = wmi_evaluate_method(WMID_GUID3, 0, 0x1, &set_input, &output2);
if (ACPI_FAILURE(status))
return status;

Expand Down

0 comments on commit 996d23b

Please sign in to comment.