From patchwork Thu Mar 23 17:35:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 9641701 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2F53E602CA for ; Thu, 23 Mar 2017 17:35:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E8982841C for ; Thu, 23 Mar 2017 17:35:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11FBC28446; Thu, 23 Mar 2017 17:35:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2669283FD for ; Thu, 23 Mar 2017 17:35:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752128AbdCWRfu (ORCPT ); Thu, 23 Mar 2017 13:35:50 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:36478 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752063AbdCWRft (ORCPT ); Thu, 23 Mar 2017 13:35:49 -0400 Received: by mail-pg0-f66.google.com with SMTP id 81so29372177pgh.3; Thu, 23 Mar 2017 10:35:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=CSfebHJxnYTbmm1p+Gu2nluxxkfPU333Kfqt2gyWQps=; b=GuXl0f5AS8UrpWmBLd9w6DYGvsRyveHdWn3YRxtCi0Dotnw1sYPMCvWvz79ZmHEth9 Wj+OqIbcgRnarFCJlz/tfzbq5s5+zdDY2xHDZf8uTtoqzrfw+y60uhguLsCZMYaHPs3a +VIq+qRUUhp4DV2Wg+rKsYLDqhTUl0T0XXUJ/d0C1eKlgWevIG7P2YfdFgaUEnVOyEEC TIK34oR3KmAd7POuAx9DoWD+xc1SWvM7PqSa12pU/YoM0ZSI4OEHmlYBWx+rAEBp8ZRx 5pEbVRCdD1nYuy9vaZj+Oz96dPu3oUd4nYfHJJmPjbWXcURybRs8ZGYlhvrQJQsGB8I8 Ftug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=CSfebHJxnYTbmm1p+Gu2nluxxkfPU333Kfqt2gyWQps=; b=EiMVDZQuXThYS/g+0I5COQKS/Op43hrH+U1l8QMHe0VzK54ytmS7dKMpyZUY+IMGlv xluAhkOEYRvSBN2zx8TIJ/qwu43jSIFgEZV8GJCZPoTEv+H+LBOJQA6ioCcrEz+H0BSF PmQbQyJh/CtKhhwdC7MxZrhcTP5eErCrsNYs6FOZdlrxrbh7LxCCChN05q+XTzsa4P8q 9gD2KjPuSSrq/ykTWhiSupr4jbROix4Dj1wB5g4SFu9SZe5AULgyWToFccZwJGY2gmIU AkEBkLVn+VBAXFVQ4yPpbvel8b5gSmG+epUE7qTvvhtgZgRlgY4HM1PeqGJlppLkFC5j VOwg== X-Gm-Message-State: AFeK/H2JkHhL5G/l08HLc91x+LifZ7rEwjLutK2sbOP22OoN+0gpVzy0ZHoVQB7pj3xeBQ== X-Received: by 10.98.163.17 with SMTP id s17mr4332707pfe.61.1490290547805; Thu, 23 Mar 2017 10:35:47 -0700 (PDT) Received: from dtor-ws ([2620:0:1000:1311:d115:b690:9df1:584d]) by smtp.gmail.com with ESMTPSA id e7sm11600087pgp.2.2017.03.23.10.35.46 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 23 Mar 2017 10:35:47 -0700 (PDT) Date: Thu, 23 Mar 2017 10:35:45 -0700 From: Dmitry Torokhov To: linux-input@vger.kernel.org Cc: Benjamin Tissoires , Peter Hutterer , linux-kernel@vger.kernel.org Subject: [PATCH] Input: synaptics - do not mix logical and bitwise operations Message-ID: <20170323173545.GA29239@dtor-ws> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Let's stop using !!x to reduce value of trackstick button expression to 0/1 and use shift instead. This removes the following sparse warning: CHECK drivers/input/mouse/synaptics.c drivers/input/mouse/synaptics.c:943:79: warning: dubious: !x | y Also, the bits we are testing are not capabilities, so lets drop "_CAP" suffix from macro names. Signed-off-by: Dmitry Torokhov Reviewed-by: Benjamin Tissoires --- drivers/input/mouse/synaptics.c | 6 +++--- drivers/input/mouse/synaptics.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 86ed45bda7bb..dd6caa0e7e09 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c @@ -940,9 +940,9 @@ static void synaptics_report_ext_buttons(struct psmouse *psmouse, u8 pt_buttons; /* The trackstick expects at most 3 buttons */ - pt_buttons = SYN_CAP_EXT_BUTTON_STICK_L(hw->ext_buttons) | - SYN_CAP_EXT_BUTTON_STICK_R(hw->ext_buttons) << 1 | - SYN_CAP_EXT_BUTTON_STICK_M(hw->ext_buttons) << 2; + pt_buttons = SYN_EXT_BUTTON_STICK_L(hw->ext_buttons) | + SYN_EXT_BUTTON_STICK_R(hw->ext_buttons) << 1 | + SYN_EXT_BUTTON_STICK_M(hw->ext_buttons) << 2; serio_interrupt(priv->pt_port, PSMOUSE_OOB_EXTRA_BTNS, SERIO_OOB_DATA); diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h index fc93481cf183..31652d98b8f7 100644 --- a/drivers/input/mouse/synaptics.h +++ b/drivers/input/mouse/synaptics.h @@ -112,9 +112,9 @@ #define SYN_CAP_EXT_BUTTONS_STICK(ex10) ((ex10) & 0x010000) #define SYN_CAP_SECUREPAD(ex10) ((ex10) & 0x020000) -#define SYN_CAP_EXT_BUTTON_STICK_L(eb) (!!((eb) & 0x01)) -#define SYN_CAP_EXT_BUTTON_STICK_M(eb) (!!((eb) & 0x02)) -#define SYN_CAP_EXT_BUTTON_STICK_R(eb) (!!((eb) & 0x04)) +#define SYN_EXT_BUTTON_STICK_L(eb) (((eb) & BIT(0)) >> 0) +#define SYN_EXT_BUTTON_STICK_M(eb) (((eb) & BIT(1)) >> 1) +#define SYN_EXT_BUTTON_STICK_R(eb) (((eb) & BIT(2)) >> 2) /* synaptics modes query bits */ #define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7))