diff options
Diffstat (limited to 'drivers/w1/w1_int.c')
-rw-r--r-- | drivers/w1/w1_int.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c index 6840dfebe4d4..ed3228017dad 100644 --- a/drivers/w1/w1_int.c +++ b/drivers/w1/w1_int.c | |||
@@ -148,10 +148,22 @@ err_out_free_dev: | |||
148 | void __w1_remove_master_device(struct w1_master *dev) | 148 | void __w1_remove_master_device(struct w1_master *dev) |
149 | { | 149 | { |
150 | struct w1_netlink_msg msg; | 150 | struct w1_netlink_msg msg; |
151 | struct w1_slave *sl, *sln; | ||
151 | 152 | ||
152 | set_bit(W1_MASTER_NEED_EXIT, &dev->flags); | 153 | set_bit(W1_MASTER_NEED_EXIT, &dev->flags); |
153 | kthread_stop(dev->thread); | 154 | kthread_stop(dev->thread); |
154 | 155 | ||
156 | mutex_lock(&w1_mlock); | ||
157 | list_del(&dev->w1_master_entry); | ||
158 | mutex_unlock(&w1_mlock); | ||
159 | |||
160 | mutex_lock(&dev->mutex); | ||
161 | list_for_each_entry_safe(sl, sln, &dev->slist, w1_slave_entry) | ||
162 | w1_slave_detach(sl); | ||
163 | w1_destroy_master_attributes(dev); | ||
164 | mutex_unlock(&dev->mutex); | ||
165 | atomic_dec(&dev->refcnt); | ||
166 | |||
155 | while (atomic_read(&dev->refcnt)) { | 167 | while (atomic_read(&dev->refcnt)) { |
156 | dev_info(&dev->dev, "Waiting for %s to become free: refcnt=%d.\n", | 168 | dev_info(&dev->dev, "Waiting for %s to become free: refcnt=%d.\n", |
157 | dev->name, atomic_read(&dev->refcnt)); | 169 | dev->name, atomic_read(&dev->refcnt)); |