summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Reding <thierry.reding@avionic-design.de>2011-08-04 04:14:11 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-08-31 17:20:23 -0300
commit6f2e77bb955771a7b8de80ea519c1e9a82b864dd (patch)
tree56f2b460327768ae1ab053b102cfc0ceb841ea4e
parentfc4eab2cbae547fb278c2583b77ee0ff7f5832d3 (diff)
downloadlinux-stable-6f2e77bb955771a7b8de80ea519c1e9a82b864dd.tar.gz
linux-stable-6f2e77bb955771a7b8de80ea519c1e9a82b864dd.tar.bz2
linux-stable-6f2e77bb955771a7b8de80ea519c1e9a82b864dd.zip
[media] tm6000: Properly count device usage
When the USB device is disconnected, the device usage bit is not cleared properly. This leads to errors when a device is unplugged and replugged several times until all TM6000_MAXBOARDS bits are used and keeps the driver from binding to the device. Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/staging/tm6000/tm6000-cards.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c
index f247e7e685f9..d2ee18ffd49f 100644
--- a/drivers/staging/tm6000/tm6000-cards.c
+++ b/drivers/staging/tm6000/tm6000-cards.c
@@ -1171,7 +1171,7 @@ static int tm6000_usb_probe(struct usb_interface *interface,
mutex_init(&dev->usb_lock);
/* Increment usage count */
- tm6000_devused |= 1<<nr;
+ set_bit(nr, &tm6000_devused);
snprintf(dev->name, 29, "tm6000 #%d", nr);
dev->model = id->driver_info;
@@ -1287,7 +1287,7 @@ static int tm6000_usb_probe(struct usb_interface *interface,
err:
printk(KERN_ERR "tm6000: Error %d while registering\n", rc);
- tm6000_devused &= ~(1<<nr);
+ clear_bit(nr, &tm6000_devused);
usb_put_dev(usbdev);
kfree(dev);
@@ -1345,6 +1345,7 @@ static void tm6000_usb_disconnect(struct usb_interface *interface)
tm6000_close_extension(dev);
tm6000_remove_from_devlist(dev);
+ clear_bit(dev->devno, &tm6000_devused);
kfree(dev);
}