From patchwork Tue Apr 26 02:52:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Teng X-Patchwork-Id: 8934481 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A37D99F441 for ; Tue, 26 Apr 2016 02:54:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D34A72015A for ; Tue, 26 Apr 2016 02:54:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B904E20155 for ; Tue, 26 Apr 2016 02:54:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751322AbcDZCxw (ORCPT ); Mon, 25 Apr 2016 22:53:52 -0400 Received: from e34.co.us.ibm.com ([32.97.110.152]:54224 "EHLO e34.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751927AbcDZCxv (ORCPT ); Mon, 25 Apr 2016 22:53:51 -0400 Received: from localhost by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 25 Apr 2016 20:53:46 -0600 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e34.co.us.ibm.com (192.168.1.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 25 Apr 2016 20:53:45 -0600 X-IBM-Helo: d03dlp01.boulder.ibm.com X-IBM-MailFrom: rui.teng@linux.vnet.ibm.com X-IBM-RcptTo: linux-input@vger.kernel.org;linux-kernel@vger.kernel.org Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id CE8DA1FF001E; Mon, 25 Apr 2016 20:53:29 -0600 (MDT) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u3Q2riXj35913750; Tue, 26 Apr 2016 02:53:44 GMT Received: from d01av01.pok.ibm.com (localhost [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u3Q2rhmI012566; Mon, 25 Apr 2016 22:53:43 -0400 Received: from localhost (ruis-mbp.cn.ibm.com [9.123.229.155]) by d01av01.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u3Q2rg9k012494; Mon, 25 Apr 2016 22:53:43 -0400 From: Rui Teng To: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Cc: dmitry.torokhov@gmail.com, Rui Teng Subject: [PATCH] drivers/input: Macros with complex values should be enclosed in parentheses Date: Tue, 26 Apr 2016 10:52:50 +0800 Message-Id: <1461639170-1359-1-git-send-email-rui.teng@linux.vnet.ibm.com> X-Mailer: git-send-email 2.5.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16042602-0017-0000-0000-0000297E4273 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 The bitwise shift operator has lower priority than plus operator. So the values on macros should be enclosed in parentheses. For example, "(1 << 4 + 1)" means "(1 << (4 + 1))", but it is not expected by the macros. And also fix other two coding style problems reported by scripts/checkpatch.pl. Signed-off-by: Rui Teng --- drivers/input/keyboard/twl4030_keypad.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c index bbcccd6..8d061c0 100644 --- a/drivers/input/keyboard/twl4030_keypad.c +++ b/drivers/input/keyboard/twl4030_keypad.c @@ -61,9 +61,9 @@ struct twl4030_keypad { unsigned short keymap[TWL4030_KEYMAP_SIZE]; u16 kp_state[TWL4030_MAX_ROWS]; bool autorepeat; - unsigned n_rows; - unsigned n_cols; - unsigned irq; + unsigned int n_rows; + unsigned int n_cols; + unsigned int irq; struct device *dbg_dev; struct input_dev *input; @@ -110,7 +110,7 @@ struct twl4030_keypad { #define KEYP_CTRL_KBD_ON BIT(6) /* KEYP_DEB, KEYP_LONG_KEY, KEYP_TIMEOUT_x*/ -#define KEYP_PERIOD_US(t, prescale) ((t) / (31 << (prescale + 1)) - 1) +#define KEYP_PERIOD_US(t, prescale) ((t) / (31 << ((prescale) + 1)) - 1) /* KEYP_LK_PTV_REG Fields */ #define KEYP_LK_PTV_PTV_SHIFT 5 @@ -263,7 +263,8 @@ static irqreturn_t do_kp_irq(int irq, void *_kp) ret = twl4030_kpread(kp, ®, KEYP_ISR1, 1); /* Release all keys if I2C has gone bad or - * the KEYP has gone to idle state */ + * the KEYP has gone to idle state + */ if (ret >= 0 && (reg & KEYP_IMR1_KP)) twl4030_kp_scan(kp, false); else