From patchwork Fri Jun 19 12:52:08 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Chary X-Patchwork-Id: 31335 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 n5JCslIu015214 for ; Fri, 19 Jun 2009 12:54:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754280AbZFSMyr (ORCPT ); Fri, 19 Jun 2009 08:54:47 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754090AbZFSMyr (ORCPT ); Fri, 19 Jun 2009 08:54:47 -0400 Received: from smtp21.orange.fr ([80.12.242.49]:23098 "EHLO smtp21.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754645AbZFSMyn (ORCPT ); Fri, 19 Jun 2009 08:54:43 -0400 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2121.orange.fr (SMTP Server) with ESMTP id CA28B1C000A1; Fri, 19 Jun 2009 14:54:44 +0200 (CEST) Received: from localhost.localdomain (ALyon-253-1-96-48.w86-206.abo.wanadoo.fr [86.206.191.48]) by mwinf2121.orange.fr (SMTP Server) with ESMTP id 69B701C000AA; Fri, 19 Jun 2009 14:54:44 +0200 (CEST) X-ME-UUID: 20090619125444433.69B701C000AA@mwinf2121.orange.fr From: Corentin Chary To: lenb@kernel.org Cc: linux-acpi@vger.kernel.org, Corentin Chary Subject: [PATCH 6/9] eeepc-laptop: makes get_acpi() returns -ENODEV Date: Fri, 19 Jun 2009 14:52:08 +0200 Message-Id: <1245415931-26466-6-git-send-email-corentincj@iksaif.net> X-Mailer: git-send-email 1.6.3.1 In-Reply-To: <1245415931-26466-5-git-send-email-corentincj@iksaif.net> References: <1245415931-26466-1-git-send-email-corentincj@iksaif.net> <1245415931-26466-2-git-send-email-corentincj@iksaif.net> <1245415931-26466-3-git-send-email-corentincj@iksaif.net> <1245415931-26466-4-git-send-email-corentincj@iksaif.net> <1245415931-26466-5-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 If there is there is no getter defined, get_acpi() will return -ENODEV. Signed-off-by: Corentin Chary --- drivers/platform/x86/eeepc-laptop.c | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index aad5d16..b1998f9 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c @@ -287,7 +287,7 @@ static int set_acpi(int cm, int value) static int get_acpi(int cm) { - int value = -1; + int value = -ENODEV; if ((ehotk->cm_supported & (0x1 << cm))) { const char *method = cm_getv[cm]; if (method == NULL) @@ -365,13 +365,19 @@ static ssize_t store_sys_acpi(int cm, const char *buf, size_t count) rv = parse_arg(buf, count, &value); if (rv > 0) - set_acpi(cm, value); + value = set_acpi(cm, value); + if (value < 0) + return value; return rv; } static ssize_t show_sys_acpi(int cm, char *buf) { - return sprintf(buf, "%d\n", get_acpi(cm)); + int value = get_acpi(cm); + + if (value < 0) + return value; + return sprintf(buf, "%d\n", value); } #define EEEPC_CREATE_DEVICE_ATTR(_name, _cm) \ @@ -1003,8 +1009,9 @@ static int eeepc_new_rfkill(struct rfkill **rfkill, { int result; - if (get_acpi(cm) == -1) - return -ENODEV; + result = get_acpi(cm); + if (result < 0) + return result; *rfkill = rfkill_alloc(name, dev, type, &eeepc_rfkill_ops, (void *)(unsigned long)cm);