summaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/ldusb.c
diff options
context:
space:
mode:
authorOliver Neukum <oliver@neukum.org>2009-07-02 17:01:06 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2009-09-23 06:46:28 -0700
commitd12b85e7de1abce4db940ebb169f064583b5796e (patch)
tree4af5cee5da605f9ce061b3f033de6f9e767d79a9 /drivers/usb/misc/ldusb.c
parentd35b4ce164f393ad58580ad3e9fdde86328739ad (diff)
USB: ldusb should signal an error in poll if the device is disconnected
poll() should test for a disconnection of the device. Signed-off-by: Oliver Neukum <oliver@neukum.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/misc/ldusb.c')
-rw-r--r--drivers/usb/misc/ldusb.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c
index ad4fb15b5dc..90f130126c1 100644
--- a/drivers/usb/misc/ldusb.c
+++ b/drivers/usb/misc/ldusb.c
@@ -412,6 +412,9 @@ static unsigned int ld_usb_poll(struct file *file, poll_table *wait)
dev = file->private_data;
+ if (!dev->intf)
+ return POLLERR | POLLHUP;
+
poll_wait(file, &dev->read_wait, wait);
poll_wait(file, &dev->write_wait, wait);
@@ -767,6 +770,9 @@ static void ld_usb_disconnect(struct usb_interface *intf)
ld_usb_delete(dev);
} else {
dev->intf = NULL;
+ /* wake up pollers */
+ wake_up_interruptible_all(&dev->read_wait);
+ wake_up_interruptible_all(&dev->write_wait);
mutex_unlock(&dev->mutex);
}