From patchwork Sat Oct 9 11:37:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12547519 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABB39C433F5 for ; Sat, 9 Oct 2021 11:37:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8CEB760F39 for ; Sat, 9 Oct 2021 11:37:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232519AbhJILjT (ORCPT ); Sat, 9 Oct 2021 07:39:19 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:38699 "EHLO wout2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232960AbhJILjS (ORCPT ); Sat, 9 Oct 2021 07:39:18 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 50DE63200DA8; Sat, 9 Oct 2021 07:37:21 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sat, 09 Oct 2021 07:37:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alistair23.me; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=3mNRLjHegM/+z sOwmvU7YPcMf59k7n3IQSmcunFOm/k=; b=2oUdJxfvt4ge/cMZKSPjZ42LwtUsl ijUvpLsPwFaih0hmZSt+N0oih+aUMjuYtsG6oCjup+D9+beLyg4tCrrH8GSf+2x4 h7g8POaDsmr0NBuHtUT2H12wW2Mdb2hjv99bgHhqG8WinR5+IPk3FTjY0OJue3y3 dw2zsKYK0zxsUDpzqHkj9TTwAGJLPyck6sAk1pTHII+CeNWeus+I2WOnOHgXOoVf 4NYnd4DdKQBgmUWtQpdmSbXhad7fLy8g5aWEWsAzNTFLOA1Ml2aeJm3piIHEFBHH XiEax6djYHgAzWEGNDK4b/kPC1MIDogaHqjtPFRcRtoY0JuKWStfRd7HQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=3mNRLjHegM/+zsOwmvU7YPcMf59k7n3IQSmcunFOm/k=; b=lAvxDR+0 3qGUQv+W5D9bnygahUXFVLlbRVaBUuu508MhZ20EUU4KOQuDlmXLCP+GxS20s+4N bxr1OFXmoMPxP76cHmOOjJO3AXPzGAPSE7pHenudP8qi/IgIz9+8XmIL++SqHzD2 o+qso7GSeSc/IHa6JVzzJZtmYpqlC6/qgHoICJSSL3KqZxrsVAxrsTjykU2irNFZ IdE9eNBR6+J2eiDZgrl77Zo1lAscUFFiEpAYwJAJyMVav64kdocSvpAEijrce+BL 1VrHFS6ykQX1dQbD8Uy7I+Rda4kxukL2xxk4Roi076iRIs159jiTXYUGq8TNmKpO Cf4M+MsxvLdNxA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddtvddggeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlihhsthgrihhrucfhrhgrnhgtihhsuceorghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgvqeenucggtffrrghtthgvrhhnpeeggedtteejke eggeeugfehueevudegvdetjeeviedugedvtdekffekhedtteduhfenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlih hsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 9 Oct 2021 07:37:18 -0400 (EDT) From: Alistair Francis To: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Cc: alistair@alistair23.me, alistair23@gmail.com Subject: [PATCH 2/2] Input: wacom_i2c - Use macros for the bit masks Date: Sat, 9 Oct 2021 21:37:07 +1000 Message-Id: <20211009113707.17568-2-alistair@alistair23.me> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211009113707.17568-1-alistair@alistair23.me> References: <20211009113707.17568-1-alistair@alistair23.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org To make the code easier to read use macros for the bit masks. Signed-off-by: Alistair Francis --- drivers/input/touchscreen/wacom_i2c.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/input/touchscreen/wacom_i2c.c b/drivers/input/touchscreen/wacom_i2c.c index 8d7267ccc661..6865342db659 100644 --- a/drivers/input/touchscreen/wacom_i2c.c +++ b/drivers/input/touchscreen/wacom_i2c.c @@ -14,6 +14,12 @@ #include #include +// Bitmasks (for data[3]) +#define WACOM_TIP_SWITCH_bm (1 << 0) +#define WACOM_BARREL_SWITCH_bm (1 << 1) +#define WACOM_ERASER_bm (1 << 2) +#define WACOM_BARREL_SWITCH_2_bm (1 << 4) + // Registers #define WACOM_COMMAND_LSB 0x04 #define WACOM_COMMAND_MSB 0x00 @@ -110,10 +116,10 @@ static irqreturn_t wacom_i2c_irq(int irq, void *dev_id) if (error < 0) goto out; - tsw = data[3] & 0x01; - ers = data[3] & 0x04; - f1 = data[3] & 0x02; - f2 = data[3] & 0x10; + tsw = data[3] & WACOM_TIP_SWITCH_bm; + ers = data[3] & WACOM_ERASER_bm; + f1 = data[3] & WACOM_BARREL_SWITCH_bm; + f2 = data[3] & WACOM_BARREL_SWITCH_2_bm; x = le16_to_cpup((__le16 *)&data[4]); y = le16_to_cpup((__le16 *)&data[6]); pressure = le16_to_cpup((__le16 *)&data[8]);