[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8fbfcf7c-4acd-4a7f-a5a5-34baad84e1b2@baylibre.com>
Date: Sat, 7 Feb 2026 12:09:34 -0600
From: David Lechner <dlechner@...libre.com>
To: Antoniu Miclaus <antoniu.miclaus@...log.com>,
Lars-Peter Clausen <lars@...afoo.de>,
Michael Hennerich <Michael.Hennerich@...log.com>,
Jonathan Cameron <jic23@...nel.org>, Nuno Sá
<nuno.sa@...log.com>, Andy Shevchenko <andy@...nel.org>,
Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Olivier Moysan <olivier.moysan@...s.st.com>, Mark Brown
<broonie@...nel.org>, linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-spi@...r.kernel.org
Subject: Re: [PATCH v2 1/4] spi: allow ancillary devices to share parent's
chip selects
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@...libre.com>
Powered by blists - more mailing lists