diff options
author | Corentin CHARY <corentincj@iksaif.net> | 2008-01-16 10:56:42 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-02-07 00:37:37 -0500 |
commit | f8d1c94b346b62747322728e00e11f552cd90902 (patch) | |
tree | a202cc7ffd0ed676682ff050ed43f9f900b7824b /drivers/misc | |
parent | 488b5ec871191359b9b79262a3d48456dae7ea5f (diff) |
asus-laptop new write_acpi_int
Just a little modification of write_acpi_int
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/asus-laptop.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c index 0846c33296bc..34666ff60d37 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 | */ |
259 | static int write_acpi_int(acpi_handle handle, const char *method, int val, | 259 | static 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, ¶ms, output); | 274 | status = acpi_evaluate_object(handle, (char *)method, ¶ms, output); |
272 | return (status == AE_OK); | 275 | if (status == AE_OK) |
276 | return 0; | ||
277 | else | ||
278 | return -1; | ||
273 | } | 279 | } |
274 | 280 | ||
275 | static int read_wireless_status(int mask) | 281 | static int read_wireless_status(int mask) |
@@ -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, | |||
590 | static void set_display(int value) | 596 | static 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 | */ |
648 | static void set_light_sens_switch(int value) | 654 | static 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 | ||
673 | static void set_light_sens_level(int value) | 679 | static 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 | } |