patch-2.3.40 linux/drivers/usb/usb.c

Next file: linux/drivers/usb/usb.h
Previous file: linux/drivers/usb/usb-serial.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.39/linux/drivers/usb/usb.c linux/drivers/usb/usb.c
@@ -264,8 +264,6 @@
 	} else
 		warn("too many buses");
 
-	proc_usb_add_bus(bus);
-
 	/* Add it to the list of buses */
 	list_add(&bus->bus_list, &usb_bus_list);
 
@@ -285,8 +283,6 @@
 	 */
 	list_del(&bus->bus_list);
 
-	proc_usb_remove_bus(bus);
-
         usbdevfs_remove_bus(bus);
 
 	clear_bit(bus->busnum, busmap.busmap);
@@ -566,9 +562,10 @@
 		return status;
 	}
 
-	if (urb->status == -EINPROGRESS)
-		status=schedule_timeout(timeout); // ZZzzzz....
-	else
+	if (urb->status == -EINPROGRESS) {
+		while (timeout && urb->status == -EINPROGRESS)
+			status = timeout = schedule_timeout(timeout);
+	} else
 		status = 1;
 
 	remove_wait_queue(&wqh, &wait);
@@ -653,8 +650,6 @@
 void *usb_request_bulk(struct usb_device *dev, unsigned int pipe, usb_device_irq handler, void *data, int len, void *dev_id)
 {
 	urb_t *urb;
-	DECLARE_WAITQUEUE(wait, current);
-	DECLARE_WAIT_QUEUE_HEAD(wqh);
 	api_wrapper_data *awd;
 
 	if (!(urb=usb_alloc_urb(0)))
@@ -1231,7 +1226,6 @@
 	}
 
 	/* remove /proc/bus/usb entry */
-	proc_usb_remove_device(dev);
         usbdevfs_remove_device(dev);
 
 	/* Free up the device itself, including its device number */
@@ -1293,7 +1287,7 @@
 		unsigned char id, unsigned char index, void *buf, int size)
 {
 	return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
-		USB_REQ_GET_DESCRIPTOR, USB_RT_INTERFACE | USB_DIR_IN,
+		USB_REQ_GET_DESCRIPTOR, USB_RECIP_INTERFACE | USB_DIR_IN,
 		(type << 8) + id, index, buf, size, HZ * GET_TIMEOUT);
 }
 
@@ -1329,7 +1323,7 @@
 	int ret;
 
 	if ((ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
-	    USB_REQ_GET_PROTOCOL, USB_DIR_IN | USB_RT_HIDD,
+	    USB_REQ_GET_PROTOCOL, USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
 	    0, 1, &type, 1, HZ * GET_TIMEOUT)) < 0)
 		return ret;
 
@@ -1339,13 +1333,15 @@
 int usb_set_protocol(struct usb_device *dev, int protocol)
 {
 	return usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
-		USB_REQ_SET_PROTOCOL, USB_RT_HIDD, protocol, 1, NULL, 0, HZ * SET_TIMEOUT);
+		USB_REQ_SET_PROTOCOL, USB_TYPE_CLASS | USB_RECIP_INTERFACE,
+		protocol, 1, NULL, 0, HZ * SET_TIMEOUT);
 }
 
 int usb_set_idle(struct usb_device *dev,  int duration, int report_id)
 {
-	return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), USB_REQ_SET_IDLE,
-		USB_RT_HIDD, (duration << 8) | report_id, 1, NULL, 0, HZ * SET_TIMEOUT);
+	return usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
+		USB_REQ_SET_IDLE, USB_TYPE_CLASS | USB_RECIP_INTERFACE,
+		(duration << 8) | report_id, 1, NULL, 0, HZ * SET_TIMEOUT);
 }
 
 static void usb_set_maxpacket(struct usb_device *dev)
@@ -1388,14 +1384,14 @@
 */
 
 	result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
-		USB_REQ_CLEAR_FEATURE, USB_RT_ENDPOINT, 0, endp, NULL, 0, HZ * SET_TIMEOUT);
+		USB_REQ_CLEAR_FEATURE, USB_RECIP_ENDPOINT, 0, endp, NULL, 0, HZ * SET_TIMEOUT);
 
 	/* don't clear if failed */
 	if (result < 0)
 		return result;
 
 	result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
-		USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_ENDPOINT, 0, endp,
+		USB_REQ_GET_STATUS, USB_DIR_IN | USB_RECIP_ENDPOINT, 0, endp,
 		&status, sizeof(status), HZ * SET_TIMEOUT);
 	if (result < 0)
 		return result;
@@ -1429,7 +1425,7 @@
 	}
 
 	if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
-	    USB_REQ_SET_INTERFACE, USB_RT_INTERFACE, alternate,
+	    USB_REQ_SET_INTERFACE, USB_RECIP_INTERFACE, alternate,
 	    interface, NULL, 0, HZ * 5)) < 0)
 		return ret;
 
@@ -1469,14 +1465,14 @@
 int usb_get_report(struct usb_device *dev, unsigned char type, unsigned char id, unsigned char index, void *buf, int size)
 {
 	return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
-		USB_REQ_GET_REPORT, USB_DIR_IN | USB_RT_HIDD,
+		USB_REQ_GET_REPORT, USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
 		(type << 8) + id, index, buf, size, HZ * GET_TIMEOUT);
 }
 
 int usb_set_report(struct usb_device *dev, unsigned char type, unsigned char id, unsigned char index, void *buf, int size)
 {
 	return usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
-		USB_REQ_SET_REPORT, USB_RT_HIDD,
+		USB_REQ_SET_REPORT, USB_TYPE_CLASS | USB_RECIP_INTERFACE,
 		(type << 8) + id, index, buf, size, HZ);
 }
 
@@ -1693,7 +1689,6 @@
 	usb_show_string(dev, "SerialNumber", dev->descriptor.iSerialNumber);
 
 	/* now that the basic setup is over, add a /proc/bus/usb entry */
-	proc_usb_add_device(dev);
         usbdevfs_add_device(dev);
 
 	/* find drivers willing to handle this device */
@@ -1785,6 +1780,7 @@
 EXPORT_SYMBOL(usb_get_descriptor);
 EXPORT_SYMBOL(usb_get_class_descriptor);
 EXPORT_SYMBOL(__usb_get_extra_descriptor);
+EXPORT_SYMBOL(usb_get_device_descriptor);
 EXPORT_SYMBOL(usb_get_string);
 EXPORT_SYMBOL(usb_string);
 EXPORT_SYMBOL(usb_get_protocol);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)