patch-2.2.19 linux/drivers/usb/usb.c
Next file: linux/drivers/video/Config.in
Previous file: linux/drivers/usb/serial/visor.c
Back to the patch index
Back to the overall index
- Lines: 88
- Date:
Sun Mar 25 11:37:37 2001
- Orig file:
v2.2.18/drivers/usb/usb.c
- Orig date:
Sun Mar 25 11:28:33 2001
diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.18/drivers/usb/usb.c linux/drivers/usb/usb.c
@@ -187,6 +187,19 @@
return NULL;
}
+struct usb_endpoint_descriptor *usb_epnum_to_ep_desc(struct usb_device *dev, unsigned epnum)
+{
+ int i, j, k;
+
+ for (i = 0; i < dev->actconfig->bNumInterfaces; i++)
+ for (j = 0; j < dev->actconfig->interface[i].num_altsetting; j++)
+ for (k = 0; k < dev->actconfig->interface[i].altsetting[j].bNumEndpoints; k++)
+ if (epnum == dev->actconfig->interface[i].altsetting[j].endpoint[k].bEndpointAddress)
+ return &dev->actconfig->interface[i].altsetting[j].endpoint[k];
+
+ return NULL;
+}
+
/*
* usb_calc_bus_time:
*
@@ -283,11 +296,13 @@
else
dev->bus->bandwidth_int_reqs++;
urb->bandwidth = bustime;
-
- dbg("bw_alloc increased by %d to %d for %d requesters",
+
+#ifdef USB_BANDWIDTH_MESSAGES
+ dbg("bandwidth alloc increased by %d to %d for %d requesters",
bustime,
dev->bus->bandwidth_allocated,
dev->bus->bandwidth_int_reqs + dev->bus->bandwidth_isoc_reqs);
+#endif
}
/*
@@ -303,10 +318,12 @@
else
dev->bus->bandwidth_int_reqs--;
- dbg("bw_alloc reduced by %d to %d for %d requesters",
+#ifdef USB_BANDWIDTH_MESSAGES
+ dbg("bandwidth alloc reduced by %d to %d for %d requesters",
urb->bandwidth,
dev->bus->bandwidth_allocated,
dev->bus->bandwidth_int_reqs + dev->bus->bandwidth_isoc_reqs);
+#endif
urb->bandwidth = 0;
}
@@ -484,12 +501,17 @@
tmp = tmp->next;
down(&driver->serialize);
+ if (usb_interface_claimed(interface)) {
+ up(&driver->serialize);
+ return -1;
+ }
private = driver->probe(dev, ifnum);
- up(&driver->serialize);
- if (!private)
+ if (!private) {
+ up(&driver->serialize);
continue;
+ }
usb_driver_claim_interface(driver, interface, private);
-
+ up(&driver->serialize);
return 0;
}
@@ -737,7 +759,7 @@
dbg("unhandled interfaces on device");
if (!claimed) {
- warn("USB device %d (prod/vend 0x%x/0x%x) is not claimed by any active driver.",
+ warn("USB device %d (vend/prod 0x%x/0x%x) is not claimed by any active driver.",
dev->devnum,
dev->descriptor.idVendor,
dev->descriptor.idProduct);
@@ -2037,6 +2059,7 @@
* then these symbols need to be exported for the modules to use.
*/
EXPORT_SYMBOL(usb_ifnum_to_if);
+EXPORT_SYMBOL(usb_epnum_to_ep_desc);
EXPORT_SYMBOL(usb_register);
EXPORT_SYMBOL(usb_deregister);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)