From: Jonathan Cameron <jic23@kernel.org>
To: Victor Chernyakin <chernyakin.victor.j@outlook.com>
Cc: "Mark Brown" <broonie@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Joshua Crofts" <joshua.crofts1@gmail.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Uwe Kleine-König (The Capable Hub)"
<u.kleine-koenig@baylibre.com>, "Pan Chuang" <panchuang@vivo.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v2 2/2] iio: accel: msa311: use regmap_reg_field_* functions
Date: Sat, 14 Nov 2026 01:55:25 +0000 [thread overview]
Message-ID: <20261114015302.2d8390e2@jic23-hlaptop> (raw)
In-Reply-To: <SN1PR12MB25284D05A476483E668E1255A57F2@SN1PR12MB2528.namprd12.prod.outlook.com>
On Fri, 13 Nov 2026 00:55:46 -0600
Victor Chernyakin <chernyakin.victor.j@outlook.com> wrote:
> Simplify the driver by using the new regmap_reg_field_* functions.
> regmap_reg_field_FOO is equivalent to regmap_field_FOO, but takes
> a reg_field directly instead of a regmap_field.
Hi Victor,
In general this seems like a reasonable idea.
One minor suggestion inline on dropping some comments that
add little value and reordering where the defines are to
give better grouping with what they are about.
When sending a small series, just send the whole lot to the list
and all people on the thread. I had to go find the context
to understand why this was an RFC.
>
> Tested by compiling.
I'd drop that below the ---
Thanks,
Jonathan
>
> Signed-off-by: Victor Chernyakin <chernyakin.victor.j@outlook.com>
> ---
> drivers/iio/accel/msa311.c | 298 +++++++++++++------------------------
> 1 file changed, 106 insertions(+), 192 deletions(-)
>
> diff --git a/drivers/iio/accel/msa311.c b/drivers/iio/accel/msa311.c
> index caf9b1b6397f..63c795d6bc99 100644
> --- a/drivers/iio/accel/msa311.c
> +++ b/drivers/iio/accel/msa311.c
> @@ -75,137 +75,85 @@
> #define MSA311_OFFSET_Y_REG 0x39
> #define MSA311_OFFSET_Z_REG 0x3A
>
> +/* Soft_Reset */
These comments don't add any value because the register name is over here...
Obviously one set of them in he original code were equally pointless!
I'd be tempted to format this whole thing differently to keep register and
register field definitions together:
#define MSA311_SOFT_RESET_REG 0x00
#define MSA311_F_SOFT_RESET_I2C REG_FIELD(MSA311_SOFT_RESET_REG, 2, 2)
#define MSA311_F_SOFT_RESET_SPI REG_FIELD(MSA311_SOFT_RESET_REG, 5, 5)
#define MSA311_PARTID_REG 0x01
#define MSA311_ACC_X_REG 0x02
#define MSA311_ACC_Y_REG 0x04
#define MSA311_ACC_Z_REG 0x06
#define MSA311_MOTION_INT_REG 0x09
#define MSA311_F_ORIENT_INT REG_FIELD(MSA311_MOTION_INT_REG, 6, 6)
#define MSA311_F_S_TAP_INT REG_FIELD(MSA311_MOTION_INT_REG, 5, 5)
#define MSA311_F_D_TAP_INT REG_FIELD(MSA311_MOTION_INT_REG, 4, 4)
#define MSA311_F_ACTIVE_INT REG_FIELD(MSA311_MOTION_INT_REG, 2, 2)
#define MSA311_F_FREEFALL_INT REG_FIELD(MSA311_MOTION_INT_REG, 0, 0)
#define MSA311_DATA_INT_REG 0x0A
#define MSA311_F_NEW_DATA_INT REG_FIELD(MSA311_DATA_INT_REG, 0, 0)
Then even less need for comments.
> +#define MSA311_F_SOFT_RESET_I2C REG_FIELD(MSA311_SOFT_RESET_REG, 2, 2)
> +#define MSA311_F_SOFT_RESET_SPI REG_FIELD(MSA311_SOFT_RESET_REG, 5, 5)
next prev parent reply other threads:[~2026-11-14 1:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 6:55 [RFC PATCH v2 0/2] regmap: add APIs to bypass regmap_field and work with reg_field directly Victor Chernyakin
2026-11-13 6:55 ` [RFC PATCH v2 1/2] regmap: add regmap_reg_field_* APIs Victor Chernyakin
2026-11-13 8:29 ` Andy Shevchenko
2026-11-13 8:47 ` Victor Chernyakin
2026-11-13 9:04 ` Andy Shevchenko
2026-11-13 6:55 ` [RFC PATCH v2 2/2] iio: accel: msa311: use regmap_reg_field_* functions Victor Chernyakin
2026-11-14 1:55 ` Jonathan Cameron [this message]
2026-11-13 8:35 ` [RFC PATCH v2 0/2] regmap: add APIs to bypass regmap_field and work with reg_field directly Andy Shevchenko
2026-11-14 2:34 ` Victor Chernyakin
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=20261114015302.2d8390e2@jic23-hlaptop \
--to=jic23@kernel.org \
--cc=andy@kernel.org \
--cc=bhelgaas@google.com \
--cc=broonie@kernel.org \
--cc=chernyakin.victor.j@outlook.com \
--cc=dlechner@baylibre.com \
--cc=joshua.crofts1@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=panchuang@vivo.com \
--cc=u.kleine-koenig@baylibre.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®