Skip to content

Commit

Permalink
w1_bq27000: Only one thread can access the bq27000 at a time.
Browse files Browse the repository at this point in the history
If multiple threads try, they trip over each other badly.

Signed-off-by: NeilBrown <[email protected]>
Acked-by: Evgeniy Polyakov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
neilbrown authored and gregkh committed Feb 24, 2012
1 parent df7019f commit f6e8a1d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/w1/slaves/w1_bq27000.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ static int w1_bq27000_read(struct device *dev, unsigned int reg)
u8 val;
struct w1_slave *sl = container_of(dev->parent, struct w1_slave, dev);

mutex_lock(&sl->master->mutex);
w1_write_8(sl->master, HDQ_CMD_READ | reg);
val = w1_read_8(sl->master);
mutex_unlock(&sl->master->mutex);

return val;
}
Expand Down

0 comments on commit f6e8a1d

Please sign in to comment.