And here are a few more ... notably to get rid of some
cases where usbcore is complaining (to excess!) about
innocuous things.  Oh, and "swapper" wasn't informative
about "what task got the timeout" ... ;)

- Dave

Neither requests to suspended devices nor control request stalls should
ever log fault messages, they happen routinely; this stops such logging.
There's also a better message for control/bulk timeout -- but after the
HCD finishes unlinking the URB, not from 'swapper' in the timer callback!

Signed-off-by: David Brownell <[EMAIL PROTECTED]>


--- xu26/drivers/usb/core/devio.c	2004-09-15 15:49:30.000000000 -0700
+++ gadget-2.6/drivers/usb/core/devio.c	2004-10-31 18:01:57.000000000 -0800
@@ -411,6 +411,8 @@
 
 static int checkintf(struct dev_state *ps, unsigned int ifnum)
 {
+	if (ps->dev->state != USB_STATE_CONFIGURED)
+		return -EHOSTUNREACH;
 	if (ifnum >= 8*sizeof(ps->ifclaimed))
 		return -EINVAL;
 	if (test_bit(ifnum, &ps->ifclaimed))
@@ -450,6 +452,8 @@
 {
 	int ret = 0;
 
+	if (ps->dev->state != USB_STATE_CONFIGURED)
+		return -EHOSTUNREACH;
 	if (USB_TYPE_VENDOR == (USB_TYPE_MASK & requesttype))
 		return 0;
 
@@ -595,7 +599,7 @@
 		usb_lock_device(dev);
 	}
 	free_page((unsigned long)tbuf);
-	if (i<0) {
+	if (i<0 && i != -EPIPE) {
 		dev_printk(KERN_DEBUG, &dev->dev, "usbfs: USBDEVFS_CONTROL "
 			   "failed cmd %s rqt %u rq %u len %u ret %d\n",
 			   current->comm, ctrl.bRequestType, ctrl.bRequest,
@@ -1131,7 +1135,7 @@
 	}
 
 	if (ps->dev->state != USB_STATE_CONFIGURED)
-		retval = -ENODEV;
+		retval = -EHOSTUNREACH;
 	else if (!(intf = usb_ifnum_to_if (ps->dev, ctrl.ifno)))
                retval = -EINVAL;
 	else switch (ctrl.ioctl_code) {
--- xu26/drivers/usb/core/hcd.c	2004-11-01 17:37:43.000000000 -0800
+++ gadget-2.6/drivers/usb/core/hcd.c	2004-10-31 18:01:51.000000000 -0800
@@ -446,8 +446,13 @@
 	}
 	if (urb->status) {
 		urb->actual_length = 0;
-		dev_dbg (hcd->self.controller, "CTRL: TypeReq=0x%x val=0x%x idx=0x%x len=%d ==> %d\n",
-			typeReq, wValue, wIndex, wLength, urb->status);
+		if (urb->status != -EPIPE) {
+			dev_dbg (hcd->self.controller,
+				"CTRL: TypeReq=0x%x val=0x%x "
+				"idx=0x%x len=%d ==> %d\n",
+				typeReq, wValue, wIndex,
+				wLength, urb->status);
+		}
 	}
 	if (bufp) {
 		if (urb->transfer_buffer_length < len)
--- xu26/drivers/usb/core/message.c	2004-11-01 17:37:43.000000000 -0800
+++ gadget-2.6/drivers/usb/core/message.c	2004-10-31 18:01:55.000000000 -0800
@@ -34,11 +34,6 @@
 {
 	struct urb	*urb = (struct urb *) data;
 
-	dev_warn(&urb->dev->dev, "%s timeout from '%s' on ep%d%s\n",
-		usb_pipecontrol(urb->pipe) ? "control" : "bulk",
-		current->comm,
-		usb_pipeendpoint(urb->pipe),
-		usb_pipein(urb->pipe) ? "in" : "out");
 	usb_unlink_urb(urb);
 }
 
@@ -69,8 +64,14 @@
 		wait_for_completion(&done);
 		status = urb->status;
 		/* note:  HCDs return ETIMEDOUT for other reasons too */
-		if (status == -ECONNRESET)
+		if (status == -ECONNRESET) {
+			dev_warn(&urb->dev->dev,
+				"%s timed out on ep%d%s\n",
+				current->comm,
+				usb_pipeendpoint(urb->pipe),
+				usb_pipein(urb->pipe) ? "in" : "out");
 			status = -ETIMEDOUT;
+		}
 		if (timeout > 0)
 			del_timer_sync(&timer);
 	}
@@ -550,8 +551,7 @@
  *
  * Gets a USB descriptor.  Convenience functions exist to simplify
  * getting some types of descriptors.  Use
- * usb_get_device_descriptor() for USB_DT_DEVICE (not exported),
- * and usb_get_string() or usb_string() for USB_DT_STRING.
+ * usb_get_string() or usb_string() for USB_DT_STRING.
  * Device (USB_DT_DEVICE) and configuration descriptors (USB_DT_CONFIG)
  * are part of the device structure.
  * In addition to a number of USB-standard descriptors, some
@@ -704,6 +704,8 @@
 	int err;
 	unsigned int u, idx;
 
+	if (dev->state == USB_STATE_SUSPENDED)
+		return -EHOSTUNREACH;
 	if (size <= 0 || !buf || !index)
 		return -EINVAL;
 	buf[0] = 0;
@@ -756,8 +758,8 @@
 	return err;
 }
 
-/**
- * usb_get_device_descriptor - (re)reads the device descriptor
+/*
+ * usb_get_device_descriptor - (re)reads the device descriptor (usbcore)
  * @dev: the device whose device descriptor is being updated
  * @size: how much of the descriptor to read
  * Context: !in_interrupt ()

Reply via email to