aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/class/usblp.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-07 22:23:21 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-07 22:23:21 -0500
commitc96e2c92072d3e78954c961f53d8c7352f7abbd7 (patch)
treed844f26f926ff40e98e9eae0e11fd71acad81df4 /drivers/usb/class/usblp.c
parentf2aca47dc3c2d0c2d5dbd972558557e74232bbce (diff)
parent64358164f5bfe5e11d4040c1eb674c29e1436ce5 (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: (70 commits) USB: remove duplicate device id from zc0301 USB: remove duplicate device id from usb_storage USB: remove duplicate device id from keyspan USB: remove duplicate device id from ftdi_sio USB: remove duplicate device id from visor USB: a bit more coding style cleanup usbcore: trivial whitespace fixes usb-storage: use first bulk endpoints, not last EHCI: fix interrupt-driven remote wakeup USB: switch ehci-hcd to new polling scheme USB: autosuspend for usb printer driver USB Input: Added kernel module to support all GTCO CalComp USB InterWrite School products USB: Sierra Wireless auto set D0 USB: usb ethernet gadget recognizes HUSB2DEV USB: list atmel husb2_udc gadget controller USB: gadgetfs AIO tweaks USB: gadgetfs behaves better on userspace init bug USB: gadgetfs race fix USB: gadgetfs simplifications USB: gadgetfs cleanups ...
Diffstat (limited to 'drivers/usb/class/usblp.c')
-rw-r--r--drivers/usb/class/usblp.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index 6377db1b446d..63e50a1f1396 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -398,6 +398,9 @@ static int usblp_open(struct inode *inode, struct file *file)
398 retval = 0; 398 retval = 0;
399#endif 399#endif
400 400
401 retval = usb_autopm_get_interface(intf);
402 if (retval < 0)
403 goto out;
401 usblp->used = 1; 404 usblp->used = 1;
402 file->private_data = usblp; 405 file->private_data = usblp;
403 406
@@ -442,6 +445,7 @@ static int usblp_release(struct inode *inode, struct file *file)
442 usblp->used = 0; 445 usblp->used = 0;
443 if (usblp->present) { 446 if (usblp->present) {
444 usblp_unlink_urbs(usblp); 447 usblp_unlink_urbs(usblp);
448 usb_autopm_put_interface(usblp->intf);
445 } else /* finish cleanup from disconnect */ 449 } else /* finish cleanup from disconnect */
446 usblp_cleanup (usblp); 450 usblp_cleanup (usblp);
447 mutex_unlock (&usblp_mutex); 451 mutex_unlock (&usblp_mutex);
@@ -1203,14 +1207,9 @@ static int usblp_suspend (struct usb_interface *intf, pm_message_t message)
1203{ 1207{
1204 struct usblp *usblp = usb_get_intfdata (intf); 1208 struct usblp *usblp = usb_get_intfdata (intf);
1205 1209
1206 /* this races against normal access and open */
1207 mutex_lock (&usblp_mutex);
1208 mutex_lock (&usblp->mut);
1209 /* we take no more IO */ 1210 /* we take no more IO */
1210 usblp->sleeping = 1; 1211 usblp->sleeping = 1;
1211 usblp_unlink_urbs(usblp); 1212 usblp_unlink_urbs(usblp);
1212 mutex_unlock (&usblp->mut);
1213 mutex_unlock (&usblp_mutex);
1214 1213
1215 return 0; 1214 return 0;
1216} 1215}
@@ -1220,15 +1219,9 @@ static int usblp_resume (struct usb_interface *intf)
1220 struct usblp *usblp = usb_get_intfdata (intf); 1219 struct usblp *usblp = usb_get_intfdata (intf);
1221 int r; 1220 int r;
1222 1221
1223 mutex_lock (&usblp_mutex);
1224 mutex_lock (&usblp->mut);
1225
1226 usblp->sleeping = 0; 1222 usblp->sleeping = 0;
1227 r = handle_bidir (usblp); 1223 r = handle_bidir (usblp);
1228 1224
1229 mutex_unlock (&usblp->mut);
1230 mutex_unlock (&usblp_mutex);
1231
1232 return r; 1225 return r;
1233} 1226}
1234 1227
@@ -1251,6 +1244,7 @@ static struct usb_driver usblp_driver = {
1251 .suspend = usblp_suspend, 1244 .suspend = usblp_suspend,
1252 .resume = usblp_resume, 1245 .resume = usblp_resume,
1253 .id_table = usblp_ids, 1246 .id_table = usblp_ids,
1247 .supports_autosuspend = 1,
1254}; 1248};
1255 1249
1256static int __init usblp_init(void) 1250static int __init usblp_init(void)