From: Jonathan Cameron <jic23@kernel.org>
To: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Cc: "Kanak Shilledar" <kanak.shilledar@axis.com>,
"Henrik Grimler" <henrik.grimler@axis.com>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Jean-Baptiste Maneyrol" <jean-baptiste.maneyrol@tdk.com>,
"Joshua Crofts" <joshua.crofts1@gmail.com>,
"Chris Morgan" <macromorgan@hotmail.com>,
kernel@axis.com, linux-iio@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/5] iio: imu: inv_icm42607: Simplify IIO channel macros
Date: Mon, 21 Sep 2026 00:29:36 +0100 [thread overview]
Message-ID: <20260921002936.6e06e790@jic23-hlaptop> (raw)
In-Reply-To: <aq_lwtGT8G-BTLM2@debian-BULLSEYE-live-builder-AMD64>
On Sun, 20 Sep 2026 10:55:14 -0300
Marcelo Schmitt <marcelo.schmitt1@gmail.com> wrote:
> On 09/17, Kanak Shilledar wrote:
> > The INV_ICM42607_ACCEL_CHAN and INV_ICM42607_GYRO_CHAN macro had a third
> > parameter of _ext_info, drop it and just point the .ext_info field to
> > the respective inv_icm42607_*_ext_infos. This reduces the repetitive
> > calling of inv_icm42607_*_ext_infos struct in the IIO channel spec
> > struct and makes the code more easy to follow.
> >
> > Signed-off-by: Kanak Shilledar <kanak.shilledar@axis.com>
> > ---
> > drivers/iio/imu/inv_icm42607/inv_icm42607_accel.c | 23 ++++++++++-------------
> > drivers/iio/imu/inv_icm42607/inv_icm42607_gyro.c | 23 ++++++++++-------------
> > 2 files changed, 20 insertions(+), 26 deletions(-)
> >
> > diff --git a/drivers/iio/imu/inv_icm42607/inv_icm42607_accel.c b/drivers/iio/imu/inv_icm42607/inv_icm42607_accel.c
> > index 0b3f035c2da0c..8f61bc9014526 100644
> > --- a/drivers/iio/imu/inv_icm42607/inv_icm42607_accel.c
> > +++ b/drivers/iio/imu/inv_icm42607/inv_icm42607_accel.c
> > @@ -17,7 +17,7 @@
> > #include "inv_icm42607.h"
> > #include "inv_icm42607_temp.h"
> >
> > -#define INV_ICM42607_ACCEL_CHAN(_modifier, _index, _ext_info) \
> > +#define INV_ICM42607_ACCEL_CHAN(_modifier, _index) \
> > { \
> > .type = IIO_ACCEL, \
> > .modified = 1, \
> > @@ -34,9 +34,14 @@
> > .storagebits = 16, \
> > .endianness = IIO_BE, \
> > }, \
> > - .ext_info = _ext_info, \
> > + .ext_info = inv_icm42607_accel_ext_infos, \
> > }
> >
> > +static const struct iio_chan_spec_ext_info inv_icm42607_accel_ext_infos[] = {
> > + IIO_MOUNT_MATRIX(IIO_SHARED_BY_ALL, inv_icm42607_get_mount_matrix),
> > + { }
> > +};
> > +
> Moving iio_chan_spec_ext_info declaration upwards looks like a spurious change.
> If moving the declaration upwards is really needed, the commit message could
> have a phrase or two explaining why.
It would have some sort of logic if they were before the .ext_info
in the macro just on basis we generally expect to look earlier
in a file for things that are used. Obviously doesn't matter
given that is in a macro called much later.
Fully agree some explanatory comments would be useful!
Jonathan
>
> > enum inv_icm42607_accel_scan {
> > INV_ICM42607_ACCEL_SCAN_X,
> > INV_ICM42607_ACCEL_SCAN_Y,
> > @@ -44,18 +49,10 @@ enum inv_icm42607_accel_scan {
> > INV_ICM42607_ACCEL_SCAN_TEMP,
> > };
> >
> > -static const struct iio_chan_spec_ext_info inv_icm42607_accel_ext_infos[] = {
> > - IIO_MOUNT_MATRIX(IIO_SHARED_BY_ALL, inv_icm42607_get_mount_matrix),
> > - { }
> > -};
> > -
> > static const struct iio_chan_spec inv_icm42607_accel_channels[] = {
> > - INV_ICM42607_ACCEL_CHAN(IIO_MOD_X, INV_ICM42607_ACCEL_SCAN_X,
> > - inv_icm42607_accel_ext_infos),
> > - INV_ICM42607_ACCEL_CHAN(IIO_MOD_Y, INV_ICM42607_ACCEL_SCAN_Y,
> > - inv_icm42607_accel_ext_infos),
> > - INV_ICM42607_ACCEL_CHAN(IIO_MOD_Z, INV_ICM42607_ACCEL_SCAN_Z,
> > - inv_icm42607_accel_ext_infos),
> > + INV_ICM42607_ACCEL_CHAN(IIO_MOD_X, INV_ICM42607_ACCEL_SCAN_X),
> > + INV_ICM42607_ACCEL_CHAN(IIO_MOD_Y, INV_ICM42607_ACCEL_SCAN_Y),
> > + INV_ICM42607_ACCEL_CHAN(IIO_MOD_Z, INV_ICM42607_ACCEL_SCAN_Z),
> > INV_ICM42607_TEMP_CHAN(INV_ICM42607_ACCEL_SCAN_TEMP),
> > };
> >
> > diff --git a/drivers/iio/imu/inv_icm42607/inv_icm42607_gyro.c b/drivers/iio/imu/inv_icm42607/inv_icm42607_gyro.c
> > index 5b4683c2dd1e4..8e8d36461e515 100644
> > --- a/drivers/iio/imu/inv_icm42607/inv_icm42607_gyro.c
> > +++ b/drivers/iio/imu/inv_icm42607/inv_icm42607_gyro.c
> > @@ -17,7 +17,7 @@
> > #include "inv_icm42607.h"
> > #include "inv_icm42607_temp.h"
> >
> > -#define INV_ICM42607_GYRO_CHAN(_modifier, _index, _ext_info) \
> > +#define INV_ICM42607_GYRO_CHAN(_modifier, _index) \
> > { \
> > .type = IIO_ANGL_VEL, \
> > .modified = 1, \
> > @@ -34,9 +34,14 @@
> > .storagebits = 16, \
> > .endianness = IIO_BE, \
> > }, \
> > - .ext_info = _ext_info, \
> > + .ext_info = inv_icm42607_gyro_ext_infos, \
> > }
> >
> > +static const struct iio_chan_spec_ext_info inv_icm42607_gyro_ext_infos[] = {
> > + IIO_MOUNT_MATRIX(IIO_SHARED_BY_ALL, inv_icm42607_get_mount_matrix),
> > + { }
> > +};
> > +
> Same here, why moving inv_icm42607_gyro_ext_infos declarations up is necessary?
>
> > enum inv_icm42607_gyro_scan {
> > INV_ICM42607_GYRO_SCAN_X,
> > INV_ICM42607_GYRO_SCAN_Y,
> > @@ -44,18 +49,10 @@ enum inv_icm42607_gyro_scan {
> > INV_ICM42607_GYRO_SCAN_TEMP,
> > };
> >
> > -static const struct iio_chan_spec_ext_info inv_icm42607_gyro_ext_infos[] = {
> > - IIO_MOUNT_MATRIX(IIO_SHARED_BY_ALL, inv_icm42607_get_mount_matrix),
> > - { }
> > -};
> > -
> > static const struct iio_chan_spec inv_icm42607_gyro_channels[] = {
> > - INV_ICM42607_GYRO_CHAN(IIO_MOD_X, INV_ICM42607_GYRO_SCAN_X,
> > - inv_icm42607_gyro_ext_infos),
> > - INV_ICM42607_GYRO_CHAN(IIO_MOD_Y, INV_ICM42607_GYRO_SCAN_Y,
> > - inv_icm42607_gyro_ext_infos),
> > - INV_ICM42607_GYRO_CHAN(IIO_MOD_Z, INV_ICM42607_GYRO_SCAN_Z,
> > - inv_icm42607_gyro_ext_infos),
> > + INV_ICM42607_GYRO_CHAN(IIO_MOD_X, INV_ICM42607_GYRO_SCAN_X),
> > + INV_ICM42607_GYRO_CHAN(IIO_MOD_Y, INV_ICM42607_GYRO_SCAN_Y),
> > + INV_ICM42607_GYRO_CHAN(IIO_MOD_Z, INV_ICM42607_GYRO_SCAN_Z),
> > INV_ICM42607_TEMP_CHAN(INV_ICM42607_GYRO_SCAN_TEMP),
> > };
> >
> >
> > --
> > 2.43.0
> >
next prev parent reply other threads:[~2026-09-20 23:29 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 13:38 [PATCH v4 0/5] Add support for InvenSense ICM-42370-P accelerometer Kanak Shilledar
2026-09-17 13:38 ` [PATCH v4 1/5] dt-bindings: Add InvenSense ICM-42370-p accelerometer Kanak Shilledar
2026-09-20 13:52 ` Marcelo Schmitt
2026-09-28 8:55 ` Kanak Shilledar
2026-09-28 17:56 ` Rob Herring
2026-09-29 15:15 ` Marcelo Schmitt
2026-09-28 17:58 ` Rob Herring
2026-09-17 13:38 ` [PATCH v4 2/5] iio: imu: inv_icm42607: Simplify IIO channel macros Kanak Shilledar
2026-09-20 13:55 ` Marcelo Schmitt
2026-09-20 23:29 ` Jonathan Cameron [this message]
2026-09-17 13:38 ` [PATCH v4 3/5] iio: imu: inv_icm42607: Add support for ICM-42370-P Kanak Shilledar
2026-09-20 14:03 ` Marcelo Schmitt
2026-09-20 23:33 ` Jonathan Cameron
2026-09-17 13:38 ` [PATCH v4 4/5] iio: imu: inv_icm42607: Implement MREGx register access Kanak Shilledar
2026-09-20 14:09 ` Marcelo Schmitt
2026-09-20 23:51 ` Jonathan Cameron
2026-09-17 13:38 ` [PATCH v4 5/5] iio: imu: inv_icm42607: Add accelerometer calibbias support Kanak Shilledar
2026-09-20 23:55 ` 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=20260921002936.6e06e790@jic23-hlaptop \
--to=jic23@kernel.org \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=henrik.grimler@axis.com \
--cc=jean-baptiste.maneyrol@tdk.com \
--cc=joshua.crofts1@gmail.com \
--cc=kanak.shilledar@axis.com \
--cc=kernel@axis.com \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=macromorgan@hotmail.com \
--cc=marcelo.schmitt1@gmail.com \
--cc=nuno.sa@analog.com \
--cc=robh@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 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®