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)
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 @@ static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype, unsig
{
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 @@ static int proc_control(struct dev_state *ps, void __user *arg)
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 @@ static int proc_ioctl (struct dev_state *ps, void __user *arg)
}
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) {
......
......@@ -446,8 +446,13 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
}
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)
......
......@@ -34,11 +34,6 @@ static void timeout_kill(unsigned long 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);
}
......@@ -69,8 +64,14 @@ static int usb_start_wait_urb(struct urb *urb, int timeout, int* actual_length)
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 @@ void usb_sg_cancel (struct usb_sg_request *io)
*
* 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 usb_string(struct usb_device *dev, int index, char *buf, size_t size)
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 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
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 ()
......
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