diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2015-08-16 23:52:54 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-09-17 07:13:40 -0400 |
commit | c15f6ed3a18f10cdc33f64906ab353f17a6df114 (patch) | |
tree | d31632b7d325d16e602437062832c01eabae2451 /include/linux/spi | |
parent | 6ff33f3902c3b1c5d0db6b1e2c70b6d76fba357f (diff) |
spi: bitbang: Replace spinlock by mutex
chipselect (in the case of spi-gpio: spi_gpio_chipselect, which
calls gpiod_set_raw_value_cansleep) can sleep, so we should not
hold a spinlock while calling it from spi_bitbang_setup.
This issue was introduced by this commit, which converted spi-gpio
to cansleep variants:
d9dda5a191 "spi: spi-gpio: Use 'cansleep' variants to access GPIO"
Replacing the lock variable by a mutex fixes the issue: This is
safe as all instances where the lock is used are called from
contexts that can sleep.
Finally, update spi-ppc4xx and and spi-s3c24xx to use mutex
functions, as they directly hold the lock for similar purpose.
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include/linux/spi')
-rw-r--r-- | include/linux/spi/spi_bitbang.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h index 85578d4be034..154788ed218c 100644 --- a/include/linux/spi/spi_bitbang.h +++ b/include/linux/spi/spi_bitbang.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <linux/workqueue.h> | 4 | #include <linux/workqueue.h> |
5 | 5 | ||
6 | struct spi_bitbang { | 6 | struct spi_bitbang { |
7 | spinlock_t lock; | 7 | struct mutex lock; |
8 | u8 busy; | 8 | u8 busy; |
9 | u8 use_dma; | 9 | u8 use_dma; |
10 | u8 flags; /* extra spi->mode support */ | 10 | u8 flags; /* extra spi->mode support */ |