aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorCorentin Chary <corentincj@iksaif.net>2010-01-17 11:20:11 -0500
committerCorentin Chary <corentincj@iksaif.net>2010-02-28 13:35:12 -0500
commite5593bf18be79b4897c7ec8b392dc7f07cbc1b11 (patch)
tree0c5b5576724a121b882e310cc5b8f41542acac65 /drivers/platform
parentd99b577c729c4a29679fb1f605f9ccace154e0e5 (diff)
asus-laptop: add error check for write_acpi_int calls
Also add to helpers for bluetooth and wlan. Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/asus-laptop.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
index 671fad96c275..aad6b9300f5d 100644
--- a/drivers/platform/x86/asus-laptop.c
+++ b/drivers/platform/x86/asus-laptop.c
@@ -350,7 +350,7 @@ static int acpi_check_handle(acpi_handle handle, const char *method,
350} 350}
351 351
352/* Generic LED function */ 352/* Generic LED function */
353static void asus_led_set(struct asus_laptop *asus, char *method, 353static int asus_led_set(struct asus_laptop *asus, char *method,
354 int value) 354 int value)
355{ 355{
356 if (!strcmp(method, METHOD_MLED)) 356 if (!strcmp(method, METHOD_MLED))
@@ -360,7 +360,7 @@ static void asus_led_set(struct asus_laptop *asus, char *method,
360 else 360 else
361 value = !!value; 361 value = !!value;
362 362
363 write_acpi_int(asus->handle, method, value); 363 return write_acpi_int(asus->handle, method, value);
364} 364}
365 365
366/* 366/*
@@ -817,6 +817,15 @@ static int asus_wireless_status(struct asus_laptop *asus, int mask)
817/* 817/*
818 * WLAN 818 * WLAN
819 */ 819 */
820static int asus_wlan_set(struct asus_laptop *asus, int status)
821{
822 if (write_acpi_int(asus->handle, METHOD_WLAN, !!status)) {
823 pr_warning("Error setting wlan status to %d", status);
824 return -EIO;
825 }
826 return 0;
827}
828
820static ssize_t show_wlan(struct device *dev, 829static ssize_t show_wlan(struct device *dev,
821 struct device_attribute *attr, char *buf) 830 struct device_attribute *attr, char *buf)
822{ 831{
@@ -836,6 +845,15 @@ static ssize_t store_wlan(struct device *dev, struct device_attribute *attr,
836/* 845/*
837 * Bluetooth 846 * Bluetooth
838 */ 847 */
848static int asus_bluetooth_set(struct asus_laptop *asus, int status)
849{
850 if (write_acpi_int(asus->handle, METHOD_BLUETOOTH, !!status)) {
851 pr_warning("Error setting bluetooth status to %d", status);
852 return -EIO;
853 }
854 return 0;
855}
856
839static ssize_t show_bluetooth(struct device *dev, 857static ssize_t show_bluetooth(struct device *dev,
840 struct device_attribute *attr, char *buf) 858 struct device_attribute *attr, char *buf)
841{ 859{
@@ -1353,8 +1371,8 @@ static int asus_laptop_get_info(struct asus_laptop *asus)
1353 (uint) bsts_result); 1371 (uint) bsts_result);
1354 1372
1355 /* This too ... */ 1373 /* This too ... */
1356 write_acpi_int(asus->handle, "CWAP", wapf); 1374 if (write_acpi_int(asus->handle, "CWAP", wapf))
1357 1375 pr_err("Error calling CWAP(%d)\n", wapf);
1358 /* 1376 /*
1359 * Try to match the object returned by INIT to the specific model. 1377 * Try to match the object returned by INIT to the specific model.
1360 * Handle every possible object (or the lack of thereof) the DSDT 1378 * Handle every possible object (or the lack of thereof) the DSDT
@@ -1426,11 +1444,10 @@ static int __devinit asus_acpi_init(struct asus_laptop *asus)
1426 1444
1427 /* WLED and BLED are on by default */ 1445 /* WLED and BLED are on by default */
1428 if (bluetooth_status >= 0) 1446 if (bluetooth_status >= 0)
1429 write_acpi_int(asus->handle, METHOD_BLUETOOTH, 1447 asus_bluetooth_set(asus, !!bluetooth_status);
1430 !!bluetooth_status); 1448
1431 if (wireless_status >= 0) 1449 if (wireless_status >= 0)
1432 write_acpi_int(asus->handle, METHOD_WLAN, 1450 asus_wlan_set(asus, !!wireless_status);
1433 !!wireless_status);
1434 1451
1435 /* Keyboard Backlight is on by default */ 1452 /* Keyboard Backlight is on by default */
1436 if (!acpi_check_handle(asus->handle, METHOD_KBD_LIGHT_SET, NULL)) 1453 if (!acpi_check_handle(asus->handle, METHOD_KBD_LIGHT_SET, NULL))