From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Jonathan Santos <Jonathan.Santos@analog.com>
Cc: linux-spi@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
linux@analog.com, broonie@kernel.org, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org,
Michael.Hennerich@analog.com, nuno.sa@analog.com,
jic23@kernel.org, dlechner@baylibre.com
Subject: Re: [PATCH v4 4/9] spi: restrict CS logical values to a contiguous sequence
Date: Wed, 21 Oct 2026 18:06:49 +0300 [thread overview]
Message-ID: <atjVCVNzq3j34hjv@ashevche-desk.local> (raw)
In-Reply-To: <dd50e45bff4b59ad656f94fffecca28a49f1d2d3.1792435248.git.Jonathan.Santos@analog.com>
On Tue, Oct 20, 2026 at 10:57:28PM -0300, Jonathan Santos wrote:
> When a device uses more than one chip select, require the logical CS
> numbers to be consecutive (for example 2, 3, 4). If they aren't,
> __spi_add_device() now fails with -EINVAL and logs which CS breaks
> the sequence.
...
> ---
> Changes in v4:
> * New patch, suggested by Andy. I assume this might have impacts on
> existing users. Should we make something else to complement this?
But do we have any sparse chipselect lists anywhere (in DT?)?
> + /* Restrict CS logical values to a contiguous sequence */
> + for (idx = 1; idx < spi->num_chipselect; idx++) {
... prev = spi_get_chipselect(spi, idx);
... curr = spi_get_chipselect(spi, idx - 1);
> + if (spi_get_chipselect(spi, idx) != spi_get_chipselect(spi, idx - 1) + 1) {
> + dev_err(dev, "cs%d is not consecutive with cs%d\n",
> + spi_get_chipselect(spi, idx),
> + spi_get_chipselect(spi, idx - 1));
if (curr != prev + 1) {
dev_err(dev, "cs%d is not consecutive with cs%d\n", curr, prev);
> + return -EINVAL;
> + }
> + }
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-10-21 15:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-21 1:56 [PATCH v4 0/9] spi: add multi-CS and multi-chip aggregation support Jonathan Santos
2026-10-21 1:56 ` [PATCH v4 1/9] spi: dt-bindings: Add spi-cs-composite property Jonathan Santos
2026-10-21 1:56 ` [PATCH v4 2/9] dt-bindings: iio: adc: ad7768-1: Document multidevice support Jonathan Santos
2026-10-21 1:57 ` [PATCH v4 3/9] spi: support simultaneous assertion of multiple CS Jonathan Santos
2026-10-21 1:57 ` [PATCH v4 4/9] spi: restrict CS logical values to a contiguous sequence Jonathan Santos
2026-10-21 15:06 ` Andy Shevchenko [this message]
2026-10-21 1:57 ` [PATCH v4 5/9] spi: expand device name to include enabled CS lines for multi-CS devices Jonathan Santos
2026-10-21 1:58 ` [PATCH v4 6/9] spi: introduce SPI ancillary device with lanes Jonathan Santos
2026-10-21 1:58 ` [PATCH v4 7/9] spi: add KUnit tests for the multi-CS framework Jonathan Santos
2026-10-21 1:58 ` [PATCH v4 8/9] spi: spi-engine-ex: Add support for multi-CS devices Jonathan Santos
2026-10-21 15:13 ` Andy Shevchenko
2026-10-21 1:58 ` [PATCH v4 9/9] iio: adc: ad7768-1: add support for multiple chip aggregation Jonathan Santos
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=atjVCVNzq3j34hjv@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=Jonathan.Santos@analog.com \
--cc=Michael.Hennerich@analog.com \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=linux@analog.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®