Linux SPI subsystem development
 help / color / mirror / Atom feed
* [PATCH] spi: Make spi_delay_exec() warn if called from atomic context
@ 2020-05-22 15:50 Mark Brown
  2020-05-22 16:02 ` Andy Shevchenko
  2020-05-25 14:57 ` Mark Brown
  0 siblings, 2 replies; 6+ messages in thread
From: Mark Brown @ 2020-05-22 15:50 UTC (permalink / raw)
  To: Serge Semin, Andy Shevchenko; +Cc: linux-spi, Mark Brown

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>
---
 drivers/spi/spi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index e02f434affca..c69d23379e08 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;
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-05-25 14:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-22 15:50 [PATCH] spi: Make spi_delay_exec() warn if called from atomic context Mark Brown
2020-05-22 16:02 ` Andy Shevchenko
2020-05-22 16:04   ` Andy Shevchenko
2020-05-22 16:10     ` Serge Semin
2020-05-22 16:18       ` Mark Brown
2020-05-25 14:57 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox