[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1315385312-1176-1-git-send-email-j.weitzel@phytec.de>
Date: Wed, 7 Sep 2011 10:48:32 +0200
From: Jan Weitzel <j.weitzel@...tec.de>
To: linux-kernel@...r.kernel.org
Cc: zbr@...emap.net, Jan Weitzel <j.weitzel@...tec.de>
Subject: [RFC] w1: Disable irqs in critical section
Interrupting w1_delay in w1_read_bit results in missing the low level
on the w1 line and receiving "1" instead of "0".
Adding local_irq_save / local_irq_restore around the critical section
Signed-off-by: Jan Weitzel <j.weitzel@...tec.de>
---
drivers/w1/w1_io.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c
index 8e8b64c..a059eaa 100644
--- a/drivers/w1/w1_io.c
+++ b/drivers/w1/w1_io.c
@@ -158,13 +158,18 @@ EXPORT_SYMBOL_GPL(w1_write_8);
static u8 w1_read_bit(struct w1_master *dev)
{
int result;
+ unsigned long flags;
+ /* sample timing is critical here */
+ local_irq_save(flags);
dev->bus_master->write_bit(dev->bus_master->data, 0);
w1_delay(6);
dev->bus_master->write_bit(dev->bus_master->data, 1);
w1_delay(9);
result = dev->bus_master->read_bit(dev->bus_master->data);
+ local_irq_restore(flags);
+
w1_delay(55);
return result & 0x1;
--
1.7.0.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists