spi-gpio: sanitize MISO bitvalue
gpio_get_value() returns 0 or nonzero, but getmiso() expects 0 or 1. Sanitize the value to a 0/1 boolean. Signed-off-by: Michael Buesch <mb@bu3sch.de> Acked-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
97bef7dd05
commit
be50344e60
@@ -114,7 +114,7 @@ static inline void setmosi(const struct spi_device *spi, int 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(SPI_MISO_GPIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef pdata
|
#undef pdata
|
||||||
|
Reference in New Issue
Block a user