From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: "Nuno Sá" <nuno.sa@analog.com>
Cc: Jonathan Santos <Jonathan.Santos@analog.com>,
linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
dlechner@baylibre.com, michael.hennerich@analog.com,
broonie@kernel.org, jonath4nns@gmail.com,
marcelo.schmitt1@gmail.com
Subject: Re: [PATCH v3 3/6] spi: expand device name to include all CS lines for multi-CS devices
Date: Wed, 19 Aug 2026 09:59:43 +0300 [thread overview]
Message-ID: <aoVUXxzM77ueTWBV@ashevche-desk.local> (raw)
In-Reply-To: <178706966052.3163.11425556311922813200.b4-reply@b4>
On Tue, Aug 18, 2026 at 05:14:20PM +0100, Nuno Sá wrote:
> On 2026-08-18 09:45:05+03:00, Andy Shevchenko wrote:
> > On Mon, Aug 17, 2026 at 08:32:57PM -0300, Jonathan Santos wrote:
...
> > > - dev_set_name(&spi->dev, "%s.%u", dev_name(&spi->controller->dev),
> > > - spi_get_chipselect(spi, 0));
> > > + cs_len = scnprintf(cs_str, sizeof(cs_str), "%u", spi_get_chipselect(spi, 0));
> > > + for (unsigned int idx = 1; idx < spi->num_chipselect; idx++)
> > > + cs_len += scnprintf(cs_str + cs_len, sizeof(cs_str) - cs_len,
> > > + "+%u", spi_get_chipselect(spi, idx));
> >
> > So, if this won't support sparse CS list, I would just go with a standard range:
> >
> > dev_set_name(&spi->dev, "%s.%u-%u", dev_name(&spi->controller->dev),
> > spi_get_chipselect(spi, 0), spi_get_chipselect(spi, 0) + spi->num_chipselect - 1);
>
> I don't think there's anything forcing cs to be contiguous. So cs4-0 does
> not mean we have 0,1,2,3 and 4 which I think the above implies.
>
> Moreover, i also don't think is guaranteed that `spi_get_chipselect(spi,
> 0) + spi->num_chipselect - 1)` yields a valid cs. IOW, in theory
>
> spi_get_chipselect(spi, spi->num_chipselect - 1) might be different
> than spi_get_chipselect(spi, 0) + spi->num_chipselect - 1
So, I would expect then two things:
- following the KISS and make sure we operate on the sequential CS ranges.
- definitely add some test cases, now it's a time (I consider NAKing any
version without test cases of this rather complex mapping logic)
> > (yes, need a variation for num_chipselect == 1, but I leave the rest for you)
> >
> > Note, I do not see that we are expecting to see the sparse CS list here. It
> > would make too complex logic to follow. So, range approach is KISS in my opinion.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-08-19 6:59 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 23:32 [PATCH v3 0/6] spi: add multi-CS and multi-chip aggregation support Jonathan Santos
2026-08-17 23:32 ` [PATCH v3 1/6] dt-bindings: iio: adc: ad7768-1: Document multidevice support Jonathan Santos
2026-08-18 6:46 ` Krzysztof Kozlowski
2026-08-18 13:35 ` David Lechner
2026-08-18 15:02 ` David Lechner
2026-08-18 15:14 ` Nuno Sá
2026-08-18 15:26 ` David Lechner
2026-08-17 23:32 ` [PATCH v3 2/6] spi: support simultaneous assertion of multiple CS Jonathan Santos
2026-08-18 6:39 ` Andy Shevchenko
2026-08-18 16:06 ` David Lechner
2026-08-22 0:10 ` Jonathan Santos
2026-08-17 23:32 ` [PATCH v3 3/6] spi: expand device name to include all CS lines for multi-CS devices Jonathan Santos
2026-08-18 6:45 ` Andy Shevchenko
2026-08-18 16:14 ` Nuno Sá
2026-08-19 6:59 ` Andy Shevchenko [this message]
2026-08-17 23:33 ` [PATCH v3 4/6] spi: introduce SPI ancillary device with lanes Jonathan Santos
2026-08-18 6:53 ` Andy Shevchenko
2026-08-17 23:33 ` [PATCH v3 5/6] spi: spi-engine-ex: Add support for multi-CS devices Jonathan Santos
2026-08-18 7:01 ` Andy Shevchenko
2026-08-17 23:33 ` [PATCH v3 6/6] iio: adc: ad7768-1: add support for multiple chip aggregation Jonathan Santos
2026-08-18 7:10 ` Andy Shevchenko
2026-08-18 16:17 ` Nuno Sá
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=aoVUXxzM77ueTWBV@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=Jonathan.Santos@analog.com \
--cc=broonie@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jonath4nns@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=marcelo.schmitt1@gmail.com \
--cc=michael.hennerich@analog.com \
--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