Re: [PATCH v2 3/5] spi: introduce SPI ancillary device with lanes

Nuno Sá <[email protected]>
Newsgroups org.kernel.vger.linux-spi,org.kernel.vger.linux-kernel
Message-ID <178611422288.552144.8213427990927728453.b4-review@b4>
On Mon, 03 Aug 2026 00:02:15 -0300, Jonathan Santos <[email protected]> wrote:
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index 61423aee1525..d41c9392c04e 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -2749,6 +2749,72 @@ struct spi_device *spi_new_ancillary_device(struct spi_device *spi,
> [ ... skip 47 lines ... ]
> +	ancillary->rx_lane_map[0] = spi->rx_lane_map[rx_lane_idx];
> +	ancillary->num_rx_lanes = 1;
> +	ancillary->tx_lane_map[0] = spi->tx_lane_map[tx_lane_idx];
> +	ancillary->num_tx_lanes = 1;
> +
> +	WARN_ON(!mutex_is_locked(&ctlr->add_lock));

Taking out the new lane handling, you do have some fair amount of
duplicated code. Factor that out to common helper shared with
spi_new_ancillary_device(). Maybe with some handling (like a know
invalid value for rx_lane_idx and tx_lane_idx) you could have mainly
common code and the public APIs would just call that with the proper
parameters.


- Nuno Sá

-- 
Nuno Sá <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.