diff options
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r-- | drivers/spi/spi.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 0276bc37e255..a525a3a848c1 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -607,8 +607,19 @@ EXPORT_SYMBOL_GPL(spi_busnum_to_master); */ int spi_setup(struct spi_device *spi) { + unsigned bad_bits; int status; + /* help drivers fail *cleanly* when they need options + * that aren't supported with their current master + */ + bad_bits = spi->mode & ~spi->master->mode_bits; + if (bad_bits) { + dev_dbg(&spi->dev, "setup: unsupported mode bits %x\n", + bad_bits); + return -EINVAL; + } + if (!spi->bits_per_word) spi->bits_per_word = 8; |