diff options
author | Corentin Chary <corentincj@iksaif.net> | 2007-03-11 05:25:38 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-03-11 15:44:36 -0400 |
commit | 9a8168500674b1062afe438d34d0c8216d38dc31 (patch) | |
tree | d3426f886ca98599862320666094f204bab95b07 /drivers/misc/asus-laptop.c | |
parent | be521466feb3bb1cd89de82a2b1d080e9ebd3cb6 (diff) |
asus-laptop: use acpi_evaluate_integer instead of read_acpi_int
Use acpi_evaluate_integer() instead of read_acpi_int()
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/misc/asus-laptop.c')
-rw-r--r-- | drivers/misc/asus-laptop.c | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c index 4b232124a1ab..dcab778a91c5 100644 --- a/drivers/misc/asus-laptop.c +++ b/drivers/misc/asus-laptop.c | |||
@@ -245,32 +245,19 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val, | |||
245 | return (status == AE_OK); | 245 | return (status == AE_OK); |
246 | } | 246 | } |
247 | 247 | ||
248 | static int read_acpi_int(acpi_handle handle, const char *method, int *val, | ||
249 | struct acpi_object_list *params) | ||
250 | { | ||
251 | struct acpi_buffer output; | ||
252 | union acpi_object out_obj; | ||
253 | acpi_status status; | ||
254 | |||
255 | output.length = sizeof(out_obj); | ||
256 | output.pointer = &out_obj; | ||
257 | |||
258 | status = acpi_evaluate_object(handle, (char *)method, params, &output); | ||
259 | *val = out_obj.integer.value; | ||
260 | return (status == AE_OK) && (out_obj.type == ACPI_TYPE_INTEGER); | ||
261 | } | ||
262 | |||
263 | static int read_wireless_status(int mask) | 248 | static int read_wireless_status(int mask) |
264 | { | 249 | { |
265 | int status; | 250 | ulong status; |
251 | acpi_status rv = AE_OK; | ||
266 | 252 | ||
267 | if (!wireless_status_handle) | 253 | if (!wireless_status_handle) |
268 | return (hotk->status & mask) ? 1 : 0; | 254 | return (hotk->status & mask) ? 1 : 0; |
269 | 255 | ||
270 | if (read_acpi_int(wireless_status_handle, NULL, &status, NULL)) { | 256 | rv = acpi_evaluate_integer(wireless_status_handle, NULL, NULL, &status); |
271 | return (status & mask) ? 1 : 0; | 257 | if (ACPI_FAILURE(rv)) |
272 | } else | ||
273 | printk(ASUS_WARNING "Error reading Wireless status\n"); | 258 | printk(ASUS_WARNING "Error reading Wireless status\n"); |
259 | else | ||
260 | return (status & mask) ? 1 : 0; | ||
274 | 261 | ||
275 | return (hotk->status & mask) ? 1 : 0; | 262 | return (hotk->status & mask) ? 1 : 0; |
276 | } | 263 | } |
@@ -354,9 +341,11 @@ static void lcd_blank(int blank) | |||
354 | 341 | ||
355 | static int read_brightness(struct backlight_device *bd) | 342 | static int read_brightness(struct backlight_device *bd) |
356 | { | 343 | { |
357 | int value; | 344 | ulong value; |
345 | acpi_status rv = AE_OK; | ||
358 | 346 | ||
359 | if (!read_acpi_int(brightness_get_handle, NULL, &value, NULL)) | 347 | rv = acpi_evaluate_integer(brightness_get_handle, NULL, NULL, &value); |
348 | if (ACPI_FAILURE(rv)) | ||
360 | printk(ASUS_WARNING "Error reading brightness\n"); | 349 | printk(ASUS_WARNING "Error reading brightness\n"); |
361 | 350 | ||
362 | return value; | 351 | return value; |
@@ -403,8 +392,10 @@ static ssize_t show_infos(struct device *dev, | |||
403 | struct device_attribute *attr, char *page) | 392 | struct device_attribute *attr, char *page) |
404 | { | 393 | { |
405 | int len = 0; | 394 | int len = 0; |
406 | int temp; | 395 | ulong temp; |
407 | char buf[16]; //enough for all info | 396 | char buf[16]; //enough for all info |
397 | acpi_status rv = AE_OK; | ||
398 | |||
408 | /* | 399 | /* |
409 | * We use the easy way, we don't care of off and count, so we don't set eof | 400 | * We use the easy way, we don't care of off and count, so we don't set eof |
410 | * to 1 | 401 | * to 1 |
@@ -418,9 +409,10 @@ static ssize_t show_infos(struct device *dev, | |||
418 | * bit signifies that the laptop is equipped with a Wi-Fi MiniPCI card. | 409 | * bit signifies that the laptop is equipped with a Wi-Fi MiniPCI card. |
419 | * The significance of others is yet to be found. | 410 | * The significance of others is yet to be found. |
420 | */ | 411 | */ |
421 | if (read_acpi_int(hotk->handle, "SFUN", &temp, NULL)) | 412 | rv = acpi_evaluate_integer(hotk->handle, "SFUN", NULL, &temp); |
422 | len += | 413 | if (!ACPI_FAILURE(rv)) |
423 | sprintf(page + len, "SFUN value : 0x%04x\n", temp); | 414 | len += sprintf(page + len, "SFUN value : 0x%04x\n", |
415 | (uint) temp); | ||
424 | /* | 416 | /* |
425 | * Another value for userspace: the ASYM method returns 0x02 for | 417 | * Another value for userspace: the ASYM method returns 0x02 for |
426 | * battery low and 0x04 for battery critical, its readings tend to be | 418 | * battery low and 0x04 for battery critical, its readings tend to be |
@@ -428,9 +420,10 @@ static ssize_t show_infos(struct device *dev, | |||
428 | * Note: since not all the laptops provide this method, errors are | 420 | * Note: since not all the laptops provide this method, errors are |
429 | * silently ignored. | 421 | * silently ignored. |
430 | */ | 422 | */ |
431 | if (read_acpi_int(hotk->handle, "ASYM", &temp, NULL)) | 423 | rv = acpi_evaluate_integer(hotk->handle, "ASYM", NULL, &temp); |
432 | len += | 424 | if (!ACPI_FAILURE(rv)) |
433 | sprintf(page + len, "ASYM value : 0x%04x\n", temp); | 425 | len += sprintf(page + len, "ASYM value : 0x%04x\n", |
426 | (uint) temp); | ||
434 | if (asus_info) { | 427 | if (asus_info) { |
435 | snprintf(buf, 16, "%d", asus_info->length); | 428 | snprintf(buf, 16, "%d", asus_info->length); |
436 | len += sprintf(page + len, "DSDT length : %s\n", buf); | 429 | len += sprintf(page + len, "DSDT length : %s\n", buf); |
@@ -547,12 +540,15 @@ static void set_display(int value) | |||
547 | 540 | ||
548 | static int read_display(void) | 541 | static int read_display(void) |
549 | { | 542 | { |
550 | int value = 0; | 543 | ulong value = 0; |
544 | acpi_status rv = AE_OK; | ||
551 | 545 | ||
552 | /* In most of the case, we know how to set the display, but sometime | 546 | /* In most of the case, we know how to set the display, but sometime |
553 | we can't read it */ | 547 | we can't read it */ |
554 | if (display_get_handle) { | 548 | if (display_get_handle) { |
555 | if (!read_acpi_int(display_get_handle, NULL, &value, NULL)) | 549 | rv = acpi_evaluate_integer(display_get_handle, NULL, |
550 | NULL, &value); | ||
551 | if (ACPI_FAILURE(rv)) | ||
556 | printk(ASUS_WARNING "Error reading display status\n"); | 552 | printk(ASUS_WARNING "Error reading display status\n"); |
557 | } | 553 | } |
558 | 554 | ||
@@ -771,7 +767,7 @@ static int asus_hotk_get_info(void) | |||
771 | { | 767 | { |
772 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 768 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
773 | union acpi_object *model = NULL; | 769 | union acpi_object *model = NULL; |
774 | int bsts_result, hwrs_result; | 770 | ulong bsts_result, hwrs_result; |
775 | char *string = NULL; | 771 | char *string = NULL; |
776 | acpi_status status; | 772 | acpi_status status; |
777 | 773 | ||
@@ -794,11 +790,13 @@ static int asus_hotk_get_info(void) | |||
794 | } | 790 | } |
795 | 791 | ||
796 | /* This needs to be called for some laptops to init properly */ | 792 | /* This needs to be called for some laptops to init properly */ |
797 | if (!read_acpi_int(hotk->handle, "BSTS", &bsts_result, NULL)) | 793 | status = |
794 | acpi_evaluate_integer(hotk->handle, "BSTS", NULL, &bsts_result); | ||
795 | if (ACPI_FAILURE(status)) | ||
798 | printk(ASUS_WARNING "Error calling BSTS\n"); | 796 | printk(ASUS_WARNING "Error calling BSTS\n"); |
799 | else if (bsts_result) | 797 | else if (bsts_result) |
800 | printk(ASUS_NOTICE "BSTS called, 0x%02x returned\n", | 798 | printk(ASUS_NOTICE "BSTS called, 0x%02x returned\n", |
801 | bsts_result); | 799 | (uint) bsts_result); |
802 | 800 | ||
803 | /* | 801 | /* |
804 | * Try to match the object returned by INIT to the specific model. | 802 | * Try to match the object returned by INIT to the specific model. |
@@ -840,7 +838,9 @@ static int asus_hotk_get_info(void) | |||
840 | * The significance of others is yet to be found. | 838 | * The significance of others is yet to be found. |
841 | * If we don't find the method, we assume the device are present. | 839 | * If we don't find the method, we assume the device are present. |
842 | */ | 840 | */ |
843 | if (!read_acpi_int(hotk->handle, "HRWS", &hwrs_result, NULL)) | 841 | status = |
842 | acpi_evaluate_integer(hotk->handle, "HRWS", NULL, &hwrs_result); | ||
843 | if (ACPI_FAILURE(status)) | ||
844 | hwrs_result = WL_HWRS | BT_HWRS; | 844 | hwrs_result = WL_HWRS | BT_HWRS; |
845 | 845 | ||
846 | if (hwrs_result & WL_HWRS) | 846 | if (hwrs_result & WL_HWRS) |