spi-gpio: sanitize MISO bitvalue
authorMichael Buesch <mb@bu3sch.de>
Wed, 18 Feb 2009 22:48:41 +0000 (14:48 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 18 Feb 2009 23:37:56 +0000 (15:37 -0800)
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>
drivers/spi/spi_gpio.c

index 49698ca..f5ed972 100644 (file)
@@ -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)
 {
-       return gpio_get_value(SPI_MISO_GPIO);
+       return !!gpio_get_value(SPI_MISO_GPIO);
 }
 
 #undef pdata