Re: [linux-usb-devel] 2.6.5-rc3-mm4 breaks xsane, hangs on device scan at launch

From: Gene Heskett
Date: Tue Apr 06 2004 - 15:10:58 EST


On Tuesday 06 April 2004 15:11, David Brownell wrote:
>Gene Heskett wrote:
>> Nope, 2.6.5-mm1 hangs xsane just like 2.6.5-rc3-mm4 did...
>
>Ah, I think I see the problem. This .text.lock.devio entry is more
>like devio::driver_disconnect(), which wouldn't previously have been
>called on that path.
>
>Try this patch.

Well, if you were a trophy hunter, I'd have to say "Skin that one,
take it to the taxidermist and mount it on the wall, Dave" :-)

2.6.5-mm1 & xsane works again. I'd assume that 2.6.5-rc3-mm4 would
also respond correctly to this patch, but of course I haven't tried
it.

Good catch & many thanks.

--
Cheers, Gene
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
99.22% setiathome rank, not too shabby for a WV hillbilly
Yahoo.com attornies please note, additions to this message
by Gene Heskett are:
Copyright 2004 by Maurice Eugene Heskett, all rights reserved.
Disable a usbfs disconnect() synchronization hack, which recently
started deadlocking because this routine is now called in a different
context.

It shouldn't be needed any longer now that usbcore shuts down endpoints
as part of driver unbinding. (Except maybe on UHCI, which will have
canceled but not necessarily completed all requests.)


--- 1.60/drivers/usb/core/devio.c Tue Mar 30 09:19:53 2004
+++ edited/drivers/usb/core/devio.c Tue Apr 6 12:07:06 2004
@@ -339,18 +339,17 @@
if (!ps)
return;

- /* this waits till synchronous requests complete */
- down_write (&ps->devsem);
+ /* NOTE: this relies on usbcore having canceled and completed
+ * all pending I/O requests; 2.6 does that.
+ */

/* prevent new I/O requests */
ps->dev = 0;
- ps->ifclaimed = 0;
+ clear_bit(intf->cur_altsetting->desc.bInterfaceNumber, &ps->ifclaimed);
usb_set_intfdata (intf, NULL);

/* force async requests to complete */
destroy_all_async (ps);
-
- up_write (&ps->devsem);
}

struct usb_driver usbdevfs_driver = {