public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers/w1/masters/w1-gpio.c: fix read_bit()
@ 2009-03-09 16:02 Daniel Mack
  2009-03-10  2:14 ` Andrew Morton
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Mack @ 2009-03-09 16:02 UTC (permalink / raw)
  To: linux-kernel; +Cc: Daniel Mack, Ville Syrjala, Evgeniy Polyakov

W1 master implementations are expected to return 0 or 1 from their
read_bit() function. However, not all platforms do return these values
from gpio_get_value() - namely PXAs won't. Hence the w1 gpio-master
needs to break the result down to 0 or 1 itself.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Ville Syrjala <syrjala@sci.fi>
Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
---
 drivers/w1/masters/w1-gpio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c
index 9e1138a..a411702 100644
--- a/drivers/w1/masters/w1-gpio.c
+++ b/drivers/w1/masters/w1-gpio.c
@@ -39,7 +39,7 @@ static u8 w1_gpio_read_bit(void *data)
 {
 	struct w1_gpio_platform_data *pdata = data;
 
-	return gpio_get_value(pdata->pin);
+	return gpio_get_value(pdata->pin) ? 1 : 0;
 }
 
 static int __init w1_gpio_probe(struct platform_device *pdev)
-- 
1.6.1.3


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-03-11  1:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-09 16:02 [PATCH] drivers/w1/masters/w1-gpio.c: fix read_bit() Daniel Mack
2009-03-10  2:14 ` Andrew Morton
2009-03-10  9:18   ` Daniel Mack
2009-03-10 22:00     ` Andrew Morton
2009-03-10 23:59       ` Ville Syrjälä
2009-03-11  0:10       ` Daniel Mack
2009-03-11  1:17         ` Andrew Morton
2009-03-10 14:13   ` Ville Syrjälä

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox