diff options
author | NeilBrown <neilb@suse.de> | 2012-02-18 21:10:00 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-02-24 17:25:50 -0500 |
commit | f6e8a1d7b4c4087e13913da43deb45b3e3413f29 (patch) | |
tree | 412aeb428f3cf9a9817e000031920481a20a8f40 /drivers/w1/slaves | |
parent | df7019f37053bb5357907ec2d1fd516304f38348 (diff) |
w1_bq27000: Only one thread can access the bq27000 at a time.
If multiple threads try, they trip over each other badly.
Signed-off-by: NeilBrown <neilb@suse.de>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/w1/slaves')
-rw-r--r-- | drivers/w1/slaves/w1_bq27000.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/w1/slaves/w1_bq27000.c b/drivers/w1/slaves/w1_bq27000.c index 6ae60aa1315b..52ad812fa1e7 100644 --- a/drivers/w1/slaves/w1_bq27000.c +++ b/drivers/w1/slaves/w1_bq27000.c | |||
@@ -31,8 +31,10 @@ static int w1_bq27000_read(struct device *dev, unsigned int reg) | |||
31 | u8 val; | 31 | u8 val; |
32 | struct w1_slave *sl = container_of(dev->parent, struct w1_slave, dev); | 32 | struct w1_slave *sl = container_of(dev->parent, struct w1_slave, dev); |
33 | 33 | ||
34 | mutex_lock(&sl->master->mutex); | ||
34 | w1_write_8(sl->master, HDQ_CMD_READ | reg); | 35 | w1_write_8(sl->master, HDQ_CMD_READ | reg); |
35 | val = w1_read_8(sl->master); | 36 | val = w1_read_8(sl->master); |
37 | mutex_unlock(&sl->master->mutex); | ||
36 | 38 | ||
37 | return val; | 39 | return val; |
38 | } | 40 | } |