Commit 691f9abb authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[PATCH] USB: clean up error messages

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: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 2e59e6a6
...@@ -411,6 +411,8 @@ static int releaseintf(struct dev_state *ps, unsigned int ifnum) ...@@ -411,6 +411,8 @@ static int releaseintf(struct dev_state *ps, unsigned int ifnum)
static int checkintf(struct dev_state *ps, unsigned int ifnum) 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)) if (ifnum >= 8*sizeof(ps->ifclaimed))
return -EINVAL; return -EINVAL;
if (test_bit(ifnum, &ps->ifclaimed)) if (test_bit(ifnum, &ps->ifclaimed))
...@@ -450,6 +452,8 @@ static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype, unsig ...@@ -450,6 +452,8 @@ static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype, unsig
{ {
int ret = 0; int ret = 0;
if (ps->dev->state != USB_STATE_CONFIGURED)
return -EHOSTUNREACH;
if (USB_TYPE_VENDOR == (USB_TYPE_MASK & requesttype)) if (USB_TYPE_VENDOR == (USB_TYPE_MASK & requesttype))
return 0; return 0;
...@@ -595,7 +599,7 @@ static int proc_control(struct dev_state *ps, void __user *arg) ...@@ -595,7 +599,7 @@ static int proc_control(struct dev_state *ps, void __user *arg)
usb_lock_device(dev); usb_lock_device(dev);
} }
free_page((unsigned long)tbuf); free_page((unsigned long)tbuf);
if (i<0) { if (i<0 && i != -EPIPE) {
dev_printk(KERN_DEBUG, &dev->dev, "usbfs: USBDEVFS_CONTROL " dev_printk(KERN_DEBUG, &dev->dev, "usbfs: USBDEVFS_CONTROL "
"failed cmd %s rqt %u rq %u len %u ret %d\n", "failed cmd %s rqt %u rq %u len %u ret %d\n",
current->comm, ctrl.bRequestType, ctrl.bRequest, current->comm, ctrl.bRequestType, ctrl.bRequest,
...@@ -1131,7 +1135,7 @@ static int proc_ioctl (struct dev_state *ps, void __user *arg) ...@@ -1131,7 +1135,7 @@ static int proc_ioctl (struct dev_state *ps, void __user *arg)
} }
if (ps->dev->state != USB_STATE_CONFIGURED) if (ps->dev->state != USB_STATE_CONFIGURED)
retval = -ENODEV; retval = -EHOSTUNREACH;
else if (!(intf = usb_ifnum_to_if (ps->dev, ctrl.ifno))) else if (!(intf = usb_ifnum_to_if (ps->dev, ctrl.ifno)))
retval = -EINVAL; retval = -EINVAL;
else switch (ctrl.ioctl_code) { else switch (ctrl.ioctl_code) {
......
...@@ -446,8 +446,13 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb) ...@@ -446,8 +446,13 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
} }
if (urb->status) { if (urb->status) {
urb->actual_length = 0; urb->actual_length = 0;
dev_dbg (hcd->self.controller, "CTRL: TypeReq=0x%x val=0x%x idx=0x%x len=%d ==> %d\n", if (urb->status != -EPIPE) {
typeReq, wValue, wIndex, wLength, urb->status); 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 (bufp) {
if (urb->transfer_buffer_length < len) if (urb->transfer_buffer_length < len)
......
...@@ -34,11 +34,6 @@ static void timeout_kill(unsigned long data) ...@@ -34,11 +34,6 @@ static void timeout_kill(unsigned long data)
{ {
struct urb *urb = (struct urb *) data; 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); usb_unlink_urb(urb);
} }
...@@ -69,8 +64,14 @@ static int usb_start_wait_urb(struct urb *urb, int timeout, int* actual_length) ...@@ -69,8 +64,14 @@ static int usb_start_wait_urb(struct urb *urb, int timeout, int* actual_length)
wait_for_completion(&done); wait_for_completion(&done);
status = urb->status; status = urb->status;
/* note: HCDs return ETIMEDOUT for other reasons too */ /* 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; status = -ETIMEDOUT;
}
if (timeout > 0) if (timeout > 0)
del_timer_sync(&timer); del_timer_sync(&timer);
} }
...@@ -550,8 +551,7 @@ void usb_sg_cancel (struct usb_sg_request *io) ...@@ -550,8 +551,7 @@ void usb_sg_cancel (struct usb_sg_request *io)
* *
* Gets a USB descriptor. Convenience functions exist to simplify * Gets a USB descriptor. Convenience functions exist to simplify
* getting some types of descriptors. Use * getting some types of descriptors. Use
* usb_get_device_descriptor() for USB_DT_DEVICE (not exported), * usb_get_string() or usb_string() for USB_DT_STRING.
* and usb_get_string() or usb_string() for USB_DT_STRING.
* Device (USB_DT_DEVICE) and configuration descriptors (USB_DT_CONFIG) * Device (USB_DT_DEVICE) and configuration descriptors (USB_DT_CONFIG)
* are part of the device structure. * are part of the device structure.
* In addition to a number of USB-standard descriptors, some * In addition to a number of USB-standard descriptors, some
...@@ -704,6 +704,8 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size) ...@@ -704,6 +704,8 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
int err; int err;
unsigned int u, idx; unsigned int u, idx;
if (dev->state == USB_STATE_SUSPENDED)
return -EHOSTUNREACH;
if (size <= 0 || !buf || !index) if (size <= 0 || !buf || !index)
return -EINVAL; return -EINVAL;
buf[0] = 0; buf[0] = 0;
...@@ -756,8 +758,8 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size) ...@@ -756,8 +758,8 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
return err; 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 * @dev: the device whose device descriptor is being updated
* @size: how much of the descriptor to read * @size: how much of the descriptor to read
* Context: !in_interrupt () * Context: !in_interrupt ()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment