summaryrefslogtreecommitdiffstats
path: root/drivers/w1/masters/ds1wm.c
diff options
context:
space:
mode:
authorDavid Fries <David@Fries.net>2014-01-16 05:29:26 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-02-08 00:40:18 +0100
commitd3a8a9dbb903c73a7ec2deae4c9b7d74b6834f4c (patch)
tree49128d16abf121d8ae8c555a17a1339a09ff7585 /drivers/w1/masters/ds1wm.c
parentw1: format for DocBook and fixes (diff)
downloadlinux-d3a8a9dbb903c73a7ec2deae4c9b7d74b6834f4c.tar.xz
linux-d3a8a9dbb903c73a7ec2deae4c9b7d74b6834f4c.zip
w1: hold bus_mutex in netlink and search
The bus_mutex needs to be taken to serialize access to a specific bus. netlink wasn't updated when bus_mutex was added and was calling without that lock held, and not all of the masters were holding the bus_mutex in a search. This was causing the ds2490 hardware to stop responding when both netlink and /sys slaves were executing bus commands at the same time. Signed-off-by: David Fries <David@Fries.net> Acked-by: Evgeniy Polyakov <zbr@ioremap.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/w1/masters/ds1wm.c')
-rw-r--r--drivers/w1/masters/ds1wm.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/w1/masters/ds1wm.c b/drivers/w1/masters/ds1wm.c
index 02df3b1381d2..b077b8b42758 100644
--- a/drivers/w1/masters/ds1wm.c
+++ b/drivers/w1/masters/ds1wm.c
@@ -326,13 +326,14 @@ static void ds1wm_search(void *data, struct w1_master *master_dev,
unsigned slaves_found = 0;
unsigned int pass = 0;
+ mutex_lock(&master_dev->bus_mutex);
dev_dbg(&ds1wm_data->pdev->dev, "search begin\n");
while (true) {
++pass;
if (pass > 100) {
dev_dbg(&ds1wm_data->pdev->dev,
"too many attempts (100), search aborted\n");
- return;
+ break;
}
mutex_lock(&master_dev->bus_mutex);
@@ -439,6 +440,7 @@ static void ds1wm_search(void *data, struct w1_master *master_dev,
dev_dbg(&ds1wm_data->pdev->dev,
"pass: %d total: %d search done ms d bit pos: %d\n", pass,
slaves_found, ms_discrep_bit);
+ mutex_unlock(&master_dev->bus_mutex);
}
/* --------------------------------------------------------------------- */