Commit ead584e3 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge kroah.com:/home/greg/linux/BK/bleed-2.5

into kroah.com:/home/greg/linux/BK/gregkh-2.5
parents b4f6270e e74f55d6
...@@ -1210,6 +1210,10 @@ S: 25360 Georgia Tech Station ...@@ -1210,6 +1210,10 @@ S: 25360 Georgia Tech Station
S: Atlanta, Georgia 30332 S: Atlanta, Georgia 30332
S: USA S: USA
N: Brad Hards
E: bradh@frogmouth.net
D: Various USB bits, other minor patches
N: Angelo Haritsis N: Angelo Haritsis
E: ah@computer.org E: ah@computer.org
D: kernel patches (serial, watchdog) D: kernel patches (serial, watchdog)
......
...@@ -1869,11 +1869,12 @@ S: Maintained ...@@ -1869,11 +1869,12 @@ S: Maintained
W: http://www.kroah.com/linux-usb/ W: http://www.kroah.com/linux-usb/
USB CDC ETHERNET DRIVER USB CDC ETHERNET DRIVER
P: Brad Hards P: Greg Kroah-Hartman
M: bradh@frogmouth.net M: greg@kroah.com
L: linux-usb-users@lists.sourceforge.net L: linux-usb-users@lists.sourceforge.net
L: linux-usb-devel@lists.sourceforge.net L: linux-usb-devel@lists.sourceforge.net
S: Maintained S: Maintained
W: http://www.kroah.com/linux-usb/
USB EHCI DRIVER USB EHCI DRIVER
P: David Brownell P: David Brownell
......
...@@ -14,6 +14,7 @@ obj-$(CONFIG_USB_SL811HS) += host/ ...@@ -14,6 +14,7 @@ obj-$(CONFIG_USB_SL811HS) += host/
obj-$(CONFIG_USB_ACM) += class/ obj-$(CONFIG_USB_ACM) += class/
obj-$(CONFIG_USB_AUDIO) += class/ obj-$(CONFIG_USB_AUDIO) += class/
obj-$(CONFIG_USB_BLUETOOTH_TTY) += class/ obj-$(CONFIG_USB_BLUETOOTH_TTY) += class/
obj-$(CONFIG_USB_MIDI) += class/
obj-$(CONFIG_USB_PRINTER) += class/ obj-$(CONFIG_USB_PRINTER) += class/
obj-$(CONFIG_USB_STORAGE) += storage/ obj-$(CONFIG_USB_STORAGE) += storage/
......
...@@ -172,7 +172,6 @@ ...@@ -172,7 +172,6 @@
/*****************************************************************************/ /*****************************************************************************/
#include <linux/version.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/string.h> #include <linux/string.h>
......
...@@ -538,7 +538,7 @@ static int acm_probe (struct usb_interface *intf, ...@@ -538,7 +538,7 @@ static int acm_probe (struct usb_interface *intf,
cfacm = dev->config + i; cfacm = dev->config + i;
dbg("probing config %d", cfacm->bConfigurationValue); dbg("probing config %d", cfacm->desc.bConfigurationValue);
if (cfacm->desc.bNumInterfaces != 2 || if (cfacm->desc.bNumInterfaces != 2 ||
usb_interface_claimed(cfacm->interface + 0) || usb_interface_claimed(cfacm->interface + 0) ||
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/version.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/pci.h> #include <linux/pci.h>
......
...@@ -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 */
...@@ -648,12 +647,13 @@ static int usb_hub_port_status(struct usb_device *hub, int port, ...@@ -648,12 +647,13 @@ static int usb_hub_port_status(struct usb_device *hub, int port,
struct usb_port_status *portsts; struct usb_port_status *portsts;
int ret = -ENOMEM; int ret = -ENOMEM;
portsts = kmalloc(sizeof(*portsts), GFP_KERNEL); portsts = kmalloc(sizeof(*portsts), GFP_NOIO);
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);
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include "hcd.h" /* for usbcore internals */ #include "hcd.h" /* for usbcore internals */
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
* face, but so that you can still use them.. * face, but so that you can still use them..
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/version.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/slab.h> #include <linux/slab.h>
......
...@@ -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..
* *
......
...@@ -94,7 +94,6 @@ ...@@ -94,7 +94,6 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/interrupt.h> /* for in_interrupt () */ #include <linux/interrupt.h> /* for in_interrupt () */
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/version.h>
#include "../core/hcd.h" #include "../core/hcd.h"
#include <asm/io.h> #include <asm/io.h>
......
...@@ -85,7 +85,6 @@ ...@@ -85,7 +85,6 @@
* (20/10/1999) * (20/10/1999)
*/ */
#include <linux/version.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/signal.h> #include <linux/signal.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/fs.h> #include <linux/fs.h>
......
...@@ -60,7 +60,6 @@ ...@@ -60,7 +60,6 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/version.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
......
...@@ -78,19 +78,28 @@ static int emi26_set_reset (struct usb_device *dev, unsigned char reset_bit) ...@@ -78,19 +78,28 @@ static int emi26_set_reset (struct usb_device *dev, unsigned char reset_bit)
return response; return response;
} }
#define FW_LOAD_SIZE 1023
static int emi26_load_firmware (struct usb_device *dev) static int emi26_load_firmware (struct usb_device *dev)
{ {
int err; int err;
int i; int i;
int pos = 0; /* Position in hex record */ int pos = 0; /* Position in hex record */
__u32 addr; /* Address to write */ __u32 addr; /* Address to write */
__u8 buf[1023]; __u8 *buf;
buf = kmalloc(FW_LOAD_SIZE, GFP_KERNEL);
if (!buf) {
err( "%s - error loading firmware: error = %d", __FUNCTION__, -ENOMEM);
err = -ENOMEM;
goto wraperr;
}
/* Assert reset (stop the CPU in the EMI) */ /* Assert reset (stop the CPU in the EMI) */
err = emi26_set_reset(dev,1); err = emi26_set_reset(dev,1);
if (err < 0) { if (err < 0) {
err( "%s - error loading firmware: error = %d", __FUNCTION__, err); err( "%s - error loading firmware: error = %d", __FUNCTION__, err);
return err; goto wraperr;
} }
/* 1. We need to put the loader for the FPGA into the EZ-USB */ /* 1. We need to put the loader for the FPGA into the EZ-USB */
...@@ -98,7 +107,7 @@ static int emi26_load_firmware (struct usb_device *dev) ...@@ -98,7 +107,7 @@ static int emi26_load_firmware (struct usb_device *dev)
err = emi26_writememory(dev, g_Loader[i].address, g_Loader[i].data, g_Loader[i].length, ANCHOR_LOAD_INTERNAL); err = emi26_writememory(dev, g_Loader[i].address, g_Loader[i].data, g_Loader[i].length, ANCHOR_LOAD_INTERNAL);
if (err < 0) { if (err < 0) {
err("%s - error loading firmware: error = %d", __FUNCTION__, err); err("%s - error loading firmware: error = %d", __FUNCTION__, err);
return err; goto wraperr;
} }
} }
...@@ -113,7 +122,7 @@ static int emi26_load_firmware (struct usb_device *dev) ...@@ -113,7 +122,7 @@ static int emi26_load_firmware (struct usb_device *dev)
addr = g_bitstream[pos].address; addr = g_bitstream[pos].address;
/* intel hex records are terminated with type 0 element */ /* intel hex records are terminated with type 0 element */
while ((g_bitstream[pos].type == 0) && (i + g_bitstream[pos].length < sizeof(buf))) { while ((g_bitstream[pos].type == 0) && (i + g_bitstream[pos].length < FW_LOAD_SIZE)) {
memcpy(buf + i, g_bitstream[pos].data, g_bitstream[pos].length); memcpy(buf + i, g_bitstream[pos].data, g_bitstream[pos].length);
i += g_bitstream[pos].length; i += g_bitstream[pos].length;
pos++; pos++;
...@@ -121,7 +130,7 @@ static int emi26_load_firmware (struct usb_device *dev) ...@@ -121,7 +130,7 @@ static int emi26_load_firmware (struct usb_device *dev)
err = emi26_writememory(dev, addr, buf, i, ANCHOR_LOAD_FPGA); err = emi26_writememory(dev, addr, buf, i, ANCHOR_LOAD_FPGA);
if (err < 0) { if (err < 0) {
err("%s - error loading firmware: error = %d", __FUNCTION__, err); err("%s - error loading firmware: error = %d", __FUNCTION__, err);
return err; goto wraperr;
} }
} while (i > 0); } while (i > 0);
...@@ -129,7 +138,7 @@ static int emi26_load_firmware (struct usb_device *dev) ...@@ -129,7 +138,7 @@ static int emi26_load_firmware (struct usb_device *dev)
err = emi26_set_reset(dev,1); err = emi26_set_reset(dev,1);
if (err < 0) { if (err < 0) {
err("%s - error loading firmware: error = %d", __FUNCTION__, err); err("%s - error loading firmware: error = %d", __FUNCTION__, err);
return err; goto wraperr;
} }
/* 3. We need to put the loader for the firmware into the EZ-USB (again...) */ /* 3. We need to put the loader for the firmware into the EZ-USB (again...) */
...@@ -137,7 +146,7 @@ static int emi26_load_firmware (struct usb_device *dev) ...@@ -137,7 +146,7 @@ static int emi26_load_firmware (struct usb_device *dev)
err = emi26_writememory(dev, g_Loader[i].address, g_Loader[i].data, g_Loader[i].length, ANCHOR_LOAD_INTERNAL); err = emi26_writememory(dev, g_Loader[i].address, g_Loader[i].data, g_Loader[i].length, ANCHOR_LOAD_INTERNAL);
if (err < 0) { if (err < 0) {
err("%s - error loading firmware: error = %d", __FUNCTION__, err); err("%s - error loading firmware: error = %d", __FUNCTION__, err);
return err; goto wraperr;
} }
} }
...@@ -145,7 +154,7 @@ static int emi26_load_firmware (struct usb_device *dev) ...@@ -145,7 +154,7 @@ static int emi26_load_firmware (struct usb_device *dev)
err = emi26_set_reset(dev,0); err = emi26_set_reset(dev,0);
if (err < 0) { if (err < 0) {
err("%s - error loading firmware: error = %d", __FUNCTION__, err); err("%s - error loading firmware: error = %d", __FUNCTION__, err);
return err; goto wraperr;
} }
/* 4. We put the part of the firmware that lies in the external RAM into the EZ-USB */ /* 4. We put the part of the firmware that lies in the external RAM into the EZ-USB */
...@@ -154,7 +163,7 @@ static int emi26_load_firmware (struct usb_device *dev) ...@@ -154,7 +163,7 @@ static int emi26_load_firmware (struct usb_device *dev)
err = emi26_writememory(dev, g_Firmware[i].address, g_Firmware[i].data, g_Firmware[i].length, ANCHOR_LOAD_EXTERNAL); err = emi26_writememory(dev, g_Firmware[i].address, g_Firmware[i].data, g_Firmware[i].length, ANCHOR_LOAD_EXTERNAL);
if (err < 0) { if (err < 0) {
err("%s - error loading firmware: error = %d", __FUNCTION__, err); err("%s - error loading firmware: error = %d", __FUNCTION__, err);
return err; goto wraperr;
} }
} }
} }
...@@ -163,7 +172,7 @@ static int emi26_load_firmware (struct usb_device *dev) ...@@ -163,7 +172,7 @@ static int emi26_load_firmware (struct usb_device *dev)
err = emi26_set_reset(dev,1); err = emi26_set_reset(dev,1);
if (err < 0) { if (err < 0) {
err("%s - error loading firmware: error = %d", __FUNCTION__, err); err("%s - error loading firmware: error = %d", __FUNCTION__, err);
return err; goto wraperr;
} }
for (i=0; g_Firmware[i].type == 0; i++) { for (i=0; g_Firmware[i].type == 0; i++) {
...@@ -171,7 +180,7 @@ static int emi26_load_firmware (struct usb_device *dev) ...@@ -171,7 +180,7 @@ static int emi26_load_firmware (struct usb_device *dev)
err = emi26_writememory(dev, g_Firmware[i].address, g_Firmware[i].data, g_Firmware[i].length, ANCHOR_LOAD_INTERNAL); err = emi26_writememory(dev, g_Firmware[i].address, g_Firmware[i].data, g_Firmware[i].length, ANCHOR_LOAD_INTERNAL);
if (err < 0) { if (err < 0) {
err("%s - error loading firmware: error = %d", __FUNCTION__, err); err("%s - error loading firmware: error = %d", __FUNCTION__, err);
return err; goto wraperr;
} }
} }
} }
...@@ -180,12 +189,16 @@ static int emi26_load_firmware (struct usb_device *dev) ...@@ -180,12 +189,16 @@ static int emi26_load_firmware (struct usb_device *dev)
err = emi26_set_reset(dev,0); err = emi26_set_reset(dev,0);
if (err < 0) { if (err < 0) {
err("%s - error loading firmware: error = %d", __FUNCTION__, err); err("%s - error loading firmware: error = %d", __FUNCTION__, err);
return err; goto wraperr;
} }
/* return 1 to fail the driver inialization /* return 1 to fail the driver inialization
* and give real driver change to load */ * and give real driver change to load */
return 1; return 1;
wraperr:
kfree(buf);
return err;
} }
static __devinitdata struct usb_device_id id_table [] = { static __devinitdata struct usb_device_id id_table [] = {
......
This diff is collapsed.
...@@ -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;
...@@ -1407,6 +1409,11 @@ static struct usb_device_id id_table [] = { ...@@ -1407,6 +1409,11 @@ static struct usb_device_id id_table [] = {
.driver_info = (unsigned long) &fw_info, .driver_info = (unsigned long) &fw_info,
}, },
/* "Gadget Zero" firmware runs under Linux */
{ USB_DEVICE (0x0525, 0xa4a0),
.driver_info = (unsigned long) &fw_info,
},
#ifdef KEYSPAN_19Qi #ifdef KEYSPAN_19Qi
/* Keyspan 19qi uses an21xx (original EZ-USB) */ /* Keyspan 19qi uses an21xx (original EZ-USB) */
// this does not coexist with the real Keyspan 19qi driver! // this does not coexist with the real Keyspan 19qi driver!
......
...@@ -269,22 +269,8 @@ static void CDCEther_tx_timeout( struct net_device *net ) ...@@ -269,22 +269,8 @@ static void CDCEther_tx_timeout( struct net_device *net )
static int CDCEther_start_xmit( struct sk_buff *skb, struct net_device *net ) static int CDCEther_start_xmit( struct sk_buff *skb, struct net_device *net )
{ {
ether_dev_t *ether_dev = net->priv; ether_dev_t *ether_dev = net->priv;
int count;
int res; int res;
// If we are told to transmit an ethernet frame that fits EXACTLY
// into an integer number of USB packets, we force it to send one
// more byte so the device will get a runt USB packet signalling the
// end of the ethernet frame
if ( (skb->len) ^ (ether_dev->data_ep_out_size) ) {
// It was not an exact multiple
// no need to add anything extra
count = skb->len;
} else {
// Add one to make it NOT an exact multiple
count = skb->len + 1;
}
// Tell the kernel, "No more frames 'til we are done // Tell the kernel, "No more frames 'til we are done
// with this one.' // with this one.'
netif_stop_queue( net ); netif_stop_queue( net );
...@@ -299,7 +285,10 @@ static int CDCEther_start_xmit( struct sk_buff *skb, struct net_device *net ) ...@@ -299,7 +285,10 @@ static int CDCEther_start_xmit( struct sk_buff *skb, struct net_device *net )
write_bulk_callback, ether_dev ); write_bulk_callback, ether_dev );
// Tell the URB how much it will be transporting today // Tell the URB how much it will be transporting today
ether_dev->tx_urb->transfer_buffer_length = count; ether_dev->tx_urb->transfer_buffer_length = skb->len;
/* Deal with the zero length problem, I hope */
ether_dev->tx_urb->transfer_flags |= URB_ZERO_PACKET;
// Send the URB on its merry way. // Send the URB on its merry way.
if ((res = usb_submit_urb(ether_dev->tx_urb, GFP_ATOMIC))) { if ((res = usb_submit_urb(ether_dev->tx_urb, GFP_ATOMIC))) {
......
...@@ -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;
......
...@@ -405,11 +405,14 @@ static int isd200_action( struct us_data *us, int action, ...@@ -405,11 +405,14 @@ static int isd200_action( struct us_data *us, int action,
{ {
union ata_cdb ata; union ata_cdb ata;
struct scsi_cmnd srb; struct scsi_cmnd srb;
struct scsi_device srb_dev;
struct isd200_info *info = (struct isd200_info *)us->extra; struct isd200_info *info = (struct isd200_info *)us->extra;
int status; int status;
memset(&ata, 0, sizeof(ata)); memset(&ata, 0, sizeof(ata));
memset(&srb, 0, sizeof(srb)); memset(&srb, 0, sizeof(srb));
memset(&srb_dev, 0, sizeof(srb_dev));
srb.device = &srb_dev;
ata.generic.SignatureByte0 = info->ConfigData.ATAMajorCommand; ata.generic.SignatureByte0 = info->ConfigData.ATAMajorCommand;
ata.generic.SignatureByte1 = info->ConfigData.ATAMinorCommand; ata.generic.SignatureByte1 = info->ConfigData.ATAMinorCommand;
...@@ -479,6 +482,7 @@ static int isd200_action( struct us_data *us, int action, ...@@ -479,6 +482,7 @@ static int isd200_action( struct us_data *us, int action,
} }
memcpy(srb.cmnd, &ata, sizeof(ata.generic)); memcpy(srb.cmnd, &ata, sizeof(ata.generic));
srb.cmd_len = sizeof(ata.generic);
status = usb_stor_Bulk_transport(&srb, us); status = usb_stor_Bulk_transport(&srb, us);
if (status == USB_STOR_TRANSPORT_GOOD) if (status == USB_STOR_TRANSPORT_GOOD)
status = ISD200_GOOD; status = ISD200_GOOD;
...@@ -538,6 +542,7 @@ void isd200_invoke_transport( struct us_data *us, ...@@ -538,6 +542,7 @@ void isd200_invoke_transport( struct us_data *us,
/* send the command to the transport layer */ /* send the command to the transport layer */
srb->resid = 0; srb->resid = 0;
memcpy(srb->cmnd, ataCdb, sizeof(ataCdb->generic)); memcpy(srb->cmnd, ataCdb, sizeof(ataCdb->generic));
srb->cmd_len = sizeof(ataCdb->generic);
transferStatus = usb_stor_Bulk_transport(srb, us); transferStatus = usb_stor_Bulk_transport(srb, us);
/* if the command gets aborted by the higher layers, we need to /* if the command gets aborted by the higher layers, we need to
......
...@@ -209,21 +209,14 @@ static int usb_storage_device_reset( Scsi_Cmnd *srb ) ...@@ -209,21 +209,14 @@ static int usb_storage_device_reset( Scsi_Cmnd *srb )
return result; return result;
} }
/* This resets the device port, and simulates the device /* This resets the device port */
* disconnect/reconnect for all drivers which have claimed /* It refuses to work if there's more than one interface in
* interfaces, including ourself. */ this device, so that other users are not affected. */
/* This is always called with scsi_lock(srb->host) held */ /* This is always called with scsi_lock(srb->host) held */
/* FIXME: This needs to be re-examined in the face of the new
* hotplug system -- this will implicitly cause a detach/reattach of
* usb-storage, which is not what we want now.
*
* Can we just skip over usb-storage in the while loop?
*/
static int usb_storage_bus_reset( Scsi_Cmnd *srb ) static int usb_storage_bus_reset( Scsi_Cmnd *srb )
{ {
struct us_data *us; struct us_data *us;
int i;
int result; int result;
/* we use the usb_reset_device() function to handle this for us */ /* we use the usb_reset_device() function to handle this for us */
...@@ -231,36 +224,25 @@ static int usb_storage_bus_reset( Scsi_Cmnd *srb ) ...@@ -231,36 +224,25 @@ static int usb_storage_bus_reset( Scsi_Cmnd *srb )
scsi_unlock(srb->device->host); scsi_unlock(srb->device->host);
us = (struct us_data *)srb->device->host->hostdata[0]; us = (struct us_data *)srb->device->host->hostdata[0];
/* attempt to reset the port */ /* The USB subsystem doesn't handle synchronisation between
result = usb_reset_device(us->pusb_dev); a device's several drivers. Therefore we reset only devices
US_DEBUGP("usb_reset_device returns %d\n", result); with one interface which we of course own.
if (result < 0) { */
scsi_lock(srb->device->host);
return FAILED; //FIXME: needs locking against config changes
if ( us->pusb_dev->actconfig->desc.bNumInterfaces == 1) {
/* attempt to reset the port */
result = usb_reset_device(us->pusb_dev);
US_DEBUGP("usb_reset_device returns %d\n", result);
} else {
result = -EBUSY;
US_DEBUGP("cannot reset a multiinterface device. failing to reset.\n");
} }
/* FIXME: This needs to lock out driver probing while it's working
* or we can have race conditions */
/* This functionality really should be provided by the khubd thread */
for (i = 0; i < us->pusb_dev->actconfig->desc.bNumInterfaces; i++) {
struct usb_interface *intf =
&us->pusb_dev->actconfig->interface[i];
/* if this is an unclaimed interface, skip it */
if (!intf->driver) {
continue;
}
US_DEBUGP("Examining driver %s...", intf->driver->name);
/* simulate a disconnect and reconnect for all interfaces */
US_DEBUGPX("simulating disconnect/reconnect.\n");
usb_device_remove (&intf->dev);
usb_device_probe (&intf->dev);
}
US_DEBUGP("bus_reset() complete\n"); US_DEBUGP("bus_reset() complete\n");
scsi_lock(srb->device->host); scsi_lock(srb->device->host);
return SUCCESS; return result < 0 ? FAILED : SUCCESS;
} }
/*********************************************************************** /***********************************************************************
......
...@@ -126,6 +126,7 @@ static int usb_stor_msg_common(struct us_data *us) ...@@ -126,6 +126,7 @@ static int usb_stor_msg_common(struct us_data *us)
us->current_urb->actual_length = 0; us->current_urb->actual_length = 0;
us->current_urb->error_count = 0; us->current_urb->error_count = 0;
us->current_urb->transfer_flags = URB_ASYNC_UNLINK; us->current_urb->transfer_flags = URB_ASYNC_UNLINK;
us->current_urb->status = 0;
/* submit the URB */ /* submit the URB */
status = usb_submit_urb(us->current_urb, GFP_NOIO); status = usb_submit_urb(us->current_urb, GFP_NOIO);
...@@ -900,7 +901,7 @@ int usb_stor_Bulk_transport(Scsi_Cmnd *srb, struct us_data *us) ...@@ -900,7 +901,7 @@ int usb_stor_Bulk_transport(Scsi_Cmnd *srb, struct us_data *us)
bcb.DataTransferLength = cpu_to_le32(transfer_length); bcb.DataTransferLength = cpu_to_le32(transfer_length);
bcb.Flags = srb->sc_data_direction == SCSI_DATA_READ ? 1 << 7 : 0; bcb.Flags = srb->sc_data_direction == SCSI_DATA_READ ? 1 << 7 : 0;
bcb.Tag = srb->serial_number; bcb.Tag = srb->serial_number;
bcb.Lun = srb->cmnd[1] >> 5; bcb.Lun = srb->device->lun;
if (us->flags & US_FL_SCM_MULT_TARG) if (us->flags & US_FL_SCM_MULT_TARG)
bcb.Lun |= srb->device->id << 4; bcb.Lun |= srb->device->id << 4;
bcb.Length = srb->cmd_len; bcb.Length = srb->cmd_len;
......
...@@ -360,7 +360,7 @@ static int usb_stor_control_thread(void * __us) ...@@ -360,7 +360,7 @@ static int usb_stor_control_thread(void * __us)
} }
else if (us->srb->device->lun > us->max_lun) { else if (us->srb->device->lun > us->max_lun) {
US_DEBUGP("Bad LUN (%d/%d)\n", US_DEBUGP("Bad LUN (%d:%d)\n",
us->srb->device->id, us->srb->device->lun); us->srb->device->id, us->srb->device->lun);
us->srb->result = DID_BAD_TARGET << 16; us->srb->result = DID_BAD_TARGET << 16;
} }
...@@ -475,8 +475,6 @@ static int usb_stor_allocate_urbs(struct us_data *ss) ...@@ -475,8 +475,6 @@ static int usb_stor_allocate_urbs(struct us_data *ss)
*/ */
static void usb_stor_deallocate_urbs(struct us_data *ss) static void usb_stor_deallocate_urbs(struct us_data *ss)
{ {
int result;
/* free the scatter-gather request block */ /* free the scatter-gather request block */
if (ss->current_sg) { if (ss->current_sg) {
kfree(ss->current_sg); kfree(ss->current_sg);
...@@ -486,8 +484,6 @@ static void usb_stor_deallocate_urbs(struct us_data *ss) ...@@ -486,8 +484,6 @@ static void usb_stor_deallocate_urbs(struct us_data *ss)
/* free up the main URB for this device */ /* free up the main URB for this device */
if (ss->current_urb) { if (ss->current_urb) {
US_DEBUGP("-- releasing main URB\n"); US_DEBUGP("-- releasing main URB\n");
result = usb_unlink_urb(ss->current_urb);
US_DEBUGP("-- usb_unlink_urb() returned %d\n", result);
usb_free_urb(ss->current_urb); usb_free_urb(ss->current_urb);
ss->current_urb = NULL; ss->current_urb = NULL;
} }
......
...@@ -72,13 +72,15 @@ MODULE_PARM(debug, "i"); ...@@ -72,13 +72,15 @@ MODULE_PARM(debug, "i");
MODULE_PARM_DESC(debug, "Debug enabled or not"); MODULE_PARM_DESC(debug, "Debug enabled or not");
/* Define these values to match your device */ /* Define these values to match your devices */
#define USB_SKEL_VENDOR_ID 0xfff0 #define USB_SKEL_VENDOR_ID 0xfff0
#define USB_SKEL_PRODUCT_ID 0xfff0 #define USB_SKEL_PRODUCT_ID 0xfff0
/* table of devices that work with this driver */ /* table of devices that work with this driver */
static struct usb_device_id skel_table [] = { static struct usb_device_id skel_table [] = {
{ USB_DEVICE(USB_SKEL_VENDOR_ID, USB_SKEL_PRODUCT_ID) }, { USB_DEVICE(USB_SKEL_VENDOR_ID, USB_SKEL_PRODUCT_ID) },
/* "Gadget Zero" firmware runs under Linux */
{ USB_DEVICE(0x0525, 0xa4a0) },
{ } /* Terminating entry */ { } /* Terminating entry */
}; };
...@@ -707,7 +709,7 @@ static int __init usb_skel_init(void) ...@@ -707,7 +709,7 @@ static int __init usb_skel_init(void)
/* register this driver with the USB subsystem */ /* register this driver with the USB subsystem */
result = usb_register(&skel_driver); result = usb_register(&skel_driver);
if (result < 0) { if (result < 0) {
err("usb_register failed for the "__FILE__" driver. Error number %d", err("usb_register failed. Error number %d",
result); result);
return -1; return -1;
} }
......
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