]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
acer-wmi: fix out of input parameter size when set
authorLee, Chun-Yi <jlee@suse.com>
Mon, 19 Mar 2012 09:37:33 +0000 (17:37 +0800)
committerMatthew Garrett <mjg@redhat.com>
Mon, 26 Mar 2012 19:05:28 +0000 (15:05 -0400)
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>
drivers/platform/x86/acer-wmi.c

index cb7e841582d9381d342caaff0150ce4a5ea4fecb..c31664438e761fce8c4a2a368cb58070af948559 100644 (file)
@@ -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 */
@@ -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 };
@@ -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;
 
@@ -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;