diff options
author | Oliver Neukum <oliver@neukum.org> | 2009-07-02 12:07:07 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-09-23 15:46:28 +0200 |
commit | d35b4ce164f393ad58580ad3e9fdde86328739ad (patch) | |
tree | 847f4cd7511d74e95dc9f0df96610b518eaf4212 | |
parent | USB: suspend/resume support for usbtmc (diff) | |
download | linux-d35b4ce164f393ad58580ad3e9fdde86328739ad.tar.xz linux-d35b4ce164f393ad58580ad3e9fdde86328739ad.zip |
USB: legousbtower: make poll notice disconnect
poll needs to return an error if a device is disconnected
- make poll check for device's presence
- wake all waiters in disconnect
Signed-off-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/misc/legousbtower.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index 97efeaec4d52..faa6d623de78 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c @@ -552,6 +552,9 @@ static unsigned int tower_poll (struct file *file, poll_table *wait) dev = file->private_data; + if (!dev->udev) + return POLLERR | POLLHUP; + poll_wait(file, &dev->read_wait, wait); poll_wait(file, &dev->write_wait, wait); @@ -1025,6 +1028,9 @@ static void tower_disconnect (struct usb_interface *interface) tower_delete (dev); } else { dev->udev = NULL; + /* wake up pollers */ + wake_up_interruptible_all(&dev->read_wait); + wake_up_interruptible_all(&dev->write_wait); mutex_unlock(&dev->lock); } |