Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

spi: spidev: Use SPI_MODE_USER_MASK instead of casting

Currently the 16-bit mode is what being used in user space.
However assuming that is not fully correct. Instead we should
use the respective mask, i.e. SPI_MODE_USER_MASK, which
precisely defines what bits are available for user space apps.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20211122175245.84691-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Andy Shevchenko and committed by
Mark Brown
dd06a0c6 350de7ce

+1 -1
+1 -1
drivers/spi/spidev.c
··· 415 415 tmp |= SPI_CS_HIGH; 416 416 417 417 tmp |= spi->mode & ~SPI_MODE_MASK; 418 - spi->mode = (u16)tmp; 418 + spi->mode = tmp & SPI_MODE_USER_MASK; 419 419 retval = spi_setup(spi); 420 420 if (retval < 0) 421 421 spi->mode = save;