From patchwork Tue Feb 2 07:39:01 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Chary X-Patchwork-Id: 76268 X-Patchwork-Delegate: lenb@kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o127dHPA023199 for ; Tue, 2 Feb 2010 07:40:45 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755731Ab0BBHko (ORCPT ); Tue, 2 Feb 2010 02:40:44 -0500 Received: from iksaif.net ([88.191.73.63]:57659 "EHLO iksaif.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755704Ab0BBHkn (ORCPT ); Tue, 2 Feb 2010 02:40:43 -0500 Received: from localhost.localdomain (lal69-3-82-241-209-44.fbx.proxad.net [82.241.209.44]) (Authenticated sender: corentincj@iksaif.net) by iksaif.net (Postfix) with ESMTPA id 9C1B6C900CB; Tue, 2 Feb 2010 08:40:37 +0100 (CET) From: Corentin Chary To: Len Brown Cc: linux-acpi@vger.kernel.org, acpi4asus-user@lists.sourceforge.net, Linux Kernel Mailing List , Corentin Chary Subject: [PATCH 18/28] asus-laptop: add error check for write_acpi_int calls Date: Tue, 2 Feb 2010 08:39:01 +0100 Message-Id: <1265096351-15239-19-git-send-email-corentincj@iksaif.net> X-Mailer: git-send-email 1.6.6.1 In-Reply-To: <1265096351-15239-18-git-send-email-corentincj@iksaif.net> References: <1265096351-15239-1-git-send-email-corentincj@iksaif.net> <1265096351-15239-2-git-send-email-corentincj@iksaif.net> <1265096351-15239-3-git-send-email-corentincj@iksaif.net> <1265096351-15239-4-git-send-email-corentincj@iksaif.net> <1265096351-15239-5-git-send-email-corentincj@iksaif.net> <1265096351-15239-6-git-send-email-corentincj@iksaif.net> <1265096351-15239-7-git-send-email-corentincj@iksaif.net> <1265096351-15239-8-git-send-email-corentincj@iksaif.net> <1265096351-15239-9-git-send-email-corentincj@iksaif.net> <1265096351-15239-10-git-send-email-corentincj@iksaif.net> <1265096351-15239-11-git-send-email-corentincj@iksaif.net> <1265096351-15239-12-git-send-email-corentincj@iksaif.net> <1265096351-15239-13-git-send-email-corentincj@iksaif.net> <1265096351-15239-14-git-send-email-corentincj@iksaif.net> <1265096351-15239-15-git-send-email-corentincj@iksaif.net> <1265096351-15239-16-git-send-email-corentincj@iksaif.net> <1265096351-15239-17-git-send-email-corentincj@iksaif.net> <1265096351-15239-18-git-send-email-corentincj@iksaif.net> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 02 Feb 2010 07:40:45 +0000 (UTC) diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c index 671fad9..aad6b93 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, } /* Generic LED function */ -static void asus_led_set(struct asus_laptop *asus, char *method, +static int asus_led_set(struct asus_laptop *asus, char *method, int value) { if (!strcmp(method, METHOD_MLED)) @@ -360,7 +360,7 @@ static void asus_led_set(struct asus_laptop *asus, char *method, else value = !!value; - write_acpi_int(asus->handle, method, value); + return write_acpi_int(asus->handle, method, value); } /* @@ -817,6 +817,15 @@ static int asus_wireless_status(struct asus_laptop *asus, int mask) /* * WLAN */ +static int asus_wlan_set(struct asus_laptop *asus, int status) +{ + if (write_acpi_int(asus->handle, METHOD_WLAN, !!status)) { + pr_warning("Error setting wlan status to %d", status); + return -EIO; + } + return 0; +} + static ssize_t show_wlan(struct device *dev, struct device_attribute *attr, char *buf) { @@ -836,6 +845,15 @@ static ssize_t store_wlan(struct device *dev, struct device_attribute *attr, /* * Bluetooth */ +static int asus_bluetooth_set(struct asus_laptop *asus, int status) +{ + if (write_acpi_int(asus->handle, METHOD_BLUETOOTH, !!status)) { + pr_warning("Error setting bluetooth status to %d", status); + return -EIO; + } + return 0; +} + static ssize_t show_bluetooth(struct device *dev, struct device_attribute *attr, char *buf) { @@ -1353,8 +1371,8 @@ static int asus_laptop_get_info(struct asus_laptop *asus) (uint) bsts_result); /* This too ... */ - write_acpi_int(asus->handle, "CWAP", wapf); - + if (write_acpi_int(asus->handle, "CWAP", wapf)) + pr_err("Error calling CWAP(%d)\n", wapf); /* * Try to match the object returned by INIT to the specific model. * 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) /* WLED and BLED are on by default */ if (bluetooth_status >= 0) - write_acpi_int(asus->handle, METHOD_BLUETOOTH, - !!bluetooth_status); + asus_bluetooth_set(asus, !!bluetooth_status); + if (wireless_status >= 0) - write_acpi_int(asus->handle, METHOD_WLAN, - !!wireless_status); + asus_wlan_set(asus, !!wireless_status); /* Keyboard Backlight is on by default */ if (!acpi_check_handle(asus->handle, METHOD_KBD_LIGHT_SET, NULL))