[PATCH 07/10] spi: stm32-ospi: Use FIELD_MODIFY()

Patrice CHOTARD patrice.chotard at foss.st.com
Mon May 11 01:00:17 PDT 2026



On 4/30/26 17:54, Hans Zhang wrote:
> Use FIELD_MODIFY() to remove open-coded bit manipulation.
> No functional change intended.
> 
> Signed-off-by: Hans Zhang <18255117159 at 163.com>
> ---
>  drivers/spi/spi-stm32-ospi.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/spi/spi-stm32-ospi.c b/drivers/spi/spi-stm32-ospi.c
> index 4461c6e24b9e..3757f6ba8fc6 100644
> --- a/drivers/spi/spi-stm32-ospi.c
> +++ b/drivers/spi/spi-stm32-ospi.c
> @@ -470,10 +470,9 @@ static int stm32_ospi_send(struct spi_device *spi, const struct spi_mem_op *op)
>  	u8 cs = spi->chip_select[ffs(spi->cs_index_mask) - 1];
>  
>  	cr = readl_relaxed(ospi->regs_base + OSPI_CR);
> -	cr &= ~CR_CSSEL;
> -	cr |= FIELD_PREP(CR_CSSEL, cs);
> -	cr &= ~CR_FMODE_MASK;
> -	cr |= FIELD_PREP(CR_FMODE_MASK, ospi->fmode);
> +	FIELD_MODIFY(CR_CSSEL, &cr, cs);
> +
> +	FIELD_MODIFY(CR_FMODE_MASK, &cr, ospi->fmode);
>  	writel_relaxed(cr, regs_base + OSPI_CR);
>  
>  	if (op->data.nbytes)

Hi Hans

Reviewed-by: Patrice Chotard <patrice.chotard at foss.st.com>

Thanks
Patrice



More information about the linux-amlogic mailing list