提交 d9dda5a1 编写于 作者: E Ezequiel Garcia 提交者: Mark Brown

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: NEzequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: NMark Brown <broonie@linaro.org>
上级 6ce4eac1
...@@ -115,17 +115,17 @@ spi_to_pdata(const struct spi_device *spi) ...@@ -115,17 +115,17 @@ spi_to_pdata(const struct spi_device *spi)
static inline void setsck(const struct spi_device *spi, int is_on) static inline void setsck(const struct spi_device *spi, int is_on)
{ {
gpio_set_value(SPI_SCK_GPIO, is_on); gpio_set_value_cansleep(SPI_SCK_GPIO, is_on);
} }
static inline void setmosi(const struct spi_device *spi, int is_on) static inline void setmosi(const struct spi_device *spi, int is_on)
{ {
gpio_set_value(SPI_MOSI_GPIO, is_on); gpio_set_value_cansleep(SPI_MOSI_GPIO, is_on);
} }
static inline int getmiso(const struct spi_device *spi) static inline int getmiso(const struct spi_device *spi)
{ {
return !!gpio_get_value(SPI_MISO_GPIO); return !!gpio_get_value_cansleep(SPI_MISO_GPIO);
} }
#undef pdata #undef pdata
...@@ -229,7 +229,7 @@ static void spi_gpio_chipselect(struct spi_device *spi, int is_active) ...@@ -229,7 +229,7 @@ static void spi_gpio_chipselect(struct spi_device *spi, int is_active)
if (cs != SPI_GPIO_NO_CHIPSELECT) { if (cs != SPI_GPIO_NO_CHIPSELECT) {
/* SPI is normally active-low */ /* SPI is normally active-low */
gpio_set_value(cs, (spi->mode & SPI_CS_HIGH) ? is_active : !is_active); gpio_set_value_cansleep(cs, (spi->mode & SPI_CS_HIGH) ? is_active : !is_active);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册