aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/asus-laptop.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 12:45:58 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 12:45:58 -0500
commitf0f1b3364ae7f48084bdf2837fb979ff59622523 (patch)
treee5ef68c0071f44178cc8d1948b64e216d57422aa /drivers/misc/asus-laptop.c
parent4383f18b7f94a4d668c5eec68645c75d44556235 (diff)
parentb7143156c9ceee1a072c57aac8729d2dec5b3bf1 (diff)
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (112 commits) ACPI: fix build warning Revert "cpuidle: build fix for non-x86" ACPI: update intrd DSDT override console messages ACPI: update DSDT override documentation ACPI: Add "acpi_no_initrd_override" kernel parameter ACPI: its a directory not a folder.... ACPI: misc cleanups ACPI: add missing prink prefix strings ACPI: cleanup acpi.h ACPICA: fix CONFIG_ACPI_DEBUG_FUNC_TRACE build ACPI: video: Ignore ACPI video devices that aren't present in hardware ACPI: video: reset brightness on resume ACPI: video: call ACPI notifier chain for ACPI video notifications ACPI: create notifier chain to get hotkey events to graphics driver ACPI: video: delete unused display switch on hotkey event code ACPI: video: create "brightness_switch_enabled" modparam cpuidle: Add a poll_idle method ACPI: cpuidle: Support C1 idle time accounting ACPI: enable MWAIT for C1 idle ACPI: idle: Fix acpi_safe_halt usages and interrupt enabling/disabling ...
Diffstat (limited to 'drivers/misc/asus-laptop.c')
-rw-r--r--drivers/misc/asus-laptop.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c
index 3a36a294e91b..7c6dfd03de9f 100644
--- a/drivers/misc/asus-laptop.c
+++ b/drivers/misc/asus-laptop.c
@@ -254,7 +254,7 @@ ASUS_LED(gled, "gaming");
254 * method is searched within the scope of the handle, can be NULL. The output 254 * method is searched within the scope of the handle, can be NULL. The output
255 * of the method is written is output, which can also be NULL 255 * of the method is written is output, which can also be NULL
256 * 256 *
257 * returns 1 if write is successful, 0 else. 257 * returns 0 if write is successful, -1 else.
258 */ 258 */
259static int write_acpi_int(acpi_handle handle, const char *method, int val, 259static int write_acpi_int(acpi_handle handle, const char *method, int val,
260 struct acpi_buffer *output) 260 struct acpi_buffer *output)
@@ -263,13 +263,19 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val,
263 union acpi_object in_obj; //the only param we use 263 union acpi_object in_obj; //the only param we use
264 acpi_status status; 264 acpi_status status;
265 265
266 if (!handle)
267 return 0;
268
266 params.count = 1; 269 params.count = 1;
267 params.pointer = &in_obj; 270 params.pointer = &in_obj;
268 in_obj.type = ACPI_TYPE_INTEGER; 271 in_obj.type = ACPI_TYPE_INTEGER;
269 in_obj.integer.value = val; 272 in_obj.integer.value = val;
270 273
271 status = acpi_evaluate_object(handle, (char *)method, &params, output); 274 status = acpi_evaluate_object(handle, (char *)method, &params, output);
272 return (status == AE_OK); 275 if (status == AE_OK)
276 return 0;
277 else
278 return -1;
273} 279}
274 280
275static int read_wireless_status(int mask) 281static int read_wireless_status(int mask)
@@ -321,7 +327,7 @@ static void write_status(acpi_handle handle, int out, int mask)
321 327
322 switch (mask) { 328 switch (mask) {
323 case MLED_ON: 329 case MLED_ON:
324 out = !out & 0x1; 330 out = !(out & 0x1);
325 break; 331 break;
326 case GLED_ON: 332 case GLED_ON:
327 out = (out & 0x1) + 1; 333 out = (out & 0x1) + 1;
@@ -335,7 +341,7 @@ static void write_status(acpi_handle handle, int out, int mask)
335 break; 341 break;
336 } 342 }
337 343
338 if (handle && !write_acpi_int(handle, NULL, out, NULL)) 344 if (write_acpi_int(handle, NULL, out, NULL))
339 printk(ASUS_WARNING " write failed %x\n", mask); 345 printk(ASUS_WARNING " write failed %x\n", mask);
340} 346}
341 347
@@ -415,7 +421,7 @@ static int set_brightness(struct backlight_device *bd, int value)
415 value = (0 < value) ? ((15 < value) ? 15 : value) : 0; 421 value = (0 < value) ? ((15 < value) ? 15 : value) : 0;
416 /* 0 <= value <= 15 */ 422 /* 0 <= value <= 15 */
417 423
418 if (!write_acpi_int(brightness_set_handle, NULL, value, NULL)) { 424 if (write_acpi_int(brightness_set_handle, NULL, value, NULL)) {
419 printk(ASUS_WARNING "Error changing brightness\n"); 425 printk(ASUS_WARNING "Error changing brightness\n");
420 ret = -EIO; 426 ret = -EIO;
421 } 427 }
@@ -545,7 +551,7 @@ static ssize_t store_ledd(struct device *dev, struct device_attribute *attr,
545 551
546 rv = parse_arg(buf, count, &value); 552 rv = parse_arg(buf, count, &value);
547 if (rv > 0) { 553 if (rv > 0) {
548 if (!write_acpi_int(ledd_set_handle, NULL, value, NULL)) 554 if (write_acpi_int(ledd_set_handle, NULL, value, NULL))
549 printk(ASUS_WARNING "LED display write failed\n"); 555 printk(ASUS_WARNING "LED display write failed\n");
550 else 556 else
551 hotk->ledd_status = (u32) value; 557 hotk->ledd_status = (u32) value;
@@ -590,7 +596,7 @@ static ssize_t store_bluetooth(struct device *dev,
590static void set_display(int value) 596static void set_display(int value)
591{ 597{
592 /* no sanity check needed for now */ 598 /* no sanity check needed for now */
593 if (!write_acpi_int(display_set_handle, NULL, value, NULL)) 599 if (write_acpi_int(display_set_handle, NULL, value, NULL))
594 printk(ASUS_WARNING "Error setting display\n"); 600 printk(ASUS_WARNING "Error setting display\n");
595 return; 601 return;
596} 602}
@@ -647,7 +653,7 @@ static ssize_t store_disp(struct device *dev, struct device_attribute *attr,
647 */ 653 */
648static void set_light_sens_switch(int value) 654static void set_light_sens_switch(int value)
649{ 655{
650 if (!write_acpi_int(ls_switch_handle, NULL, value, NULL)) 656 if (write_acpi_int(ls_switch_handle, NULL, value, NULL))
651 printk(ASUS_WARNING "Error setting light sensor switch\n"); 657 printk(ASUS_WARNING "Error setting light sensor switch\n");
652 hotk->light_switch = value; 658 hotk->light_switch = value;
653} 659}
@@ -672,7 +678,7 @@ static ssize_t store_lssw(struct device *dev, struct device_attribute *attr,
672 678
673static void set_light_sens_level(int value) 679static void set_light_sens_level(int value)
674{ 680{
675 if (!write_acpi_int(ls_level_handle, NULL, value, NULL)) 681 if (write_acpi_int(ls_level_handle, NULL, value, NULL))
676 printk(ASUS_WARNING "Error setting light sensor level\n"); 682 printk(ASUS_WARNING "Error setting light sensor level\n");
677 hotk->light_level = value; 683 hotk->light_level = value;
678} 684}
@@ -860,7 +866,7 @@ static int asus_hotk_get_info(void)
860 printk(ASUS_WARNING "Couldn't get the DSDT table header\n"); 866 printk(ASUS_WARNING "Couldn't get the DSDT table header\n");
861 867
862 /* We have to write 0 on init this far for all ASUS models */ 868 /* We have to write 0 on init this far for all ASUS models */
863 if (!write_acpi_int(hotk->handle, "INIT", 0, &buffer)) { 869 if (write_acpi_int(hotk->handle, "INIT", 0, &buffer)) {
864 printk(ASUS_ERR "Hotkey initialization failed\n"); 870 printk(ASUS_ERR "Hotkey initialization failed\n");
865 return -ENODEV; 871 return -ENODEV;
866 } 872 }