mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lothar Rubusch <l.rubusch@gmail.com>
To: lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org,
	dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
	corbet@lwn.net
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-doc@vger.kernel.org, eraretuya@gmail.com,
	l.rubusch@gmail.com
Subject: [PATCH v12 1/7] iio: accel: adxl345: simplify tap suppress bit
Date: Sun, 27 Jul 2025 21:00:08 +0000	[thread overview]
Message-ID: <20250727210014.27766-2-l.rubusch@gmail.com> (raw)
In-Reply-To: <20250727210014.27766-1-l.rubusch@gmail.com>

Simplify setting the tap suppress bit by applying regmap_assign_bit(). As a
result, the defines can be reorganized for better clarity.

Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com>
---
 drivers/iio/accel/adxl345_core.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/accel/adxl345_core.c b/drivers/iio/accel/adxl345_core.c
index b7dfd0007aa0..e293fc917972 100644
--- a/drivers/iio/accel/adxl345_core.c
+++ b/drivers/iio/accel/adxl345_core.c
@@ -34,12 +34,10 @@
 #define ADXL345_INT2			1
 
 #define ADXL345_REG_TAP_AXIS_MSK	GENMASK(2, 0)
-#define ADXL345_REG_TAP_SUPPRESS_MSK	BIT(3)
-#define ADXL345_REG_TAP_SUPPRESS	BIT(3)
-
 #define ADXL345_TAP_Z_EN		BIT(0)
 #define ADXL345_TAP_Y_EN		BIT(1)
 #define ADXL345_TAP_X_EN		BIT(2)
+#define ADXL345_REG_TAP_SUPPRESS	BIT(3)
 
 /* single/double tap */
 enum adxl345_tap_type {
@@ -368,9 +366,8 @@ static int adxl345_set_doubletap_en(struct adxl345_state *st, bool en)
 	 * Generally suppress detection of spikes during the latency period as
 	 * double taps here, this is fully optional for double tap detection
 	 */
-	ret = regmap_update_bits(st->regmap, ADXL345_REG_TAP_AXIS,
-				 ADXL345_REG_TAP_SUPPRESS_MSK,
-				 en ? ADXL345_REG_TAP_SUPPRESS : 0x00);
+	ret = regmap_assign_bits(st->regmap, ADXL345_REG_TAP_AXIS,
+				 ADXL345_REG_TAP_SUPPRESS, en);
 	if (ret)
 		return ret;
 
-- 
2.39.5


  reply	other threads:[~2025-07-27 21:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-27 21:00 [PATCH v12 0/7] iio: accel: adxl345: add interrupt based sensor events Lothar Rubusch
2025-07-27 21:00 ` Lothar Rubusch [this message]
2025-07-27 21:00 ` [PATCH v12 2/7] iio: accel: adxl345: add activity event feature Lothar Rubusch
2025-07-27 21:00 ` [PATCH v12 3/7] iio: accel: adxl345: add inactivity feature Lothar Rubusch
2025-07-27 21:00 ` [PATCH v12 4/7] iio: accel: adxl345: add coupling detection for activity/inactivity Lothar Rubusch
2025-07-27 21:00 ` [PATCH v12 5/7] iio: accel: adxl345: extend inactivity time for less than 1s Lothar Rubusch
2025-07-27 21:00 ` [PATCH v12 6/7] docs: iio: add documentation for adxl345 driver Lothar Rubusch
2025-07-27 21:00 ` [PATCH v12 7/7] docs: iio: describe inactivity and free-fall detection on the ADXL345 Lothar Rubusch
2025-08-02 11:47 ` [PATCH v12 0/7] iio: accel: adxl345: add interrupt based sensor events Jonathan Cameron

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=20250727210014.27766-2-l.rubusch@gmail.com \
    --to=l.rubusch@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=corbet@lwn.net \
    --cc=dlechner@baylibre.com \
    --cc=eraretuya@gmail.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®