]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
spi: stm32-ospi: Use FIELD_MODIFY()
authorHans Zhang <18255117159@163.com>
Thu, 30 Apr 2026 15:54:53 +0000 (23:54 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 11 May 2026 12:05:09 +0000 (21:05 +0900)
Use FIELD_MODIFY() to remove open-coded bit manipulation.
No functional change intended.

Signed-off-by: Hans Zhang <18255117159@163.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Link: https://patch.msgid.link/20260430155456.36998-8-18255117159@163.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-stm32-ospi.c

index 4461c6e24b9edcafac2139112f596eee62d7247e..3757f6ba8fc613f878a2b493f33d887304347301 100644 (file)
@@ -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)