Commit 251d166e authored by Evgeniy Polyakov's avatar Evgeniy Polyakov Committed by Greg Kroah-Hartman

[PATCH] w1: schedule_timeout() issues.

Need to set current state and check signals.
Signed-off-by: default avatarEvgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 8efe751d
......@@ -727,12 +727,19 @@ void ds_disconnect(struct usb_interface *intf)
{
struct ds_device *dev;
dev = usb_get_intfdata (intf);
usb_set_intfdata (intf, NULL);
dev = usb_get_intfdata(intf);
usb_set_intfdata(intf, NULL);
while(atomic_read(&dev->refcnt))
while (atomic_read(&dev->refcnt)) {
printk(KERN_INFO "Waiting for DS to become free: refcnt=%d.\n",
atomic_read(&dev->refcnt));
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(HZ);
if (signal_pending(current))
flush_signals(current);
}
usb_put_dev(dev->udev);
kfree(dev);
ds_dev = NULL;
......
......@@ -449,8 +449,15 @@ static void w1_slave_detach(struct w1_slave *sl)
dev_info(&sl->dev, "%s: detaching %s.\n", __func__, sl->name);
while (atomic_read(&sl->refcnt))
schedule_timeout(10);
while (atomic_read(&sl->refcnt)) {
printk(KERN_INFO "Waiting for %s to become free: refcnt=%d.\n",
sl->name, atomic_read(&sl->refcnt));
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(HZ);
if (signal_pending(current))
flush_signals(current);
}
sysfs_remove_bin_file (&sl->dev.kobj, &sl->attr_bin);
device_remove_file(&sl->dev, &sl->attr_name);
......@@ -507,8 +514,8 @@ static void w1_search(struct w1_master *dev)
* All who don't sleep must send ID bit and COMPLEMENT ID bit.
* They actually are ANDed between all senders.
*/
id_bit = w1_read_bit(dev);
comp_bit = w1_read_bit(dev);
id_bit = w1_touch_bit(dev, 1);
comp_bit = w1_touch_bit(dev, 1);
if (id_bit && comp_bit)
break;
......@@ -539,6 +546,9 @@ static void w1_search(struct w1_master *dev)
* and make all who don't have "search_bit" in "i"'th position
* in it's registration number sleep.
*/
if (dev->bus_master->touch_bit)
w1_touch_bit(dev, search_bit);
else
w1_write_bit(dev, search_bit);
}
......
......@@ -84,8 +84,15 @@ void w1_unregister_family(struct w1_family *fent)
spin_unlock(&w1_flock);
while (atomic_read(&fent->refcnt))
schedule_timeout(10);
while (atomic_read(&fent->refcnt)) {
printk(KERN_INFO "Waiting for family %u to become free: refcnt=%d.\n",
fent->fid, atomic_read(&fent->refcnt));
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(HZ);
if (signal_pending(current))
flush_signals(current);
}
}
/*
......
......@@ -181,8 +181,15 @@ void __w1_remove_master_device(struct w1_master *dev)
"%s: Failed to send signal to w1 kernel thread %d.\n",
__func__, dev->kpid);
while (atomic_read(&dev->refcnt))
schedule_timeout(10);
while (atomic_read(&dev->refcnt)) {
printk(KERN_INFO "Waiting for %s to become free: refcnt=%d.\n",
dev->name, atomic_read(&dev->refcnt));
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(HZ);
if (signal_pending(current))
flush_signals(current);
}
msg.id.mst.id = dev->id;
msg.id.mst.pid = dev->kpid;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment