aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Neukum <oliver@neukum.org>2009-07-02 06:07:07 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-09-23 09:46:28 -0400
commitd35b4ce164f393ad58580ad3e9fdde86328739ad (patch)
tree847f4cd7511d74e95dc9f0df96610b518eaf4212
parenta4708103adeaf5731c329b37b0a2b397f814c55c (diff)
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.c6
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)
552 552
553 dev = file->private_data; 553 dev = file->private_data;
554 554
555 if (!dev->udev)
556 return POLLERR | POLLHUP;
557
555 poll_wait(file, &dev->read_wait, wait); 558 poll_wait(file, &dev->read_wait, wait);
556 poll_wait(file, &dev->write_wait, wait); 559 poll_wait(file, &dev->write_wait, wait);
557 560
@@ -1025,6 +1028,9 @@ static void tower_disconnect (struct usb_interface *interface)
1025 tower_delete (dev); 1028 tower_delete (dev);
1026 } else { 1029 } else {
1027 dev->udev = NULL; 1030 dev->udev = NULL;
1031 /* wake up pollers */
1032 wake_up_interruptible_all(&dev->read_wait);
1033 wake_up_interruptible_all(&dev->write_wait);
1028 mutex_unlock(&dev->lock); 1034 mutex_unlock(&dev->lock);
1029 } 1035 }
1030 1036