Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

spi: spi-gpio: Use 'cansleep' variants to access GPIO

The GPIO chip in use could be of any kind, and therefore might sleep
when accesing the GPIO lines. Take account of this by using cansleep
instead, which is the most generic case.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Mark Brown <broonie@linaro.org>

authored by

Ezequiel Garcia and committed by
Mark Brown
d9dda5a1 6ce4eac1

+4 -4
+4 -4
drivers/spi/spi-gpio.c
··· 115 115 116 116 static inline void setsck(const struct spi_device *spi, int is_on) 117 117 { 118 - gpio_set_value(SPI_SCK_GPIO, is_on); 118 + gpio_set_value_cansleep(SPI_SCK_GPIO, is_on); 119 119 } 120 120 121 121 static inline void setmosi(const struct spi_device *spi, int is_on) 122 122 { 123 - gpio_set_value(SPI_MOSI_GPIO, is_on); 123 + gpio_set_value_cansleep(SPI_MOSI_GPIO, is_on); 124 124 } 125 125 126 126 static inline int getmiso(const struct spi_device *spi) 127 127 { 128 - return !!gpio_get_value(SPI_MISO_GPIO); 128 + return !!gpio_get_value_cansleep(SPI_MISO_GPIO); 129 129 } 130 130 131 131 #undef pdata ··· 229 229 230 230 if (cs != SPI_GPIO_NO_CHIPSELECT) { 231 231 /* SPI is normally active-low */ 232 - gpio_set_value(cs, (spi->mode & SPI_CS_HIGH) ? is_active : !is_active); 232 + gpio_set_value_cansleep(cs, (spi->mode & SPI_CS_HIGH) ? is_active : !is_active); 233 233 } 234 234 } 235 235