From: "Nuno Sá" <nuno.sa@analog.com>
To: Shehryar Ahmad <shehryar.amd@gmail.com>
Cc: jic23@kernel.org, Michael.Hennerich@analog.com,
dlechner@baylibre.com, andy@kernel.org, linux@analog.com,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] iio: adis_buffer: fix buffer ordering for IIO core demultiplexing
Date: Wed, 25 Nov 2026 11:14:19 +0000 [thread overview]
Message-ID: <awbCr2uksnL2X6tM@nsa> (raw)
In-Reply-To: <atCoXDKG3XNYvP07@nsa>
On Thu, Oct 15, 2026 at 11:21:07AM +0100, Nuno Sá wrote:
> On Fri, Sep 25, 2026 at 04:02:39PM +0500, Shehryar Ahmad wrote:
> > Hi Jonathan,
> >
> > After issue raised by Sashiko in adis16203 graduation series [1], looking at
> > other drivers if they might have same issue. It appears that the root
> > cause is in adis_buffer.c itself. The library constructs the SPI
> > transaction in channel array order while IIO core demultiplexes in
> > scan_index order.
> >
> > adis16209 and adis16260 have the same mismatched ordering that
> > adis16201/16203 had.
> >
> > Rather than reordering channel arrays in affected driver,
> > would it be sensible to make adis_update_scan_mode() iterate
> > in scan_index order instead of channel array order?
> >
> > Would this be the right approach, or is there something I'm missing?
> >
> > [1]: https://lore.kernel.org/all/20260914015321.7a660ab5@jic23-hlaptop/
> >
> > Signed-off-by: Shehryar Ahmad <shehryar.amd@gmail.com>
> > ---
> > drivers/iio/imu/adis_buffer.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/iio/imu/adis_buffer.c b/drivers/iio/imu/adis_buffer.c
> > index 501da4eae..45200b753 100644
> > --- a/drivers/iio/imu/adis_buffer.c
> > +++ b/drivers/iio/imu/adis_buffer.c
> > @@ -110,10 +110,10 @@ int adis_update_scan_mode(struct iio_dev *indio_dev,
> > spi_message_add_tail(&adis->xfer[j], &adis->msg);
> > }
> >
> > - chan = indio_dev->channels;
> > - for (i = 0; i < indio_dev->num_channels; i++, chan++) {
> > - if (!test_bit(chan->scan_index, scan_mask))
> > - continue;
> > + for_each_set_bit(i, scan_mask, iio_get_masklength(indio_dev)) {
>
> I guess it can be iio_for_each_active_channel()
So given that we confirmed and got this tested and with the above
change:
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
>
> - Nuno Sá
>
> > + chan = iio_find_channel_from_si(indio_dev, i);
> > + if (!chan)
> > + return -EINVAL;
> > if (chan->scan_type.storagebits == 32)
> > *tx++ = cpu_to_be16((chan->address + 2) << 8);
> > *tx++ = cpu_to_be16(chan->address << 8);
> > --
> > 2.55.0
> >
prev parent reply other threads:[~2026-11-25 11:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-25 11:02 Shehryar Ahmad
2026-09-27 17:59 ` Jonathan Cameron
2026-10-06 17:14 ` [PING][RFC " Shehryar Ahmad
2026-10-15 10:17 ` [RFC " Nuno Sá
2026-11-24 11:33 ` Sabau, Radu bogdan
2026-10-15 10:21 ` Nuno Sá
2026-11-25 11:14 ` Nuno Sá [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=awbCr2uksnL2X6tM@nsa \
--to=nuno.sa@analog.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@analog.com \
--cc=shehryar.amd@gmail.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®