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

From: Nuno Sá

Date: Fri Aug 07 2026 - 10:51:37 EST


On Mon, 03 Aug 2026 00:02:15 -0300, Jonathan Santos <Jonathan.Santos@xxxxxxxxxx> 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á <nuno.sa@xxxxxxxxxx>