The patch spi: use gpio[d]_set_value_cansleep for setting chipselect GPIO has been applied to the spi tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From 28f7604f48c1cbb69e9c45bc53c84b6ad1f7fa77 Mon Sep 17 00:00:00 2001 From: Felix Fietkau <nbd@xxxxxxxx> Date: Sun, 10 Feb 2019 00:38:25 +0100 Subject: [PATCH] spi: use gpio[d]_set_value_cansleep for setting chipselect GPIO Sleeping is safe inside spi_transfer_one_message, and some GPIO chips are running on slow busses (such as I2C GPIO expanders) and need to sleep for setting values. Signed-off-by: Felix Fietkau <nbd@xxxxxxxx> Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx> Signed-off-by: Mark Brown <broonie@xxxxxxxxxx> --- drivers/spi/spi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 2f7176f07591..93986f879b09 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -786,9 +786,10 @@ static void spi_set_cs(struct spi_device *spi, bool enable) */ if (!(spi->mode & SPI_NO_CS)) { if (spi->cs_gpiod) - gpiod_set_value(spi->cs_gpiod, !enable); + gpiod_set_value_cansleep(spi->cs_gpiod, + !enable); else - gpio_set_value(spi->cs_gpio, !enable); + gpio_set_value_cansleep(spi->cs_gpio, !enable); } /* Some SPI masters need both GPIO CS & slave_select */ if ((spi->controller->flags & SPI_MASTER_GPIO_SS) && -- 2.20.1