From: Jan Weitzel Date: Wed, 2 Nov 2011 20:40:02 +0000 (-0700) Subject: w1: disable irqs in critical section X-Git-Tag: MMI-PSA29.97-13-9~18147^2~4 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3fd306c85adcde7209281cb663dd8ea247e97cc3;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git 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". Add local_irq_save()/local_irq_restore() around the critical section Signed-off-by: Jan Weitzel Acked-by: Evgeniy Polyakov Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c index 765b37b62a4f..3135b2c63998 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;