From patchwork Fri Jun 21 18:09:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerhard Sittig X-Patchwork-Id: 2763891 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 19546C0AB1 for ; Fri, 21 Jun 2013 18:27:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 27E8820215 for ; Fri, 21 Jun 2013 18:27:36 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3312E2020F for ; Fri, 21 Jun 2013 18:27:34 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uq5qP-0007LR-2t; Fri, 21 Jun 2013 18:13:59 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uq5ow-0002Cg-Du; Fri, 21 Jun 2013 18:12:26 +0000 Received: from mail-out.m-online.net ([212.18.0.9]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uq5nY-000238-3V for linux-arm-kernel@lists.infradead.org; Fri, 21 Jun 2013 18:11:01 +0000 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3bcSc71p7Bz4KK2P; Fri, 21 Jun 2013 20:10:15 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 3bcSc71MHmzbbhZ; Fri, 21 Jun 2013 20:10:15 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.180]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new, port 10024) with ESMTP id IedpqCTKYMH9; Fri, 21 Jun 2013 20:10:14 +0200 (CEST) X-Auth-Info: rHLjGIxG9YLBrasKBm7NbV+nvidnU5fFCvvt3kpjnSM= Received: from localhost (kons-4d027c0a.pool.mediaWays.net [77.2.124.10]) by mail.mnet-online.de (Postfix) with ESMTPA; Fri, 21 Jun 2013 20:10:13 +0200 (CEST) From: Gerhard Sittig To: Dmitry Torokhov , linux-input@vger.kernel.org, devicetree-discuss@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, Chao Xie Subject: [PATCH v1 02/12] input: matrix-keymap: func call coding style nit Date: Fri, 21 Jun 2013 20:09:48 +0200 Message-Id: <1371838198-7327-3-git-send-email-gsi@denx.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1371838198-7327-1-git-send-email-gsi@denx.de> References: <1371838198-7327-1-git-send-email-gsi@denx.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130621_141100_304872_05D49623 X-CRM114-Status: GOOD ( 10.78 ) X-Spam-Score: -1.9 (-) Cc: Eric Miao , Detlev Zundel , Arnd Bergmann , Tony Lindgren , Gerhard Sittig , Sekhar Nori , Haojian Zhuang , Marek Vasut , Ralf Baechle , Anatolij Gustschin X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP make the matrix_keypad_map_key() routine return an error code instead of boolean, as its name suggests an action and not a query Signed-off-by: Gerhard Sittig --- drivers/input/matrix-keymap.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/input/matrix-keymap.c b/drivers/input/matrix-keymap.c index 08b61f5..b7091f2 100644 --- a/drivers/input/matrix-keymap.c +++ b/drivers/input/matrix-keymap.c @@ -27,9 +27,10 @@ #include #include -static bool matrix_keypad_map_key(struct input_dev *input_dev, - unsigned int rows, unsigned int cols, - unsigned int row_shift, unsigned int key) +/* translates packed row/col/code specs to the corresponding keycode[] item */ +static int matrix_keypad_map_key(struct input_dev *input_dev, + unsigned int rows, unsigned int cols, + unsigned int row_shift, unsigned int key) { unsigned short *keymap = input_dev->keycode; unsigned int row = KEY_ROW(key); @@ -40,13 +41,13 @@ static bool matrix_keypad_map_key(struct input_dev *input_dev, dev_err(input_dev->dev.parent, "%s: invalid keymap entry 0x%x (row: %d, col: %d, rows: %d, cols: %d)\n", __func__, key, row, col, rows, cols); - return false; + return -ERANGE; } keymap[MATRIX_SCAN_CODE(row, col, row_shift)] = code; __set_bit(code, input_dev->keybit); - return true; + return 0; } #ifdef CONFIG_OF @@ -109,8 +110,8 @@ static int matrix_keypad_parse_of_keymap(const char *propname, for (i = 0; i < size; i++) { unsigned int key = be32_to_cpup(prop + i); - if (!matrix_keypad_map_key(input_dev, rows, cols, - row_shift, key)) + if (matrix_keypad_map_key(input_dev, rows, cols, + row_shift, key) != 0) return -EINVAL; } @@ -187,8 +188,8 @@ int matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data, for (i = 0; i < keymap_data->keymap_size; i++) { unsigned int key = keymap_data->keymap[i]; - if (!matrix_keypad_map_key(input_dev, rows, cols, - row_shift, key)) + if (matrix_keypad_map_key(input_dev, rows, cols, + row_shift, key) != 0) return -EINVAL; } } else {