Thread (35 messages) 35 messages, 7 authors, 2026-02-25

Re: [PATCH v2 1/4] spi: allow ancillary devices to share parent's chip selects

From: David Lechner <dlechner@baylibre.com>
Date: 2026-02-07 18:09:39
Also in: linux-iio, linux-spi, lkml

On 2/6/26 10:07 AM, Antoniu Miclaus wrote:
When registering an ancillary SPI device, the current code flags a chip
select conflict with the parent device. This happens because the
ancillary device intentionally uses one of the parent's chip selects,
but __spi_add_device() checks against all existing devices including
the parent.

Allow this by passing the parent device pointer to __spi_add_device()
and skipping the conflict check when the existing device is the parent.
...
 static int spi_dev_check(struct device *dev, void *data)
 {
 	struct spi_device *spi = to_spi_device(dev);
-	struct spi_device *new_spi = data;
+	struct spi_dev_check_info *info = data;
+	struct spi_device *new_spi = info->new_spi;
 	int status, idx;
 
+	/*
+	 * When registering an ancillary device, skip checking against the
+	 * parent device since the ancillary is intentionally using one of
+	 * the parent's chip selects.
+	 */
+	if (info->parent && spi == info->parent)
spi should never be NULL (or we would get a segfault later), so
if `(spi == info->parent)` should be enough.
+		return 0;
+
Reviewed-by: David Lechner <dlechner@baylibre.com>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help