From patchwork Thu Dec 3 07:44:59 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Chary X-Patchwork-Id: 64437 X-Patchwork-Delegate: lenb@kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nB37id5c000819 for ; Thu, 3 Dec 2009 07:44:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751020AbZLCHoo (ORCPT ); Thu, 3 Dec 2009 02:44:44 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754729AbZLCHoo (ORCPT ); Thu, 3 Dec 2009 02:44:44 -0500 Received: from iksaif.net ([88.191.73.63]:44220 "EHLO iksaif.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751020AbZLCHof (ORCPT ); Thu, 3 Dec 2009 02:44:35 -0500 Received: from localhost.localdomain (cxr69-11-88-180-139-205.fbx.proxad.net [88.180.139.205]) (Authenticated sender: corentincj@iksaif.net) by iksaif.net (Postfix) with ESMTPA id 5A288C90AB2; Thu, 3 Dec 2009 08:46:05 +0100 (CET) From: Corentin Chary To: Len Brown Cc: linux-acpi@vger.kernel.org, Alan Jenkins Subject: [PATCH 15/33] eeepc-laptop: fix set_acpi() to return non-zero on failure Date: Thu, 3 Dec 2009 08:44:59 +0100 Message-Id: <1259826317-18809-16-git-send-email-corentincj@iksaif.net> X-Mailer: git-send-email 1.6.5.3 In-Reply-To: <1259826317-18809-15-git-send-email-corentincj@iksaif.net> References: <1259826317-18809-1-git-send-email-corentincj@iksaif.net> <1259826317-18809-2-git-send-email-corentincj@iksaif.net> <1259826317-18809-3-git-send-email-corentincj@iksaif.net> <1259826317-18809-4-git-send-email-corentincj@iksaif.net> <1259826317-18809-5-git-send-email-corentincj@iksaif.net> <1259826317-18809-6-git-send-email-corentincj@iksaif.net> <1259826317-18809-7-git-send-email-corentincj@iksaif.net> <1259826317-18809-8-git-send-email-corentincj@iksaif.net> <1259826317-18809-9-git-send-email-corentincj@iksaif.net> <1259826317-18809-10-git-send-email-corentincj@iksaif.net> <1259826317-18809-11-git-send-email-corentincj@iksaif.net> <1259826317-18809-12-git-send-email-corentincj@iksaif.net> <1259826317-18809-13-git-send-email-corentincj@iksaif.net> <1259826317-18809-14-git-send-email-corentincj@iksaif.net> <1259826317-18809-15-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 diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index 8b686b5..abd7389 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c @@ -289,26 +289,30 @@ static int read_acpi_int(acpi_handle handle, const char *method, int *val) static int set_acpi(int cm, int value) { - if (ehotk->cm_supported & (0x1 << cm)) { - const char *method = cm_setv[cm]; - if (method == NULL) - return -ENODEV; - if (write_acpi_int(ehotk->handle, method, value, NULL)) - pr_warning("Error writing %s\n", method); - } + const char *method = cm_setv[cm]; + + if (method == NULL) + return -ENODEV; + if ((ehotk->cm_supported & (0x1 << cm)) == 0) + return -ENODEV; + + if (write_acpi_int(ehotk->handle, method, value, NULL)) + pr_warning("Error writing %s\n", method); return 0; } static int get_acpi(int cm) { - int value = -ENODEV; - if ((ehotk->cm_supported & (0x1 << cm))) { - const char *method = cm_getv[cm]; - if (method == NULL) - return -ENODEV; - if (read_acpi_int(ehotk->handle, method, &value)) - pr_warning("Error reading %s\n", method); - } + const char *method = cm_getv[cm]; + int value; + + if (method == NULL) + return -ENODEV; + if ((ehotk->cm_supported & (0x1 << cm)) == 0) + return -ENODEV; + + if (read_acpi_int(ehotk->handle, method, &value)) + pr_warning("Error reading %s\n", method); return value; }