From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: linux-input@vger.kernel.org
Cc: Alexander Sverdlin <alexander.sverdlin@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/4] Input: ep93xx_keypad - use BIT() and GENMASK() macros
Date: Mon, 11 Oct 2021 18:37:33 -0700 [thread overview]
Message-ID: <20211012013735.3523140-2-dmitry.torokhov@gmail.com> (raw)
In-Reply-To: <20211012013735.3523140-1-dmitry.torokhov@gmail.com>
Also drop parenthesis around macros that do not use expressions as they are
not needed.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/keyboard/ep93xx_keypad.c | 37 +++++++++++++-------------
1 file changed, 19 insertions(+), 18 deletions(-)
diff --git a/drivers/input/keyboard/ep93xx_keypad.c b/drivers/input/keyboard/ep93xx_keypad.c
index a0c6cdf8e0d3..6be5474ba2f2 100644
--- a/drivers/input/keyboard/ep93xx_keypad.c
+++ b/drivers/input/keyboard/ep93xx_keypad.c
@@ -17,6 +17,7 @@
* flag.
*/
+#include <linux/bits.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
@@ -35,28 +36,28 @@
#define KEY_REG 0x08 /* Key Value Capture register */
/* Key Scan Initialization Register bit defines */
-#define KEY_INIT_DBNC_MASK (0x00ff0000)
-#define KEY_INIT_DBNC_SHIFT (16)
-#define KEY_INIT_DIS3KY (1<<15)
-#define KEY_INIT_DIAG (1<<14)
-#define KEY_INIT_BACK (1<<13)
-#define KEY_INIT_T2 (1<<12)
-#define KEY_INIT_PRSCL_MASK (0x000003ff)
-#define KEY_INIT_PRSCL_SHIFT (0)
+#define KEY_INIT_DBNC_MASK GENMASK(23, 16)
+#define KEY_INIT_DBNC_SHIFT 16
+#define KEY_INIT_DIS3KY BIT(15)
+#define KEY_INIT_DIAG BIT(14)
+#define KEY_INIT_BACK BIT(13)
+#define KEY_INIT_T2 BIT(12)
+#define KEY_INIT_PRSCL_MASK GENMASK(9, 0)
+#define KEY_INIT_PRSCL_SHIFT 0
/* Key Scan Diagnostic Register bit defines */
-#define KEY_DIAG_MASK (0x0000003f)
-#define KEY_DIAG_SHIFT (0)
+#define KEY_DIAG_MASK GENMASK(5, 0)
+#define KEY_DIAG_SHIFT 0
/* Key Value Capture Register bit defines */
-#define KEY_REG_K (1<<15)
-#define KEY_REG_INT (1<<14)
-#define KEY_REG_2KEYS (1<<13)
-#define KEY_REG_1KEY (1<<12)
-#define KEY_REG_KEY2_MASK (0x00000fc0)
-#define KEY_REG_KEY2_SHIFT (6)
-#define KEY_REG_KEY1_MASK (0x0000003f)
-#define KEY_REG_KEY1_SHIFT (0)
+#define KEY_REG_K BIT(15)
+#define KEY_REG_INT BIT(14)
+#define KEY_REG_2KEYS BIT(13)
+#define KEY_REG_1KEY BIT(12)
+#define KEY_REG_KEY2_MASK GENMASK(11, 6)
+#define KEY_REG_KEY2_SHIFT 6
+#define KEY_REG_KEY1_MASK GENMASK(5, 0)
+#define KEY_REG_KEY1_SHIFT 0
#define EP93XX_MATRIX_SIZE (EP93XX_MATRIX_ROWS * EP93XX_MATRIX_COLS)
--
2.33.0.882.g93a45727a2-goog
next prev parent reply other threads:[~2021-10-12 1:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-12 1:37 [PATCH 1/4] Input: ep93xx_keypad - annotate suspend/resume as __maybe_unused Dmitry Torokhov
2021-10-12 1:37 ` Dmitry Torokhov [this message]
2021-10-12 6:58 ` [PATCH 2/4] Input: ep93xx_keypad - use BIT() and GENMASK() macros Alexander Sverdlin
2021-10-12 1:37 ` [PATCH 3/4] Input: ep93xx_keypad - use dev_pm_set_wake_irq() Dmitry Torokhov
2021-10-12 7:30 ` Alexander Sverdlin
2021-10-12 1:37 ` [PATCH 4/4] Input: ep93xx_keypad - switch to using managed resources Dmitry Torokhov
2021-10-12 7:54 ` Alexander Sverdlin
2021-10-13 2:34 ` Dmitry Torokhov
2021-10-13 2:36 ` [PATCH v2 " Dmitry Torokhov
2021-10-13 5:42 ` Alexander Sverdlin
2021-10-12 6:31 ` [PATCH 1/4] Input: ep93xx_keypad - annotate suspend/resume as __maybe_unused Alexander Sverdlin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211012013735.3523140-2-dmitry.torokhov@gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=alexander.sverdlin@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.