diff options
author | Mark Brown <broonie@kernel.org> | 2020-05-22 17:50:05 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2020-05-22 21:00:00 +0200 |
commit | 8fede89f853a7bfc671f9d8f069ccfe4190061f3 (patch) | |
tree | cc68b1e4c2b126aea62a824f5353c838482a4c07 /drivers/spi | |
parent | Merge series "spi: dw: Add generic DW DMA controller support" from Serge Semi... (diff) | |
download | linux-8fede89f853a7bfc671f9d8f069ccfe4190061f3.tar.xz linux-8fede89f853a7bfc671f9d8f069ccfe4190061f3.zip |
spi: Make spi_delay_exec() warn if called from atomic context
If the delay used is long enough the spi_delay_exec() will use a sleeping
function to implement it. Add a might_sleep() here to help avoid callers
using this from an atomic context and running into problems at runtime on
other systems.
Suggested-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Signed-off-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200522155005.46099-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index d32bdc6cbf66..c765c966cc8e 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1160,6 +1160,8 @@ int spi_delay_exec(struct spi_delay *_delay, struct spi_transfer *xfer) { int delay; + might_sleep(); + if (!_delay) return -EINVAL; |