From: "Shen Jianping (ME-SE/EAD2)" <Jianping.Shen@de.bosch.com>
To: "Geert Uytterhoeven" <geert+renesas@glider.be>,
"Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: AW: [PATCH v7] iio: imu: smi330: Convert to common field_{get,prep}() helpers
Date: Sat, 17 Jan 2026 09:56:43 +0000 [thread overview]
Message-ID: <DB9PR10MB502041D68C1301A227B40CD7CD8AA@DB9PR10MB5020.EURPRD10.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <275b806d25a57cb538b3db2a7490e1570175f6a1.1768486991.git.geert+renesas@glider.be>
>Betreff: [PATCH v7] iio: imu: smi330: Convert to common field_{get,prep}() helpers
>
>Drop the driver-specific smi330_field_get() and smi330_field_prep() macros, in
>favor of the globally available variants from <linux/bitfield.h>.
>
>Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>---
>v7:
> - Update for the renamed smi330_field_{get,prep}() helpers,
>
>v6:
> - No changes,
>
>v5:
> - New.
>---
> drivers/iio/imu/smi330/smi330_core.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
>diff --git a/drivers/iio/imu/smi330/smi330_core.c
>b/drivers/iio/imu/smi330/smi330_core.c
>index 7564f12543e0ca04..83e0dff5d973d046 100644
>--- a/drivers/iio/imu/smi330/smi330_core.c
>+++ b/drivers/iio/imu/smi330/smi330_core.c
>@@ -67,10 +67,6 @@
> #define SMI330_CHIP_ID 0x42
> #define SMI330_SOFT_RESET_DELAY 2000
>
>-/* Non-constant mask variant of FIELD_GET() and FIELD_PREP() */ -#define
>smi330_field_get(_mask, _reg) (((_reg) & (_mask)) >> (ffs(_mask) - 1)) -#define
>smi330_field_prep(_mask, _val) (((_val) << (ffs(_mask) - 1)) & (_mask))
>-
> #define SMI330_ACCEL_CHANNEL(_axis) { \
> .type = IIO_ACCEL, \
> .modified = 1, \
>@@ -361,7 +357,7 @@ static int smi330_get_sensor_config(struct smi330_data
>*data,
> if (ret)
> return ret;
>
>- reg_val = smi330_field_get(attr->mask, reg_val);
>+ reg_val = field_get(attr->mask, reg_val);
>
> if (attr->type == IIO_VAL_INT) {
> for (i = 0; i < attr->len; i++) {
>@@ -410,7 +406,7 @@ static int smi330_set_sensor_config(struct smi330_data
>*data,
> if (ret)
> return ret;
>
>- reg_val = smi330_field_prep(attr->mask, reg_val);
>+ reg_val = field_prep(attr->mask, reg_val);
> ret = regmap_update_bits(data->regmap, reg, attr->mask, reg_val);
> if (ret)
> return ret;
>--
>2.43.0
Hi Geert
Thanks for using the standard kernel implementation.
Reviewed-by: Jianping Shen <Jianping.Shen@de.bosch.com>
prev parent reply other threads:[~2026-01-17 9:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-15 14:24 Geert Uytterhoeven
2026-01-16 19:45 ` Jonathan Cameron
2026-01-17 9:56 ` Shen Jianping (ME-SE/EAD2) [this message]
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=DB9PR10MB502041D68C1301A227B40CD7CD8AA@DB9PR10MB5020.EURPRD10.PROD.OUTLOOK.COM \
--to=jianping.shen@de.bosch.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=geert+renesas@glider.be \
--cc=jic23@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®