patch-2.4.10 linux/drivers/usb/printer.c
Next file: linux/drivers/usb/pwc-ctrl.c
Previous file: linux/drivers/usb/plusb.c
Back to the patch index
Back to the overall index
- Lines: 72
- Date:
Tue Aug 28 14:36:18 2001
- Orig file:
v2.4.9/linux/drivers/usb/printer.c
- Orig date:
Wed Jul 25 17:10:24 2001
diff -u --recursive --new-file v2.4.9/linux/drivers/usb/printer.c linux/drivers/usb/printer.c
@@ -230,7 +230,7 @@
goto out;
}
#else
- retval = 0;
+ retval = 0;
#endif
usblp->used = 1;
@@ -242,7 +242,11 @@
if (usblp->bidir) {
usblp->readcount = 0;
usblp->readurb.dev = usblp->dev;
- usb_submit_urb(&usblp->readurb);
+ if (usb_submit_urb(&usblp->readurb) < 0) {
+ retval = -EIO;
+ usblp->used = 0;
+ file->private_data = NULL;
+ }
}
out:
unlock_kernel();
@@ -265,6 +269,7 @@
struct usblp *usblp = file->private_data;
down (&usblp->sem);
+ lock_kernel();
usblp->used = 0;
if (usblp->dev) {
if (usblp->bidir)
@@ -273,6 +278,7 @@
up(&usblp->sem);
} else /* finish cleanup from disconnect */
usblp_cleanup (usblp);
+ unlock_kernel();
return 0;
}
@@ -299,7 +305,7 @@
}
if (_IOC_TYPE(cmd) == 'P') /* new-style ioctl number */
-
+
switch (_IOC_NR(cmd)) {
case IOCNR_GET_DEVICE_ID: /* get the DEVICE_ID string */
@@ -658,7 +664,7 @@
#endif
sprintf(name, "lp%d", minor);
-
+
/* if we have devfs, create with perms=660 */
usblp->devfs = devfs_register(usb_devfs_handle, name,
DEVFS_FL_DEFAULT, USB_MAJOR,
@@ -682,6 +688,7 @@
}
down (&usblp->sem);
+ lock_kernel();
usblp->dev = NULL;
usb_unlink_urb(&usblp->writeurb);
@@ -692,6 +699,7 @@
usblp_cleanup (usblp);
else /* cleanup later, on close */
up (&usblp->sem);
+ unlock_kernel();
}
static struct usb_device_id usblp_ids [] = {
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)