aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/w1/w1_family.c
diff options
context:
space:
mode:
authorDavid Fries <david@fries.net>2008-10-16 01:04:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-16 14:21:49 -0400
commitc30c9b15187e977ab5928f7276e9dfcd8d6f9460 (patch)
treed36d7513c5acf1d39f581625ffa5c1915ae5627f /drivers/w1/w1_family.c
parentdd78c9439fc1e031835bccb934d27b978c72c536 (diff)
W1: fix deadlocks and remove w1_control_thread
w1_control_thread was removed which would wake up every second and process newly registered family codes and complete some final cleanup for a removed master. Those routines were moved to the threads that were previously requesting those operations. A new function w1_reconnect_slaves takes care of reconnecting existing slave devices when a new family code is registered or removed. The removal case was missing and would cause a deadlock waiting for the family code reference count to decrease, which will now happen. A problem with registering a family code was fixed. A slave device would be unattached if it wasn't yet claimed, then attached at the end of the list, two unclaimed slaves would cause an infinite loop. The struct w1_bus_master.search now takes a pointer to the struct w1_master device to avoid searching for it, which would have caused a lock ordering deadlock with the removal of w1_control_thread. Signed-off-by: David Fries <david@fries.net> Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/w1/w1_family.c')
-rw-r--r--drivers/w1/w1_family.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/w1/w1_family.c b/drivers/w1/w1_family.c
index a3c95bd6890a..8c35f9ccb689 100644
--- a/drivers/w1/w1_family.c
+++ b/drivers/w1/w1_family.c
@@ -53,7 +53,8 @@ int w1_register_family(struct w1_family *newf)
53 } 53 }
54 spin_unlock(&w1_flock); 54 spin_unlock(&w1_flock);
55 55
56 w1_reconnect_slaves(newf); 56 /* check default devices against the new set of drivers */
57 w1_reconnect_slaves(newf, 1);
57 58
58 return ret; 59 return ret;
59} 60}
@@ -77,6 +78,9 @@ void w1_unregister_family(struct w1_family *fent)
77 78
78 spin_unlock(&w1_flock); 79 spin_unlock(&w1_flock);
79 80
81 /* deatch devices using this family code */
82 w1_reconnect_slaves(fent, 0);
83
80 while (atomic_read(&fent->refcnt)) { 84 while (atomic_read(&fent->refcnt)) {
81 printk(KERN_INFO "Waiting for family %u to become free: refcnt=%d.\n", 85 printk(KERN_INFO "Waiting for family %u to become free: refcnt=%d.\n",
82 fent->fid, atomic_read(&fent->refcnt)); 86 fent->fid, atomic_read(&fent->refcnt));