Re: [linux-usb-devel] 3 USB regressions (2.6.6-rc3-bk1) that should be fixed before 2.6.6

From: Duncan Sands
Date: Sun May 02 2004 - 16:07:39 EST


> > Hi Greg, I'm not sure when these problems started showing up, maybe they
> > have been in 2.6.6- for a while. One patch that may be worth having in
> > 2.6.6 by the way is the one for device_disconnect in devio.c that changes
> > destroy_all_async to destroy_async_on_interface. It's clearly correct
> > and does do some good!
>
> Care to point out which one this was? I'm swimming in a sea of patches
> right now :)

I rediffed it against Linus's current tree. The extern -> static change is to make sure
we avoid the problem reported by R. J. Wysocki for -rc3-mm1: unknown symbol
destroy_all_async.

--- linux-2.5/drivers/usb/core/devio.c.orig 2004-05-02 23:22:34.000000000 +0200
+++ linux-2.5/drivers/usb/core/devio.c 2004-05-02 23:40:40.000000000 +0200
@@ -315,7 +315,7 @@
destroy_async(ps, &hitlist);
}

-extern __inline__ void destroy_all_async(struct dev_state *ps)
+static inline void destroy_all_async(struct dev_state *ps)
{
destroy_async(ps, &ps->async_pending);
}
@@ -335,6 +335,7 @@
static void driver_disconnect(struct usb_interface *intf)
{
struct dev_state *ps = usb_get_intfdata (intf);
+ unsigned int ifnum = intf->altsetting->desc.bInterfaceNumber;

if (!ps)
return;
@@ -345,11 +346,16 @@

/* prevent new I/O requests */
ps->dev = 0;
- clear_bit(intf->cur_altsetting->desc.bInterfaceNumber, &ps->ifclaimed);
+
+ if (likely(ifnum < 8*sizeof(ps->ifclaimed)))
+ clear_bit(ifnum, &ps->ifclaimed);
+ else
+ warn("interface number %u out of range", ifnum);
+
usb_set_intfdata (intf, NULL);

/* force async requests to complete */
- destroy_all_async (ps);
+ destroy_async_on_interface (ps, ifnum);
}

struct usb_driver usbdevfs_driver = {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/