[PATCH v1 6/7] spi: microchip-core: Use SPI_MODE_X_MASK

Andy Shevchenko
2025-11-25T20:17:08Z

Use SPI_MODE_X_MASK instead of open coded variant.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/spi/spi-microchip-core-spi.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/spi/spi-microchip-core-spi.c b/drivers/spi/spi-microchip-core-spi.c
index 68b136157fac..2d7ee556eafd 100644
--- a/drivers/spi/spi-microchip-core-spi.c
+++ b/drivers/spi/spi-microchip-core-spi.c
@@ -149,8 +149,6 @@ static void mchp_corespi_set_cs(struct spi_device *spi, bool disable)

static int mchp_corespi_setup(struct spi_device *spi)
{
- u32 dev_mode = spi->mode & (SPI_CPOL | SPI_CPHA);
-
if (spi_get_csgpiod(spi, 0))
return 0;

@@ -159,7 +157,7 @@ static int mchp_corespi_setup(struct spi_device *spi)
return -EOPNOTSUPP;
}

- if (dev_mode & ~spi->controller->mode_bits) {
+ if (spi->mode & SPI_MODE_X_MASK & ~spi->controller->mode_bits) {
dev_err(&spi->dev, "incompatible CPOL/CPHA, must match controller's Motorola mode\n");
return -EINVAL;
}
--
2.50.1