This one was in my queue ... the refcounting should really
be "while device is open", shouldn't it? (Anders reported
later that this patch didn't solve the problem.)
usblp_open and usblp_release should do the refcounts,
not usblp_probe and usblp_disconnect. And I think a
semaphore should probably protect access to the
printer data structures in usblp_{read,write}. I seem
to recall thinking I got this kind of locking right in the
dc2xx code, thereby stopping very similar oopses in
the middle of streaming bulk I/O (big jpg from camera,
instead of big bitmap to printer). But it sure surprised
me how long it took for that bug to get reported!
- Dave
----- Original Message -----
From: "Randy.Dunlap" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, February 12, 2001 5:31 PM
Subject: Re: [linux-usb-devel] Bug report (2.4.1)
> Hi Anders,
>
> Would you see if the attached patch helps prevent the oops
> that you were seeing on removal of a USB printer while
> printing?
>
> It adds reference counting to the USB printer driver.
>
> Thanks,
> ~Randy
>
>
> > > From: David Brownell [mailto:[EMAIL PROTECTED]]
> > >
> > > Anders Buch wrote:
> > >
> > > > I have a printer (Epson 980) connected to my USB port. If I turn my
> > > > printer off and immediately after cat a large file to /dev/usb/lp0,
> > > > then the kernel oops'es and locks up.
> > >
> > > Well, someone's got the refcount wrong on this device.
> > > Either "printer.c"
> > > or "usb-ohci.c", I'd have to look more to find out.
--------------------------------------------------------------------------------
> --- linux/drivers/usb/printer.c.org Thu Jan 4 13:15:32 2001
> +++ linux/drivers/usb/printer.c Mon Feb 12 17:07:30 2001
> @@ -1,5 +1,5 @@
> /*
> - * printer.c Version 0.6
> + * printer.c Version 0.7
> *
> * Copyright (c) 1999 Michael Gee <[EMAIL PROTECTED]>
> * Copyright (c) 1999 Pavel Machek <[EMAIL PROTECTED]>
> @@ -17,6 +17,7 @@
> * v0.4 - fixes in unidirectional mode
> * v0.5 - add DEVICE_ID string support
> * v0.6 - never time out
> + * v0.7 - add refcnt-ing
> */
>
> /*
> @@ -550,6 +551,9 @@
> FILL_BULK_URB(&usblp->readurb, dev, usb_rcvbulkpipe(dev, epread->bEndpointAddress),
> buf + USBLP_BUF_SIZE, USBLP_BUF_SIZE, usblp_bulk, usblp);
>
> + /* Commit to using it; increment its refcnt. */
> + usb_inc_dev_use(dev);
> +
> /* Get the device_id string if possible. FIXME: Could make this kmalloc(length). */
> err = usblp_get_id(usblp, 0, usblp->device_id_string, DEVICE_ID_SIZE - 1);
> if (err >= 0) {
> @@ -586,6 +590,7 @@
> return;
> }
>
> + usb_dec_dev_use(usblp->dev); /* decrement refcnt */
> usblp->dev = NULL;
>
> usb_unlink_urb(&usblp->writeurb);
>
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
http://lists.sourceforge.net/lists/listinfo/linux-usb-devel