[PATCH v3 1/4] spi: stm32: renaming of spi_master into spi_controller

Leonard Göhrs l.goehrs at pengutronix.de
Wed Aug 16 08:07:58 PDT 2023


Hello,

On 15.06.23 09:58, Valentin Caron wrote:
> From: Alain Volmat <alain.volmat at foss.st.com>
> 
> Preparing introduction of SPI device, rename the spi_master structure
> into spi_controller. This doesn't have any functional impact since
> spi_master was already a macro for spi_controller.
> Referring now to ctrl instead of master since the spi_controller
> structure might not be used as a master controller only.
> 
> Signed-off-by: Alain Volmat <alain.volmat at foss.st.com>
> Signed-off-by: Valentin Caron <valentin.caron at foss.st.com>
> ---
>   drivers/spi/spi-stm32.c | 154 ++++++++++++++++++++--------------------
>   1 file changed, 77 insertions(+), 77 deletions(-)
> 
> diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
> index d6598e4116bd..5d9439ae1c09 100644
> --- a/drivers/spi/spi-stm32.c
> +++ b/drivers/spi/spi-stm32.c

<snip>

> @@ -939,13 +939,13 @@ static irqreturn_t stm32h7_spi_irq_thread(int irq, void *dev_id)
>   
>   /**
>    * stm32_spi_prepare_msg - set up the controller to transfer a single message
> - * @master: controller master interface
> + * @ctrl: controller interface
>    * @msg: pointer to spi message
>    */
> -static int stm32_spi_prepare_msg(struct spi_master *master,
> +static int stm32_spi_prepare_msg(struct spi_controller *ctrl,
>   				 struct spi_message *msg)
>   {
> -	struct stm32_spi *spi = spi_master_get_devdata(master);
> +	struct stm32_spi *spi = spi_controller_get_devdata(ctrl);
>   	struct spi_device *spi_dev = msg->spi;
>   	struct device_node *np = spi_dev->dev.of_node;
>   	unsigned long flags;
> @@ -984,9 +984,9 @@ static int stm32_spi_prepare_msg(struct spi_master *master,
>   	if (spi->cfg->set_number_of_data) {
>   		int ret;
>   
> -		ret = spi_split_transfers_maxwords(master, msg,
> -						   STM32H7_SPI_TSIZE_MAX,
> -						   GFP_KERNEL | GFP_DMA);
> +		ret = spi_split_transfers_maxsize(ctrl, msg,
> +						  STM32H7_SPI_TSIZE_MAX,
> +						  GFP_KERNEL | GFP_DMA);
>   		if (ret)
>   			return ret;
>   	}

<snip>

this patch introduces a regression when transmitting large SPI transfers with
a word size != 8 bits. The regression is caused by effectively reverting commit
1e4929112507f ("spi: stm32: split large transfers based on word size instead of
bytes") by changing the call to spi_split_transfers_maxwords() back to
spi_split_transfers_maxsize().

I've sent a patch[1] that fixes this regression by changing the …_maxsize()
call back to …_maxwords().

[1]: https://lore.kernel.org/all/20230816145237.3159817-1-l.goehrs@pengutronix.de/



More information about the linux-arm-kernel mailing list