aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/class/usblp.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-03-21 12:25:47 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-21 12:25:47 -0500
commit2bf2154c6bb5599e3ec3f73c34861a0b12aa839e (patch)
tree62691bd915e2e3c2e6648306d3fb893f7a1dc57e /drivers/usb/class/usblp.c
parent08a4ecee986dd98e86090ff5faac4782b6765aed (diff)
parent71a8924bee63d891f6256d560e32416a458440b3 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6: (81 commits) [PATCH] USB: omninet: fix up debugging comments [PATCH] USB serial: add navman driver [PATCH] USB: Fix irda-usb use after use [PATCH] USB: rtl8150 small fix [PATCH] USB: ftdi_sio: add Icom ID1 USB product and vendor ids [PATCH] USB: cp2101: add new device IDs [PATCH] USB: fix check_ctrlrecip to allow control transfers in state ADDRESS [PATCH] USB: vicam.c: fix a NULL pointer dereference [PATCH] USB: ZC0301 driver bugfix [PATCH] USB: add support for Creativelabs Silvercrest USB keyboard [PATCH] USB: storage: new unusual_devs.h entry: Mitsumi 7in1 Card Reader [PATCH] USB: storage: unusual_devs.h entry 0420:0001 [PATCH] USB: storage: another unusual_devs.h entry [PATCH] USB: storage: sandisk unusual_devices entry [PATCH] USB: fix initdata issue in isp116x-hcd [PATCH] USB: usbcore: usb_set_configuration oops (NULL ptr dereference) [PATCH] USB: usbcore: Don't assume a USB configuration includes any interfaces [PATCH] USB: ub 03 drop stall clearing [PATCH] USB: ub 02 remove diag [PATCH] USB: ub 01 remove first_open ...
Diffstat (limited to 'drivers/usb/class/usblp.c')
-rw-r--r--drivers/usb/class/usblp.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index d34848ac30b0..48dee4b8d8e5 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -55,6 +55,7 @@
55#include <linux/init.h> 55#include <linux/init.h>
56#include <linux/slab.h> 56#include <linux/slab.h>
57#include <linux/lp.h> 57#include <linux/lp.h>
58#include <linux/mutex.h>
58#undef DEBUG 59#undef DEBUG
59#include <linux/usb.h> 60#include <linux/usb.h>
60 61
@@ -223,7 +224,7 @@ static int usblp_cache_device_id_string(struct usblp *usblp);
223 224
224/* forward reference to make our lives easier */ 225/* forward reference to make our lives easier */
225static struct usb_driver usblp_driver; 226static struct usb_driver usblp_driver;
226static DECLARE_MUTEX(usblp_sem); /* locks the existence of usblp's */ 227static DEFINE_MUTEX(usblp_mutex); /* locks the existence of usblp's */
227 228
228/* 229/*
229 * Functions for usblp control messages. 230 * Functions for usblp control messages.
@@ -351,7 +352,7 @@ static int usblp_open(struct inode *inode, struct file *file)
351 if (minor < 0) 352 if (minor < 0)
352 return -ENODEV; 353 return -ENODEV;
353 354
354 down (&usblp_sem); 355 mutex_lock (&usblp_mutex);
355 356
356 retval = -ENODEV; 357 retval = -ENODEV;
357 intf = usb_find_interface(&usblp_driver, minor); 358 intf = usb_find_interface(&usblp_driver, minor);
@@ -399,7 +400,7 @@ static int usblp_open(struct inode *inode, struct file *file)
399 } 400 }
400 } 401 }
401out: 402out:
402 up (&usblp_sem); 403 mutex_unlock (&usblp_mutex);
403 return retval; 404 return retval;
404} 405}
405 406
@@ -425,13 +426,13 @@ static int usblp_release(struct inode *inode, struct file *file)
425{ 426{
426 struct usblp *usblp = file->private_data; 427 struct usblp *usblp = file->private_data;
427 428
428 down (&usblp_sem); 429 mutex_lock (&usblp_mutex);
429 usblp->used = 0; 430 usblp->used = 0;
430 if (usblp->present) { 431 if (usblp->present) {
431 usblp_unlink_urbs(usblp); 432 usblp_unlink_urbs(usblp);
432 } else /* finish cleanup from disconnect */ 433 } else /* finish cleanup from disconnect */
433 usblp_cleanup (usblp); 434 usblp_cleanup (usblp);
434 up (&usblp_sem); 435 mutex_unlock (&usblp_mutex);
435 return 0; 436 return 0;
436} 437}
437 438
@@ -1152,7 +1153,7 @@ static void usblp_disconnect(struct usb_interface *intf)
1152 1153
1153 device_remove_file(&intf->dev, &dev_attr_ieee1284_id); 1154 device_remove_file(&intf->dev, &dev_attr_ieee1284_id);
1154 1155
1155 down (&usblp_sem); 1156 mutex_lock (&usblp_mutex);
1156 down (&usblp->sem); 1157 down (&usblp->sem);
1157 usblp->present = 0; 1158 usblp->present = 0;
1158 usb_set_intfdata (intf, NULL); 1159 usb_set_intfdata (intf, NULL);
@@ -1166,7 +1167,7 @@ static void usblp_disconnect(struct usb_interface *intf)
1166 1167
1167 if (!usblp->used) 1168 if (!usblp->used)
1168 usblp_cleanup (usblp); 1169 usblp_cleanup (usblp);
1169 up (&usblp_sem); 1170 mutex_unlock (&usblp_mutex);
1170} 1171}
1171 1172
1172static struct usb_device_id usblp_ids [] = { 1173static struct usb_device_id usblp_ids [] = {