Commit 69cc3f12 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge bk://linuxusb@bkbits.net/linus-2.5

into kroah.com:/home/greg/linux/BK/gregkh-2.5
parents 068130cf f6a258d1
...@@ -1024,9 +1024,7 @@ static int hcd_submit_urb (struct urb *urb, int mem_flags) ...@@ -1024,9 +1024,7 @@ static int hcd_submit_urb (struct urb *urb, int mem_flags)
*/ */
urb->transfer_flags |= URB_NO_DMA_MAP; urb->transfer_flags |= URB_NO_DMA_MAP;
status = rh_urb_enqueue (hcd, urb); status = rh_urb_enqueue (hcd, urb);
if (status) goto done;
urb_unlink (urb);
return status;
} }
/* lower level hcd code should use *_dma exclusively, /* lower level hcd code should use *_dma exclusively,
...@@ -1051,8 +1049,11 @@ static int hcd_submit_urb (struct urb *urb, int mem_flags) ...@@ -1051,8 +1049,11 @@ static int hcd_submit_urb (struct urb *urb, int mem_flags)
} }
status = hcd->driver->urb_enqueue (hcd, urb, mem_flags); status = hcd->driver->urb_enqueue (hcd, urb, mem_flags);
if (status) done:
if (status) {
usb_put_urb (urb);
urb_unlink (urb); urb_unlink (urb);
}
return status; return status;
} }
......
...@@ -135,8 +135,7 @@ static void hub_irq(struct urb *urb, struct pt_regs *regs) ...@@ -135,8 +135,7 @@ static void hub_irq(struct urb *urb, struct pt_regs *regs)
default: /* presumably an error */ default: /* presumably an error */
/* Cause a hub reset after 10 consecutive errors */ /* Cause a hub reset after 10 consecutive errors */
dbg("hub '%s' status %d for interrupt transfer", dev_dbg (&hub->intf->dev, "transfer --> %d\n", urb->status);
urb->dev->devpath, urb->status);
if ((++hub->nerrors < 10) || hub->error) if ((++hub->nerrors < 10) || hub->error)
goto resubmit; goto resubmit;
hub->error = urb->status; hub->error = urb->status;
...@@ -158,10 +157,10 @@ static void hub_irq(struct urb *urb, struct pt_regs *regs) ...@@ -158,10 +157,10 @@ static void hub_irq(struct urb *urb, struct pt_regs *regs)
spin_unlock_irqrestore(&hub_event_lock, flags); spin_unlock_irqrestore(&hub_event_lock, flags);
resubmit: resubmit:
if ((status = usb_submit_urb (hub->urb, GFP_ATOMIC)) != 0) if ((status = usb_submit_urb (hub->urb, GFP_ATOMIC)) != 0
err ("hub '%s-%s' status %d for interrupt resubmit", /* ENODEV means we raced disconnect() */
urb->dev->bus->bus_name, urb->dev->devpath, && status != -ENODEV)
status); dev_err (&hub->intf->dev, "resubmit --> %d\n", urb->status);
} }
/* USB 2.0 spec Section 11.24.2.3 */ /* USB 2.0 spec Section 11.24.2.3 */
...@@ -652,8 +651,9 @@ static int usb_hub_port_status(struct usb_device *hub, int port, ...@@ -652,8 +651,9 @@ static int usb_hub_port_status(struct usb_device *hub, int port,
if (portsts) { if (portsts) {
ret = usb_get_port_status(hub, port + 1, portsts); ret = usb_get_port_status(hub, port + 1, portsts);
if (ret < 0) if (ret < 0)
err("%s(%s-%s) failed (err = %d)", __FUNCTION__, dev_err (hubdev (hub),
hub->bus->bus_name, hub->devpath, ret); "%s failed (err = %d)\n", __FUNCTION__,
ret);
else { else {
*status = le16_to_cpu(portsts->wPortStatus); *status = le16_to_cpu(portsts->wPortStatus);
*change = le16_to_cpu(portsts->wPortChange); *change = le16_to_cpu(portsts->wPortChange);
...@@ -759,8 +759,8 @@ void usb_hub_port_disable(struct usb_device *hub, int port) ...@@ -759,8 +759,8 @@ void usb_hub_port_disable(struct usb_device *hub, int port)
ret = usb_clear_port_feature(hub, port + 1, USB_PORT_FEAT_ENABLE); ret = usb_clear_port_feature(hub, port + 1, USB_PORT_FEAT_ENABLE);
if (ret) if (ret)
err("cannot disable port %d of hub %s (err = %d)", dev_err(hubdev(hub), "cannot disable port %d (err = %d)\n",
port + 1, hub->devpath, ret); port + 1, ret);
} }
/* USB 2.0 spec, 7.1.7.3 / fig 7-29: /* USB 2.0 spec, 7.1.7.3 / fig 7-29:
...@@ -983,12 +983,12 @@ static void usb_hub_events(void) ...@@ -983,12 +983,12 @@ static void usb_hub_events(void)
spin_unlock_irqrestore(&hub_event_lock, flags); spin_unlock_irqrestore(&hub_event_lock, flags);
if (hub->error) { if (hub->error) {
dbg("resetting hub %s for error %d", dev_dbg (&hub->intf->dev, "resetting for error %d\n",
dev->devpath, hub->error); hub->error);
if (usb_hub_reset(hub)) { if (usb_hub_reset(hub)) {
err("error resetting hub %s - disconnecting", dev_dbg (&hub->intf->dev,
dev->devpath); "can't reset; disconnecting\n");
up(&hub->khubd_sem); up(&hub->khubd_sem);
usb_hub_disconnect(dev); usb_hub_disconnect(dev);
continue; continue;
...@@ -1022,33 +1022,37 @@ static void usb_hub_events(void) ...@@ -1022,33 +1022,37 @@ static void usb_hub_events(void)
if (!(portstatus & USB_PORT_STAT_ENABLE) if (!(portstatus & USB_PORT_STAT_ENABLE)
&& (portstatus & USB_PORT_STAT_CONNECTION) && (portstatus & USB_PORT_STAT_CONNECTION)
&& (dev->children[i])) { && (dev->children[i])) {
err("already running hub %s port %i " dev_err (&hub->intf->dev,
"port %i "
"disabled by hub (EMI?), " "disabled by hub (EMI?), "
"re-enabling...", "re-enabling...",
dev->devpath, i + 1); i + 1);
usb_hub_port_connect_change(hub, usb_hub_port_connect_change(hub,
i, portstatus, portchange); i, portstatus, portchange);
} }
} }
if (portchange & USB_PORT_STAT_C_SUSPEND) { if (portchange & USB_PORT_STAT_C_SUSPEND) {
dbg("hub %s port %d suspend change", dev_dbg (&hub->intf->dev,
dev->devpath, i + 1); "suspend change on port %d\n",
i + 1);
usb_clear_port_feature(dev, usb_clear_port_feature(dev,
i + 1, USB_PORT_FEAT_C_SUSPEND); i + 1, USB_PORT_FEAT_C_SUSPEND);
} }
if (portchange & USB_PORT_STAT_C_OVERCURRENT) { if (portchange & USB_PORT_STAT_C_OVERCURRENT) {
err("hub %s port %d over-current change", dev_err (&hub->intf->dev,
dev->devpath, i + 1); "over-current change on port %d\n",
i + 1);
usb_clear_port_feature(dev, usb_clear_port_feature(dev,
i + 1, USB_PORT_FEAT_C_OVER_CURRENT); i + 1, USB_PORT_FEAT_C_OVER_CURRENT);
usb_hub_power_on(hub); usb_hub_power_on(hub);
} }
if (portchange & USB_PORT_STAT_C_RESET) { if (portchange & USB_PORT_STAT_C_RESET) {
dbg("hub %s port %d reset change", dev_dbg (&hub->intf->dev,
dev->devpath, i + 1); "reset change on port %d\n",
i + 1);
usb_clear_port_feature(dev, usb_clear_port_feature(dev,
i + 1, USB_PORT_FEAT_C_RESET); i + 1, USB_PORT_FEAT_C_RESET);
} }
...@@ -1056,16 +1060,16 @@ static void usb_hub_events(void) ...@@ -1056,16 +1060,16 @@ static void usb_hub_events(void)
/* deal with hub status changes */ /* deal with hub status changes */
if (usb_get_hub_status(dev, &hubsts) < 0) if (usb_get_hub_status(dev, &hubsts) < 0)
err("get_hub_status %s failed", dev->devpath); dev_err (&hub->intf->dev, "get_hub_status failed\n");
else { else {
hubstatus = le16_to_cpup(&hubsts.wHubStatus); hubstatus = le16_to_cpup(&hubsts.wHubStatus);
hubchange = le16_to_cpup(&hubsts.wHubChange); hubchange = le16_to_cpup(&hubsts.wHubChange);
if (hubchange & HUB_CHANGE_LOCAL_POWER) { if (hubchange & HUB_CHANGE_LOCAL_POWER) {
dbg("hub %s power change", dev->devpath); dev_dbg (&hub->intf->dev, "power change\n");
usb_clear_hub_feature(dev, C_HUB_LOCAL_POWER); usb_clear_hub_feature(dev, C_HUB_LOCAL_POWER);
} }
if (hubchange & HUB_CHANGE_OVERCURRENT) { if (hubchange & HUB_CHANGE_OVERCURRENT) {
dbg("hub %s overcurrent change", dev->devpath); dev_dbg (&hub->intf->dev, "overcurrent change\n");
wait_ms(500); /* Cool down */ wait_ms(500); /* Cool down */
usb_clear_hub_feature(dev, C_HUB_OVER_CURRENT); usb_clear_hub_feature(dev, C_HUB_OVER_CURRENT);
usb_hub_power_on(hub); usb_hub_power_on(hub);
......
...@@ -866,14 +866,11 @@ void usb_disconnect(struct usb_device **pdev) ...@@ -866,14 +866,11 @@ void usb_disconnect(struct usb_device **pdev)
} }
/** /**
* usb_connect - connects a new device during enumeration (usbcore-internal) * usb_connect - pick device address (usbcore-internal)
* @dev: partially enumerated device * @dev: newly detected device (in DEFAULT state)
*
* Connect a new USB device. This basically just initializes
* the USB device information and sets up the topology - it's
* up to the low-level driver to reset the port and actually
* do the setup (the upper levels don't know how to do that).
* *
* Picks a device address. It's up to the hub (or root hub) driver
* to handle and manage enumeration, starting from the DEFAULT state.
* Only hub drivers (including virtual root hub drivers for host * Only hub drivers (including virtual root hub drivers for host
* controllers) should ever call this. * controllers) should ever call this.
*/ */
...@@ -983,7 +980,7 @@ static void set_device_description (struct usb_device *dev) ...@@ -983,7 +980,7 @@ static void set_device_description (struct usb_device *dev)
} }
/* /*
* By the time we get here, the device has gotten a new device ID * By the time we get here, we chose a new device address
* and is in the default state. We need to identify the thing and * and is in the default state. We need to identify the thing and
* get the ball rolling.. * get the ball rolling..
* *
......
...@@ -881,6 +881,8 @@ static int unlink1 (struct usbtest_dev *dev, int pipe, int size, int async) ...@@ -881,6 +881,8 @@ static int unlink1 (struct usbtest_dev *dev, int pipe, int size, int async)
init_completion (&completion); init_completion (&completion);
urb = simple_alloc_urb (testdev_to_usbdev (dev), pipe, size); urb = simple_alloc_urb (testdev_to_usbdev (dev), pipe, size);
if (!urb)
return -ENOMEM;
if (async) if (async)
urb->transfer_flags |= URB_ASYNC_UNLINK; urb->transfer_flags |= URB_ASYNC_UNLINK;
urb->context = &completion; urb->context = &completion;
......
...@@ -406,8 +406,6 @@ static int kobil_write (struct usb_serial_port *port, int from_user, ...@@ -406,8 +406,6 @@ static int kobil_write (struct usb_serial_port *port, int from_user,
int result = 0; int result = 0;
int todo = 0; int todo = 0;
struct kobil_private * priv; struct kobil_private * priv;
int i;
char *data;
if (count == 0) { if (count == 0) {
dbg("%s - port %d write request of 0 bytes", __FUNCTION__, port->number); dbg("%s - port %d write request of 0 bytes", __FUNCTION__, port->number);
...@@ -421,19 +419,6 @@ static int kobil_write (struct usb_serial_port *port, int from_user, ...@@ -421,19 +419,6 @@ static int kobil_write (struct usb_serial_port *port, int from_user,
return -ENOMEM; return -ENOMEM;
} }
// BEGIN DEBUG
data = (unsigned char *) kmalloc((3 * count + 10) * sizeof(char), GFP_KERNEL);
if (! data) {
return (-1);
}
memset(data, 0, (3 * count + 10));
for (i = 0; i < count; i++) {
sprintf(data +3*i, "%02X ", buf[i]);
}
dbg(" %d --> %s", port->number, data );
kfree(data);
// END DEBUG
// Copy data to buffer // Copy data to buffer
if (from_user) { if (from_user) {
if (copy_from_user(priv->buf + priv->filled, buf, count)) { if (copy_from_user(priv->buf + priv->filled, buf, count)) {
...@@ -443,6 +428,8 @@ static int kobil_write (struct usb_serial_port *port, int from_user, ...@@ -443,6 +428,8 @@ static int kobil_write (struct usb_serial_port *port, int from_user,
memcpy (priv->buf + priv->filled, buf, count); memcpy (priv->buf + priv->filled, buf, count);
} }
usb_serial_debug_data (__FILE__, __FUNCTION__, count, priv->buf + priv->filled);
priv->filled = priv->filled + count; priv->filled = priv->filled + count;
......
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