aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorCorentin Chary <corentincj@iksaif.net>2009-11-28 04:27:51 -0500
committerCorentin Chary <corentincj@iksaif.net>2010-02-28 13:35:09 -0500
commitd8c6732382a24d2ef23665207263a17f04e3d75a (patch)
treecfb762bb88b4acf95f7d25cbd43d1f999d54e8c7 /drivers/platform
parente5b50f6a2b00de266f03c2c7219b798648124ea5 (diff)
asus-laptop: simplify write_acpi_int
We only need a buffer for "INIT". Adds write_acpi_init_ret for it. Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/asus-laptop.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
index 013ab86b1c8d..7058cb56f338 100644
--- a/drivers/platform/x86/asus-laptop.c
+++ b/drivers/platform/x86/asus-laptop.c
@@ -352,8 +352,8 @@ static struct key_entry asus_keymap[] = {
352 * 352 *
353 * returns 0 if write is successful, -1 else. 353 * returns 0 if write is successful, -1 else.
354 */ 354 */
355static int write_acpi_int(acpi_handle handle, const char *method, int val, 355static int write_acpi_int_ret(acpi_handle handle, const char *method, int val,
356 struct acpi_buffer *output) 356 struct acpi_buffer *output)
357{ 357{
358 struct acpi_object_list params; /* list of input parameters (an int) */ 358 struct acpi_object_list params; /* list of input parameters (an int) */
359 union acpi_object in_obj; /* the only param we use */ 359 union acpi_object in_obj; /* the only param we use */
@@ -374,6 +374,11 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val,
374 return -1; 374 return -1;
375} 375}
376 376
377static int write_acpi_int(acpi_handle handle, const char *method, int val)
378{
379 return write_acpi_int_ret(handle, method, val, NULL);
380}
381
377static int read_wireless_status(int mask) 382static int read_wireless_status(int mask)
378{ 383{
379 unsigned long long status; 384 unsigned long long status;
@@ -437,7 +442,7 @@ static void write_status(acpi_handle handle, int out, int mask)
437 break; 442 break;
438 } 443 }
439 444
440 if (write_acpi_int(handle, NULL, out, NULL)) 445 if (write_acpi_int(handle, NULL, out))
441 pr_warning(" write failed %x\n", mask); 446 pr_warning(" write failed %x\n", mask);
442} 447}
443 448
@@ -496,7 +501,7 @@ static int set_kled_lvl(int kblv)
496 else 501 else
497 kblv = 0; 502 kblv = 0;
498 503
499 if (write_acpi_int(kled_set_handle, NULL, kblv, NULL)) { 504 if (write_acpi_int(kled_set_handle, NULL, kblv)) {
500 pr_warning("Keyboard LED display write failed\n"); 505 pr_warning("Keyboard LED display write failed\n");
501 return -EINVAL; 506 return -EINVAL;
502 } 507 }
@@ -571,7 +576,7 @@ static int read_brightness(struct backlight_device *bd)
571 576
572static int set_brightness(struct backlight_device *bd, int value) 577static int set_brightness(struct backlight_device *bd, int value)
573{ 578{
574 if (write_acpi_int(brightness_set_handle, NULL, value, NULL)) { 579 if (write_acpi_int(brightness_set_handle, NULL, value)) {
575 pr_warning("Error changing brightness\n"); 580 pr_warning("Error changing brightness\n");
576 return -EIO; 581 return -EIO;
577 } 582 }
@@ -710,7 +715,7 @@ static ssize_t store_ledd(struct device *dev, struct device_attribute *attr,
710 715
711 rv = parse_arg(buf, count, &value); 716 rv = parse_arg(buf, count, &value);
712 if (rv > 0) { 717 if (rv > 0) {
713 if (write_acpi_int(ledd_set_handle, NULL, value, NULL)) 718 if (write_acpi_int(ledd_set_handle, NULL, value))
714 pr_warning("LED display write failed\n"); 719 pr_warning("LED display write failed\n");
715 else 720 else
716 hotk->ledd_status = (u32) value; 721 hotk->ledd_status = (u32) value;
@@ -755,7 +760,7 @@ static ssize_t store_bluetooth(struct device *dev,
755static void set_display(int value) 760static void set_display(int value)
756{ 761{
757 /* no sanity check needed for now */ 762 /* no sanity check needed for now */
758 if (write_acpi_int(display_set_handle, NULL, value, NULL)) 763 if (write_acpi_int(display_set_handle, NULL, value))
759 pr_warning("Error setting display\n"); 764 pr_warning("Error setting display\n");
760 return; 765 return;
761} 766}
@@ -814,7 +819,7 @@ static ssize_t store_disp(struct device *dev, struct device_attribute *attr,
814 */ 819 */
815static void set_light_sens_switch(int value) 820static void set_light_sens_switch(int value)
816{ 821{
817 if (write_acpi_int(ls_switch_handle, NULL, value, NULL)) 822 if (write_acpi_int(ls_switch_handle, NULL, value))
818 pr_warning("Error setting light sensor switch\n"); 823 pr_warning("Error setting light sensor switch\n");
819 hotk->light_switch = value; 824 hotk->light_switch = value;
820} 825}
@@ -839,7 +844,7 @@ static ssize_t store_lssw(struct device *dev, struct device_attribute *attr,
839 844
840static void set_light_sens_level(int value) 845static void set_light_sens_level(int value)
841{ 846{
842 if (write_acpi_int(ls_level_handle, NULL, value, NULL)) 847 if (write_acpi_int(ls_level_handle, NULL, value))
843 pr_warning("Error setting light sensor level\n"); 848 pr_warning("Error setting light sensor level\n");
844 hotk->light_level = value; 849 hotk->light_level = value;
845} 850}
@@ -1104,7 +1109,7 @@ static int asus_hotk_get_info(void)
1104 pr_warning("Couldn't get the DSDT table header\n"); 1109 pr_warning("Couldn't get the DSDT table header\n");
1105 1110
1106 /* We have to write 0 on init this far for all ASUS models */ 1111 /* We have to write 0 on init this far for all ASUS models */
1107 if (write_acpi_int(hotk->handle, "INIT", 0, &buffer)) { 1112 if (write_acpi_int_ret(hotk->handle, "INIT", 0, &buffer)) {
1108 pr_err("Hotkey initialization failed\n"); 1113 pr_err("Hotkey initialization failed\n");
1109 return -ENODEV; 1114 return -ENODEV;
1110 } 1115 }
@@ -1119,7 +1124,7 @@ static int asus_hotk_get_info(void)
1119 (uint) bsts_result); 1124 (uint) bsts_result);
1120 1125
1121 /* This too ... */ 1126 /* This too ... */
1122 write_acpi_int(hotk->handle, "CWAP", wapf, NULL); 1127 write_acpi_int(hotk->handle, "CWAP", wapf);
1123 1128
1124 /* 1129 /*
1125 * Try to match the object returned by INIT to the specific model. 1130 * Try to match the object returned by INIT to the specific model.