Now a device which can be disconnected all day, open by CUPS or not.
This appeases the BKL Hater Nazis as well.
-- Pete
diff -urN -X dontdiff linux-2.4.26/drivers/usb/printer.c
linux-2.4.26-nip/drivers/usb/printer.c
--- linux-2.4.26/drivers/usb/printer.c 2004-04-14 17:33:16.000000000 -0700
+++ linux-2.4.26-nip/drivers/usb/printer.c 2004-04-14 18:13:27.000000000 -0700
@@ -222,6 +222,7 @@
static int usblp_set_protocol(struct usblp *usblp, int protocol);
static int usblp_cache_device_id_string(struct usblp *usblp);
+static DECLARE_MUTEX(usblp_sem); /* locks the existence of usblp's. */
/*
* Functions for usblp control messages.
@@ -332,7 +333,7 @@
if (minor < 0 || minor >= USBLP_MINORS)
return -ENODEV;
- lock_kernel();
+ down (&usblp_sem);
usblp = usblp_table[minor];
retval = -ENODEV;
@@ -374,7 +375,7 @@
}
}
out:
- unlock_kernel();
+ up (&usblp_sem);
return retval;
}
@@ -404,15 +405,13 @@
{
struct usblp *usblp = file->private_data;
- down (&usblp->sem);
- lock_kernel();
+ down (&usblp_sem);
usblp->used = 0;
if (usblp->present) {
usblp_unlink_urbs(usblp);
- up(&usblp->sem);
} else /* finish cleanup from disconnect */
usblp_cleanup (usblp);
- unlock_kernel();
+ up (&usblp_sem);
return 0;
}
@@ -1112,17 +1111,16 @@
BUG ();
}
+ down (&usblp_sem);
down (&usblp->sem);
- lock_kernel();
usblp->present = 0;
usblp_unlink_urbs(usblp);
+ up (&usblp->sem);
if (!usblp->used)
usblp_cleanup (usblp);
- else /* cleanup later, on release */
- up (&usblp->sem);
- unlock_kernel();
+ up (&usblp_sem);
}
static struct usb_device_id usblp_ids [] = {
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel