Commit 4f3a1d59 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

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

into kroah.com:/home/linux/BK/gregkh-2.6
parents 157e3d70 303d082c
......@@ -2796,7 +2796,7 @@ E: gt8134b@prism.gatech.edu
D: Dosemu
N: Duncan Sands
E: duncan.sands@wanadoo.fr
E: duncan.sands@free.fr
W: http://topo.math.u-psud.fr/~sands
D: Alcatel SpeedTouch USB driver
S: 69 rue Dunois
......
......@@ -468,6 +468,15 @@ contact NetChip Technologies for development boards and product
information.
</para>
<para>For users of Intel's PXA 2xx series processors,
a <filename>pxa2xx_udc</filename> driver is available.
</para>
<para>At this writing, there are people at work on drivers in
this framework for several other USB device controllers,
with plans to make many of them be widely available.
</para>
<!-- !Edrivers/usb/gadget/net2280.c -->
<para>A partial USB simulator,
......@@ -500,7 +509,7 @@ for usb controller hardware), other gadget drivers exist.
<para>There's an <emphasis>ethernet</emphasis> gadget
driver, which implements one of the most useful
<emphasis>Communications Device Class</emphasis> models.
<emphasis>Communications Device Class</emphasis> (CDC) models.
One of the standards for cable modem interoperability even
specifies the use of this ethernet model as one of two
mandatory options.
......@@ -509,6 +518,11 @@ an Ethernet adapter.
It provides access to a network where the gadget's CPU is one host,
which could easily be bridging, routing, or firewalling
access to other networks.
Since some hardware can't fully implement the CDC Ethernet
requirements, this driver also implements a "good parts only"
subset of CDC Ethernet.
(That subset doesn't advertise itself as CDC Ethernet,
to avoid creating problems.)
</para>
<para>There is also support for user mode gadget drivers,
......@@ -522,6 +536,17 @@ controller driver is available many applications for it
won't require new kernel mode software.
</para>
<para>There's a USB Mass Storage class driver, which provides
a different solution for interoperability with systems such
as MS-Windows and MacOS.
That <emphasis>File-backed Storage</emphasis> driver uses a
file or block device as backing store for a drive,
like the <filename>loop</filename> driver.
The USB host uses the BBB, CB, or CBI versions of the mass
storage class specification, using transparent SCSI commands
to access the data from the backing store.
</para>
<para>Support for other kinds of gadget is expected to
be developed and contributed
over time, as this driver framework evolves.
......
......@@ -209,7 +209,7 @@ static int skel_probe(struct usb_interface *interface,
The driver now needs to verify that this device is actually one that it
can accept. If so, it returns 0.
If not, or if any error occurs during initialization, an errorcode
(such as <literal>-ENOMEM<literal> or <literal>-ENODEV<literal>)
(such as <literal>-ENOMEM</literal> or <literal>-ENODEV</literal>)
is returned from the probe function.
</para>
<para>
......@@ -327,6 +327,7 @@ if (!retval) {
talk to the device, the release function in the driver is called. In this
function we decrement our private usage count and wait for possible
pending writes:
</para>
<programlisting>
/* decrement our usage count for the device */
--skel->open_count;
......
......@@ -212,7 +212,7 @@ S: Maintained
ALCATEL SPEEDTOUCH USB DRIVER
P: Duncan Sands
M: duncan.sands@wanadoo.fr
M: duncan.sands@free.fr
L: linux-usb-users@lists.sourceforge.net
L: linux-usb-devel@lists.sourceforge.net
W: http://www.linux-usb.org/SpeedTouch/
......
......@@ -33,10 +33,8 @@ config USB
It doesn't normally hurt to select them all if you are not certain.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called usbcore. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called usbcore.
source "drivers/usb/core/Kconfig"
......@@ -82,10 +80,8 @@ config USB_USS720
Say Y here if you own an USS-720 USB->Parport cable and intend to
connect anything other than a printer to it.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called uss720. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called uss720.
source "drivers/usb/serial/Kconfig"
......
......@@ -159,7 +159,10 @@ static void usblp_dump(struct usblp *usblp) {
dbg("usblp=0x%p", usblp);
dbg("dev=0x%p", usblp->dev);
dbg("present=%d", usblp->present);
dbg("buf=0x%p", usblp->buf);
dbg("readbuf=0x%p", usblp->readbuf);
dbg("writebuf=0x%p", usblp->writebuf);
dbg("readurb=0x%p", usblp->readurb);
dbg("writeurb=0x%p", usblp->writeurb);
dbg("readcount=%d", usblp->readcount);
dbg("ifnum=%d", usblp->ifnum);
for (p = USBLP_FIRST_PROTOCOL; p <= USBLP_LAST_PROTOCOL; p++) {
......
......@@ -10,255 +10,182 @@
/* these maximums are arbitrary */
#define USB_MAXCONFIG 8
#define USB_ALTSETTINGALLOC 4
#define USB_MAXINTERFACES 32
static int usb_parse_endpoint(struct usb_host_endpoint *endpoint, unsigned char *buffer, int size)
{
unsigned char *buffer0 = buffer;
struct usb_descriptor_header *header;
unsigned char *begin;
int parsed = 0, len, numskipped;
int numskipped;
header = (struct usb_descriptor_header *)buffer;
/* Everything should be fine being passed into here, but we sanity */
/* check JIC */
if (header->bLength > size) {
err("ran out of descriptors parsing");
return -1;
}
if (header->bDescriptorType != USB_DT_ENDPOINT) {
warn("unexpected descriptor 0x%X, expecting endpoint, 0x%X",
header->bDescriptorType, USB_DT_ENDPOINT);
return parsed;
return -EINVAL;
}
if (header->bLength == USB_DT_ENDPOINT_AUDIO_SIZE)
if (header->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE)
memcpy(&endpoint->desc, buffer, USB_DT_ENDPOINT_AUDIO_SIZE);
else
else if (header->bLength >= USB_DT_ENDPOINT_SIZE)
memcpy(&endpoint->desc, buffer, USB_DT_ENDPOINT_SIZE);
else {
warn("invalid endpoint descriptor");
return -EINVAL;
}
if ((endpoint->desc.bEndpointAddress & ~USB_ENDPOINT_DIR_MASK) >= 16) {
warn("invalid endpoint address 0x%X",
endpoint->desc.bEndpointAddress);
return -EINVAL;
}
le16_to_cpus(&endpoint->desc.wMaxPacketSize);
buffer += header->bLength;
size -= header->bLength;
parsed += header->bLength;
/* Skip over the rest of the Class Specific or Vendor Specific */
/* descriptors */
/* Skip over any Class Specific or Vendor Specific descriptors */
begin = buffer;
numskipped = 0;
while (size >= sizeof(struct usb_descriptor_header)) {
header = (struct usb_descriptor_header *)buffer;
if (header->bLength < 2) {
err("invalid descriptor length of %d", header->bLength);
return -1;
}
/* If we find another "proper" descriptor then we're done */
if ((header->bDescriptorType == USB_DT_ENDPOINT) ||
(header->bDescriptorType == USB_DT_INTERFACE) ||
(header->bDescriptorType == USB_DT_CONFIG) ||
(header->bDescriptorType == USB_DT_DEVICE))
(header->bDescriptorType == USB_DT_INTERFACE))
break;
dbg("skipping descriptor 0x%X",
header->bDescriptorType);
dbg("skipping descriptor 0x%X", header->bDescriptorType);
numskipped++;
buffer += header->bLength;
size -= header->bLength;
parsed += header->bLength;
}
if (numskipped)
if (numskipped) {
dbg("skipped %d class/vendor specific endpoint descriptors", numskipped);
/* Copy any unknown descriptors into a storage area for drivers */
/* to later parse */
len = (int)(buffer - begin);
if (!len) {
endpoint->extra = NULL;
endpoint->extralen = 0;
return parsed;
endpoint->extra = begin;
endpoint->extralen = buffer - begin;
}
endpoint->extra = kmalloc(len, GFP_KERNEL);
if (!endpoint->extra) {
err("couldn't allocate memory for endpoint extra descriptors");
endpoint->extralen = 0;
return parsed;
}
memcpy(endpoint->extra, begin, len);
endpoint->extralen = len;
return parsed;
return buffer - buffer0;
}
static void usb_release_intf(struct device *dev)
{
struct usb_interface *intf;
int j;
int k;
intf = to_usb_interface(dev);
if (intf->altsetting) {
for (j = 0; j < intf->num_altsetting; j++) {
struct usb_host_interface *as = &intf->altsetting[j];
if (as->extra)
kfree(as->extra);
if (as->endpoint) {
for (k = 0; k < as->desc.bNumEndpoints; k++)
if (as->endpoint[k].extra)
kfree(as->endpoint[k].extra);
kfree(as->endpoint);
}
}
kfree(intf->altsetting);
}
kfree(intf);
}
static int usb_parse_interface(struct usb_interface *interface, unsigned char *buffer, int size)
static int usb_parse_interface(struct usb_host_config *config, unsigned char *buffer, int size)
{
int i, len, numskipped, retval, parsed = 0;
struct usb_descriptor_header *header;
unsigned char *buffer0 = buffer;
struct usb_interface_descriptor *d;
int inum, asnum;
struct usb_interface *interface;
struct usb_host_interface *ifp;
int len, numskipped;
struct usb_descriptor_header *header;
unsigned char *begin;
int i, retval;
interface->act_altsetting = 0;
interface->num_altsetting = 0;
interface->max_altsetting = USB_ALTSETTINGALLOC;
device_initialize(&interface->dev);
interface->dev.release = usb_release_intf;
/* put happens in usb_destroy_configuration */
get_device(&interface->dev);
interface->altsetting = kmalloc(sizeof(*interface->altsetting) * interface->max_altsetting,
GFP_KERNEL);
if (!interface->altsetting) {
err("couldn't kmalloc interface->altsetting");
return -1;
d = (struct usb_interface_descriptor *) buffer;
if (d->bDescriptorType != USB_DT_INTERFACE) {
warn("unexpected descriptor 0x%X, expecting interface, 0x%X",
d->bDescriptorType, USB_DT_INTERFACE);
return -EINVAL;
}
while (size > 0) {
struct usb_interface_descriptor *d;
if (interface->num_altsetting >= interface->max_altsetting) {
struct usb_host_interface *ptr;
int oldmas;
inum = d->bInterfaceNumber;
if (inum >= config->desc.bNumInterfaces) {
oldmas = interface->max_altsetting;
interface->max_altsetting += USB_ALTSETTINGALLOC;
if (interface->max_altsetting > USB_MAXALTSETTING) {
warn("too many alternate settings (incr %d max %d)\n",
USB_ALTSETTINGALLOC, USB_MAXALTSETTING);
return -1;
}
/* Skip to the next interface descriptor */
buffer += d->bLength;
size -= d->bLength;
while (size >= sizeof(struct usb_descriptor_header)) {
header = (struct usb_descriptor_header *) buffer;
ptr = kmalloc(sizeof(*ptr) * interface->max_altsetting, GFP_KERNEL);
if (ptr == NULL) {
err("couldn't kmalloc interface->altsetting");
return -1;
if (header->bDescriptorType == USB_DT_INTERFACE)
break;
buffer += header->bLength;
size -= header->bLength;
}
memcpy(ptr, interface->altsetting, sizeof(*interface->altsetting) * oldmas);
kfree(interface->altsetting);
interface->altsetting = ptr;
return buffer - buffer0;
}
ifp = interface->altsetting + interface->num_altsetting;
ifp->endpoint = NULL;
ifp->extra = NULL;
ifp->extralen = 0;
interface->num_altsetting++;
interface = config->interface[inum];
asnum = d->bAlternateSetting;
if (asnum >= interface->num_altsetting) {
warn("invalid alternate setting %d for interface %d",
asnum, inum);
return -EINVAL;
}
memcpy(ifp, buffer, USB_DT_INTERFACE_SIZE);
ifp = &interface->altsetting[asnum];
if (ifp->desc.bLength) {
warn("duplicate descriptor for interface %d altsetting %d",
inum, asnum);
return -EINVAL;
}
memcpy(&ifp->desc, buffer, USB_DT_INTERFACE_SIZE);
/* Skip over the interface */
buffer += ifp->desc.bLength;
parsed += ifp->desc.bLength;
size -= ifp->desc.bLength;
buffer += d->bLength;
size -= d->bLength;
/* Skip over any Class Specific or Vendor Specific descriptors */
begin = buffer;
numskipped = 0;
/* Skip over any interface, class or vendor descriptors */
while (size >= sizeof(struct usb_descriptor_header)) {
header = (struct usb_descriptor_header *)buffer;
if (header->bLength < 2) {
err("invalid descriptor length of %d", header->bLength);
return -1;
}
/* If we find another "proper" descriptor then we're done */
if ((header->bDescriptorType == USB_DT_INTERFACE) ||
(header->bDescriptorType == USB_DT_ENDPOINT) ||
(header->bDescriptorType == USB_DT_CONFIG) ||
(header->bDescriptorType == USB_DT_DEVICE))
(header->bDescriptorType == USB_DT_ENDPOINT))
break;
dbg("skipping descriptor 0x%X", header->bDescriptorType);
numskipped++;
buffer += header->bLength;
parsed += header->bLength;
size -= header->bLength;
}
if (numskipped)
if (numskipped) {
dbg("skipped %d class/vendor specific interface descriptors", numskipped);
/* Copy any unknown descriptors into a storage area for */
/* drivers to later parse */
len = (int)(buffer - begin);
if (len) {
ifp->extra = kmalloc(len, GFP_KERNEL);
if (!ifp->extra) {
err("couldn't allocate memory for interface extra descriptors");
ifp->extralen = 0;
return -1;
}
memcpy(ifp->extra, begin, len);
ifp->extralen = len;
ifp->extra = begin;
ifp->extralen = buffer - begin;
}
/* Did we hit an unexpected descriptor? */
header = (struct usb_descriptor_header *)buffer;
if ((size >= sizeof(struct usb_descriptor_header)) &&
((header->bDescriptorType == USB_DT_CONFIG) ||
(header->bDescriptorType == USB_DT_DEVICE)))
return parsed;
if (ifp->desc.bNumEndpoints > USB_MAXENDPOINTS) {
warn("too many endpoints");
return -1;
warn("too many endpoints for interface %d altsetting %d",
inum, asnum);
return -EINVAL;
}
ifp->endpoint = (struct usb_host_endpoint *)
kmalloc(ifp->desc.bNumEndpoints *
sizeof(struct usb_host_endpoint), GFP_KERNEL);
len = ifp->desc.bNumEndpoints * sizeof(struct usb_host_endpoint);
ifp->endpoint = kmalloc(len, GFP_KERNEL);
if (!ifp->endpoint) {
err("out of memory");
return -1;
return -ENOMEM;
}
memset(ifp->endpoint, 0, ifp->desc.bNumEndpoints *
sizeof(struct usb_host_endpoint));
memset(ifp->endpoint, 0, len);
for (i = 0; i < ifp->desc.bNumEndpoints; i++) {
header = (struct usb_descriptor_header *)buffer;
if (header->bLength > size) {
err("ran out of descriptors parsing");
return -1;
if (size < USB_DT_ENDPOINT_SIZE) {
warn("ran out of descriptors while parsing endpoints");
return -EINVAL;
}
retval = usb_parse_endpoint(ifp->endpoint + i, buffer, size);
......@@ -266,77 +193,129 @@ static int usb_parse_interface(struct usb_interface *interface, unsigned char *b
return retval;
buffer += retval;
parsed += retval;
size -= retval;
}
/* We check to see if it's an alternate to this one */
d = (struct usb_interface_descriptor *)buffer;
if (size < USB_DT_INTERFACE_SIZE
|| d->bDescriptorType != USB_DT_INTERFACE
|| !d->bAlternateSetting)
return parsed;
}
return parsed;
return buffer - buffer0;
}
int usb_parse_configuration(struct usb_host_config *config, char *buffer)
int usb_parse_configuration(struct usb_host_config *config, char *buffer, int size)
{
int i, size;
int retval = -EINVAL;
int nintf, nintf_orig;
int i, j;
struct usb_interface *interface;
char *buffer2;
int size2;
struct usb_descriptor_header *header;
int numskipped, len;
char *begin;
int retval;
memcpy(&config->desc, buffer, USB_DT_CONFIG_SIZE);
le16_to_cpus(&config->desc.wTotalLength);
size = config->desc.wTotalLength;
if (config->desc.bDescriptorType != USB_DT_CONFIG ||
config->desc.bLength < USB_DT_CONFIG_SIZE) {
warn("invalid configuration descriptor");
return -EINVAL;
}
config->desc.wTotalLength = size;
nintf = nintf_orig = config->desc.bNumInterfaces;
if (nintf > USB_MAXINTERFACES) {
warn("too many interfaces (%d max %d)",
nintf, USB_MAXINTERFACES);
config->desc.bNumInterfaces = nintf = USB_MAXINTERFACES;
}
for (i = 0; i < USB_MAXINTERFACES; ++i)
config->interface[i] = NULL;
for (i = 0; i < nintf; ++i) {
interface = config->interface[i] =
kmalloc(sizeof(struct usb_interface), GFP_KERNEL);
dbg("kmalloc IF %p, numif %i", interface, i);
if (!interface) {
err("out of memory");
return -ENOMEM;
}
memset(interface, 0, sizeof(struct usb_interface));
interface->dev.release = usb_release_intf;
device_initialize(&interface->dev);
if (config->desc.bNumInterfaces > USB_MAXINTERFACES) {
warn("too many interfaces");
goto error;
/* put happens in usb_destroy_configuration */
get_device(&interface->dev);
}
/* Go through the descriptors, checking their length and counting the
* number of altsettings for each interface */
buffer2 = buffer;
size2 = size;
j = 0;
while (size2 >= sizeof(struct usb_descriptor_header)) {
header = (struct usb_descriptor_header *) buffer2;
if ((header->bLength > size2) || (header->bLength < 2)) {
warn("invalid descriptor of length %d", header->bLength);
return -EINVAL;
}
if (header->bDescriptorType == USB_DT_INTERFACE) {
struct usb_interface_descriptor *d;
if (header->bLength < USB_DT_INTERFACE_SIZE) {
warn("invalid interface descriptor");
return -EINVAL;
}
d = (struct usb_interface_descriptor *) header;
i = d->bInterfaceNumber;
if (i >= nintf_orig) {
warn("invalid interface number (%d/%d)",
i, nintf_orig);
return -EINVAL;
}
if (i < nintf)
++config->interface[i]->num_altsetting;
} else if ((header->bDescriptorType == USB_DT_DEVICE ||
header->bDescriptorType == USB_DT_CONFIG) && j) {
warn("unexpected descriptor type 0x%X", header->bDescriptorType);
return -EINVAL;
}
j = 1;
buffer2 += header->bLength;
size2 -= header->bLength;
}
/* Allocate the altsetting arrays */
for (i = 0; i < config->desc.bNumInterfaces; ++i) {
config->interface[i] = kmalloc(sizeof(struct usb_interface), GFP_KERNEL);
dbg("kmalloc IF %p, numif %i", config->interface[i], i);
if (!config->interface[i]) {
err("out of memory");
retval = -ENOMEM;
goto error;
interface = config->interface[i];
if (interface->num_altsetting > USB_MAXALTSETTING) {
warn("too many alternate settings for interface %d (%d max %d)\n",
i, interface->num_altsetting, USB_MAXALTSETTING);
return -EINVAL;
}
memset(config->interface[i], 0x00, sizeof(struct usb_interface));
if (interface->num_altsetting == 0) {
warn("no alternate settings for interface %d", i);
return -EINVAL;
}
len = sizeof(*interface->altsetting) * interface->num_altsetting;
interface->altsetting = kmalloc(len, GFP_KERNEL);
if (!interface->altsetting) {
err("couldn't kmalloc interface->altsetting");
return -ENOMEM;
}
memset(interface->altsetting, 0, len);
}
buffer += config->desc.bLength;
size -= config->desc.bLength;
config->extra = NULL;
config->extralen = 0;
for (i = 0; i < config->desc.bNumInterfaces; i++) {
int numskipped, len;
char *begin;
/* Skip over the rest of the Class Specific or Vendor */
/* Specific descriptors */
/* Skip over any Class Specific or Vendor Specific descriptors */
begin = buffer;
numskipped = 0;
while (size >= sizeof(struct usb_descriptor_header)) {
header = (struct usb_descriptor_header *)buffer;
if ((header->bLength > size) || (header->bLength < 2)) {
err("invalid descriptor length of %d", header->bLength);
return -1;
}
/* If we find another "proper" descriptor then we're done */
if ((header->bDescriptorType == USB_DT_ENDPOINT) ||
(header->bDescriptorType == USB_DT_INTERFACE) ||
(header->bDescriptorType == USB_DT_CONFIG) ||
(header->bDescriptorType == USB_DT_DEVICE))
(header->bDescriptorType == USB_DT_INTERFACE))
break;
dbg("skipping descriptor 0x%X", header->bDescriptorType);
......@@ -345,29 +324,15 @@ int usb_parse_configuration(struct usb_host_config *config, char *buffer)
buffer += header->bLength;
size -= header->bLength;
}
if (numskipped)
dbg("skipped %d class/vendor specific endpoint descriptors", numskipped);
/* Copy any unknown descriptors into a storage area for */
/* drivers to later parse */
len = (int)(buffer - begin);
if (len) {
if (config->extralen) {
warn("extra config descriptor");
} else {
config->extra = kmalloc(len, GFP_KERNEL);
if (!config->extra) {
err("couldn't allocate memory for config extra descriptors");
config->extralen = 0;
return -1;
}
memcpy(config->extra, begin, len);
config->extralen = len;
}
if (numskipped) {
dbg("skipped %d class/vendor specific configuration descriptors", numskipped);
config->extra = begin;
config->extralen = buffer - begin;
}
retval = usb_parse_interface(config->interface[i], buffer, size);
/* Parse all the interface/altsetting descriptors */
while (size >= sizeof(struct usb_descriptor_header)) {
retval = usb_parse_interface(config, buffer, size);
if (retval < 0)
return retval;
......@@ -375,11 +340,18 @@ int usb_parse_configuration(struct usb_host_config *config, char *buffer)
size -= retval;
}
/* Check for missing altsettings */
for (i = 0; i < nintf; ++i) {
interface = config->interface[i];
for (j = 0; j < interface->num_altsetting; ++j) {
if (!interface->altsetting[j].desc.bLength) {
warn("missing altsetting %d for interface %d", j, i);
return -EINVAL;
}
}
}
return size;
error:
for (i = 0; i < USB_MAXINTERFACES; ++i)
kfree(config->interface[i]);
return retval;
}
// hub-only!! ... and only exported for reset/reinit path.
......@@ -401,11 +373,10 @@ void usb_destroy_configuration(struct usb_device *dev)
for (c = 0; c < dev->descriptor.bNumConfigurations; c++) {
struct usb_host_config *cf = &dev->config[c];
if (!cf->interface)
break;
for (i = 0; i < cf->desc.bNumInterfaces; i++) {
struct usb_interface *ifp = cf->interface[i];
if (ifp)
put_device(&ifp->dev);
}
}
......@@ -417,38 +388,39 @@ void usb_destroy_configuration(struct usb_device *dev)
// (used by real hubs and virtual root hubs)
int usb_get_configuration(struct usb_device *dev)
{
int ncfg = dev->descriptor.bNumConfigurations;
int result;
unsigned int cfgno, length;
unsigned char *buffer;
unsigned char *bigbuffer;
struct usb_config_descriptor *desc;
if (dev->descriptor.bNumConfigurations > USB_MAXCONFIG) {
warn("too many configurations");
return -EINVAL;
if (ncfg > USB_MAXCONFIG) {
warn("too many configurations (%d max %d)",
ncfg, USB_MAXCONFIG);
dev->descriptor.bNumConfigurations = ncfg = USB_MAXCONFIG;
}
if (dev->descriptor.bNumConfigurations < 1) {
warn("not enough configurations");
if (ncfg < 1) {
warn("no configurations");
return -EINVAL;
}
dev->config = (struct usb_host_config *)
kmalloc(dev->descriptor.bNumConfigurations *
sizeof(struct usb_host_config), GFP_KERNEL);
length = ncfg * sizeof(struct usb_host_config);
dev->config = kmalloc(length, GFP_KERNEL);
if (!dev->config) {
err("out of memory");
return -ENOMEM;
}
memset(dev->config, 0, dev->descriptor.bNumConfigurations *
sizeof(struct usb_host_config));
memset(dev->config, 0, length);
dev->rawdescriptors = (char **)kmalloc(sizeof(char *) *
dev->descriptor.bNumConfigurations, GFP_KERNEL);
length = ncfg * sizeof(char *);
dev->rawdescriptors = kmalloc(length, GFP_KERNEL);
if (!dev->rawdescriptors) {
err("out of memory");
return -ENOMEM;
}
memset(dev->rawdescriptors, 0, length);
buffer = kmalloc(8, GFP_KERNEL);
if (!buffer) {
......@@ -457,7 +429,7 @@ int usb_get_configuration(struct usb_device *dev)
}
desc = (struct usb_config_descriptor *)buffer;
for (cfgno = 0; cfgno < dev->descriptor.bNumConfigurations; cfgno++) {
for (cfgno = 0; cfgno < ncfg; cfgno++) {
/* We grab the first 8 bytes so we know how long the whole */
/* configuration is */
result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, buffer, 8);
......@@ -465,14 +437,14 @@ int usb_get_configuration(struct usb_device *dev)
if (result < 0)
err("unable to get descriptor");
else {
err("config descriptor too short (expected %i, got %i)", 8, result);
warn("config descriptor too short (expected %i, got %i)", 8, result);
result = -EINVAL;
}
goto err;
}
/* Get the full buffer */
length = le16_to_cpu(desc->wTotalLength);
length = max((int) le16_to_cpu(desc->wTotalLength), USB_DT_CONFIG_SIZE);
bigbuffer = kmalloc(length, GFP_KERNEL);
if (!bigbuffer) {
......@@ -498,11 +470,11 @@ int usb_get_configuration(struct usb_device *dev)
dev->rawdescriptors[cfgno] = bigbuffer;
result = usb_parse_configuration(&dev->config[cfgno], bigbuffer);
result = usb_parse_configuration(&dev->config[cfgno], bigbuffer, length);
if (result > 0)
dbg("descriptor data left");
else if (result < 0) {
result = -EINVAL;
++cfgno;
goto err;
}
}
......
......@@ -859,8 +859,7 @@ static int hub_port_debounce(struct usb_device *hub, int port)
}
}
/* XXX Replace this with dbg() when 2.6 is about to ship. */
dev_info (hubdev (hub),
dev_dbg (hubdev (hub),
"debounce: port %d: delay %dms stable %d status 0x%x\n",
port + 1, delay_time, stable_count, portstatus);
......
......@@ -1424,14 +1424,15 @@ static int usb_device_suspend(struct device *dev, u32 state)
struct usb_interface *intf;
struct usb_driver *driver;
if ((dev->driver == &usb_generic_driver) ||
if ((dev->driver == NULL) ||
(dev->driver == &usb_generic_driver) ||
(dev->driver_data == &usb_generic_driver_data))
return 0;
intf = to_usb_interface(dev);
driver = to_usb_driver(dev->driver);
if (driver && driver->suspend)
if (driver->suspend)
return driver->suspend(intf, state);
return 0;
}
......@@ -1441,14 +1442,15 @@ static int usb_device_resume(struct device *dev)
struct usb_interface *intf;
struct usb_driver *driver;
if ((dev->driver == &usb_generic_driver) ||
if ((dev->driver == NULL) ||
(dev->driver == &usb_generic_driver) ||
(dev->driver_data == &usb_generic_driver_data))
return 0;
intf = to_usb_interface(dev);
driver = to_usb_driver(dev->driver);
if (driver && driver->resume)
if (driver->resume)
return driver->resume(intf);
return 0;
}
......
......@@ -68,7 +68,7 @@ choice
config USB_ZERO
tristate "Gadget Zero (DEVELOPMENT)"
depends on USB_GADGET && (USB_DUMMY_HCD || USB_NET2280 || USB_PXA250 || USB_SA1100)
depends on USB_GADGET && (USB_DUMMY_HCD || USB_NET2280 || USB_PXA2XX || USB_SA1100)
help
Gadget Zero is a two-configuration device. It either sinks and
sources bulk data; or it loops back a configurable number of
......@@ -97,9 +97,9 @@ config USB_ZERO_NET2280
depends on USB_ZERO && (USB_NET2280 || USB_DUMMY_HCD)
default y
config USB_ZERO_PXA250
config USB_ZERO_PXA2XX
bool
depends on USB_ZERO && USB_PXA250
depends on USB_ZERO && USB_PXA2XX
default y
config USB_ZERO_SA1100
......@@ -110,22 +110,28 @@ config USB_ZERO_SA1100
config USB_ETH
tristate "Ethernet Gadget"
depends on USB_GADGET && (USB_DUMMY_HCD || USB_NET2280 || USB_PXA250 || USB_SA1100)
depends on USB_GADGET && (USB_DUMMY_HCD || USB_NET2280 || USB_PXA2XX || USB_SA1100)
help
This driver implements the "Communication Device Class" (CDC)
Ethernet Control Model. That protocol is often avoided with pure
Ethernet adapters, in favor of simpler vendor-specific hardware,
but is widely supported by firmware for smart network devices.
This driver implements Ethernet style communication, in either
of two ways:
- The "Communication Device Class" (CDC) Ethernet Control Model.
That protocol is often avoided with pure Ethernet adapters, in
favor of simpler vendor-specific hardware, but is widely
supported by firmware for smart network devices.
- On hardware can't implement that protocol, a simpler approach
is used, placing fewer demands on USB.
Within the USB device, this gadget driver exposes a network device
"usbX", where X depends on what other networking devices you have.
Treat it like a two-node Ethernet link: host, and gadget.
The Linux-USB host-side "usbnet" driver interoperates with this
driver, so that deep I/O queues can be supported. (On 2.4 kernels,
use "CDCEther" instead.) Deep queues are especially important with
high speed devices. It should also interoperate with standard CDC
Ethernet class drivers on other host operating systems.
driver, so that deep I/O queues can be supported. On 2.4 kernels,
use "CDCEther" instead, if you're using the CDC option. That CDC
mode should also interoperate with standard CDC Ethernet class
drivers on other host operating systems.
Say "y" to link the driver statically, or "m" to build a
dynamically linked module called "g_ether".
......@@ -137,9 +143,9 @@ config USB_ETH_NET2280
depends on USB_ETH && (USB_NET2280 || USB_DUMMY_HCD)
default y
config USB_ETH_PXA250
config USB_ETH_PXA2XX
bool
depends on USB_ETH && USB_PXA250
depends on USB_ETH && USB_PXA2XX
default y
config USB_ETH_SA1100
......
......@@ -28,7 +28,6 @@
#include <linux/fs.h>
#include <linux/pagemap.h>
#include <linux/uts.h>
#include <linux/version.h>
#include <linux/wait.h>
#include <linux/compiler.h>
#include <asm/uaccess.h>
......
......@@ -20,10 +20,8 @@ config USB_HID
If unsure, say Y.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called hid. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called hid.
comment "Input core support is needed for USB HID input layer or HIDBP support"
depends on USB && INPUT=n
......@@ -104,10 +102,8 @@ config USB_KBD
This is almost certainly not what you want. This is mostly
useful for embedded applications or simple keyboards.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called usbkbd. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called usbkbd.
If even remotely unsure, say N.
......@@ -122,10 +118,8 @@ config USB_MOUSE
This is almost certainly not what you want. This is mostly
useful for embedded applications or simple mice.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called usbmouse. If you want to compile it as
a module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called usbmouse.
If even remotely unsure, say N.
......@@ -140,10 +134,8 @@ config USB_AIPTEK
(CONFIG_INPUT_MOUSEDEV) and/or "Event interface support"
(CONFIG_INPUT_EVDEV) as well.
This driver is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called aiptek. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called aiptek.
config USB_WACOM
tristate "Wacom Intuos/Graphire tablet support"
......@@ -154,10 +146,8 @@ config USB_WACOM
(CONFIG_INPUT_MOUSEDEV) and/or "Event interface support"
(CONFIG_INPUT_EVDEV) as well.
This driver is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called wacom. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called wacom.
config USB_KBTAB
tristate "KB Gear JamStudio tablet support"
......@@ -168,10 +158,8 @@ config USB_KBTAB
(CONFIG_INPUT_MOUSEDEV) and/or "Event interface support"
(CONFIG_INPUT_EVDEV) as well.
This driver is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called kbtab.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called kbtab.
config USB_POWERMATE
tristate "Griffin PowerMate and Contour Jog support"
......@@ -184,10 +172,8 @@ config USB_POWERMATE
You can download userspace tools from http://sowerbutts.com/powermate/
This driver is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called powermate. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called powermate.
config USB_XPAD
tristate "X-Box gamepad support"
......@@ -200,8 +186,6 @@ config USB_XPAD
For information about how to connect the X-Box pad to USB, see
Documentation/input/xpad.txt.
This driver is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called xpad. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called xpad.
......@@ -14,10 +14,8 @@ config USB_DABUSB
isochronous transactions. URB's are explained in
<file:Documentation/usb/URB.txt>.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called dabusb. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called dabusb.
comment "Video4Linux support is needed for USB Multimedia device support"
depends on USB && VIDEO_DEV=n
......@@ -33,10 +31,8 @@ config USB_VICAM
Information on this API and pointers to "v4l" programs may be found
on the WWW at <http://roadrunner.swansea.uk.linux.org/v4l.shtml>.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called vicam. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called vicam.
config USB_DSBR
tristate "D-Link USB FM radio support (EXPERIMENTAL)"
......@@ -53,10 +49,8 @@ config USB_DSBR
"v4l" programs may be found on the WWW at
<http://roadrunner.swansea.uk.linux.org/v4l.shtml>.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called dsbr100. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called dsbr100.
config USB_IBMCAM
tristate "USB IBM (Xirlink) C-it Camera support"
......@@ -72,13 +66,12 @@ config USB_IBMCAM
"v4l" programs may be found on the WWW at
<http://roadrunner.swansea.uk.linux.org/v4l.shtml>.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called ibmcam. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>. This
camera has several configuration options which can be specified when
you load the module. Read <file:Documentation/usb/ibmcam.txt> to
learn more.
To compile this driver as a module, say M here: the
module will be called ibmcam.
This camera has several configuration options which
can be specified when you load the module. Read
<file:Documentation/usb/ibmcam.txt> to learn more.
config USB_KONICAWC
tristate "USB Konica Webcam support"
......@@ -93,10 +86,8 @@ config USB_KONICAWC
"v4l" programs may be found on the WWW at
<http://roadrunner.swansea.uk.linux.org/v4l.shtml>.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called konicawc. If you want to compile it as
a module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called konicawc.
config USB_OV511
tristate "USB OV511 Camera support"
......@@ -111,10 +102,8 @@ config USB_OV511
Information on this API and pointers to "v4l" programs may be found
on the WWW at <http://roadrunner.swansea.uk.linux.org/v4l.shtml>.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called ov511. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called ov511.
config USB_PWC
tristate "USB Philips Cameras"
......@@ -152,10 +141,8 @@ config USB_PWC
Information on this API and pointers to "v4l" programs may be found
on the WWW at <http://roadrunner.swansea.uk.linux.org/v4l.shtml>.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called pwc. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called pwc.
config USB_SE401
tristate "USB SE401 Camera support"
......@@ -170,10 +157,8 @@ config USB_SE401
Information on this API and pointers to "v4l" programs may be found
on the WWW at <http://roadrunner.swansea.uk.linux.org/v4l.shtml>.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called se401. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called se401.
config USB_STV680
tristate "USB STV680 (Pencam) Camera support"
......@@ -189,8 +174,6 @@ config USB_STV680
Information on this API and pointers to "v4l" programs may be found
on the WWW at <http://roadrunner.swansea.uk.linux.org/v4l.shtml>.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called stv680. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called stv680.
......@@ -89,7 +89,6 @@ static int dabusb_add_buf_tail (pdabusb_t s, struct list_head *dst, struct list_
static void dump_urb (struct urb *urb)
{
dbg("urb :%p", urb);
dbg("next :%p", urb->next);
dbg("dev :%p", urb->dev);
dbg("pipe :%08X", urb->pipe);
dbg("status :%d", urb->status);
......@@ -728,7 +727,7 @@ static int dabusb_probe (struct usb_interface *intf,
pdabusb_t s;
dbg("dabusb: probe: vendor id 0x%x, device id 0x%x ifnum:%d",
usbdev->descriptor.idVendor, usbdev->descriptor.idProduct, ifnum);
usbdev->descriptor.idVendor, usbdev->descriptor.idProduct, intf->altsetting->desc.bInterfaceNumber);
/* We don't handle multiple configurations */
if (usbdev->descriptor.bNumConfigurations != 1)
......@@ -762,7 +761,7 @@ static int dabusb_probe (struct usb_interface *intf,
goto reject;
}
}
dbg("bound to interface: %d", ifnum);
dbg("bound to interface: %d", intf->altsetting->desc.bInterfaceNumber);
usb_set_intfdata (intf, s);
up (&s->mutex);
......
......@@ -24,7 +24,6 @@
#include <linux/vmalloc.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/mm.h>
#include <asm/io.h>
......
......@@ -1292,7 +1292,7 @@ vicam_probe( struct usb_interface *intf, const struct usb_device_id *id)
interface = &intf->altsetting[0];
DBG(KERN_DEBUG "Interface %d. has %u. endpoints!\n",
ifnum, (unsigned) (interface->desc.bNumEndpoints));
interface->desc.bInterfaceNumber, (unsigned) (interface->desc.bNumEndpoints));
endpoint = &interface->endpoint[0].desc;
if ((endpoint->bEndpointAddress & 0x80) &&
......
......@@ -21,7 +21,9 @@
******************************************************************************/
/*
* Written by Johan Verrept, maintained by Duncan Sands (duncan.sands@wanadoo.fr)
* Written by Johan Verrept, maintained by Duncan Sands (duncan.sands@free.fr)
*
* 1.7+: - See the check-in logs
*
* 1.6: - No longer opens a connection if the firmware is not loaded
* - Added support for the speedtouch 330
......@@ -84,6 +86,11 @@
#include <linux/usb.h>
#ifdef DEBUG
#define DEBUG_ON(x) BUG_ON(x)
#else
#define DEBUG_ON(x) do { if (x); } while (0)
#endif
#ifdef VERBOSE_DEBUG
static int udsl_print_packet (const unsigned char *data, int len);
......@@ -94,9 +101,9 @@ static int udsl_print_packet (const unsigned char *data, int len);
#define vdbg(arg...)
#endif
#define DRIVER_AUTHOR "Johan Verrept, Duncan Sands <duncan.sands@wanadoo.fr>"
#define DRIVER_AUTHOR "Johan Verrept, Duncan Sands <duncan.sands@free.fr>"
#define DRIVER_DESC "Alcatel SpeedTouch USB driver"
#define DRIVER_VERSION "1.6"
#define DRIVER_VERSION "1.7"
static const char udsl_driver_name [] = "speedtch";
......@@ -109,10 +116,10 @@ static const char udsl_driver_name [] = "speedtch";
#define UDSL_MAX_SND_BUFS 8
#define UDSL_MAX_RCV_BUF_SIZE 1024 /* ATM cells */
#define UDSL_MAX_SND_BUF_SIZE 1024 /* ATM cells */
#define UDSL_DEFAULT_RCV_URBS 1
#define UDSL_DEFAULT_SND_URBS 1
#define UDSL_DEFAULT_RCV_BUFS 2
#define UDSL_DEFAULT_SND_BUFS 2
#define UDSL_DEFAULT_RCV_URBS 2
#define UDSL_DEFAULT_SND_URBS 2
#define UDSL_DEFAULT_RCV_BUFS 4
#define UDSL_DEFAULT_SND_BUFS 4
#define UDSL_DEFAULT_RCV_BUF_SIZE 64 /* ATM cells */
#define UDSL_DEFAULT_SND_BUF_SIZE 64 /* ATM cells */
......@@ -351,7 +358,7 @@ static void udsl_extract_cells (struct udsl_instance_data *instance, unsigned ch
dbg ("udsl_extract_cells: buffer overrun (max_pdu: %u, skb->len %u, vcc: 0x%p)", vcc_data->max_pdu, skb->len, vcc);
/* discard cells already received */
skb_trim (skb, 0);
BUG_ON (vcc_data->max_pdu < ATM_CELL_PAYLOAD);
DEBUG_ON (vcc_data->max_pdu < ATM_CELL_PAYLOAD);
}
memcpy (skb->tail, source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD);
......@@ -498,7 +505,7 @@ static unsigned int udsl_write_cells (unsigned int howmany, struct sk_buff *skb,
memset (target, 0, ATM_CELL_PAYLOAD - ATM_AAL5_TRAILER);
target += ATM_CELL_PAYLOAD - ATM_AAL5_TRAILER;
BUG_ON (--ctrl->num_cells);
DEBUG_ON (--ctrl->num_cells);
}
memcpy (target, ctrl->aal5_trailer, ATM_AAL5_TRAILER);
......@@ -535,7 +542,7 @@ static void udsl_complete_receive (struct urb *urb, struct pt_regs *regs)
vdbg ("udsl_complete_receive: urb 0x%p, status %d, actual_length %d, filled_cells %u, rcv 0x%p, buf 0x%p", urb, urb->status, urb->actual_length, buf->filled_cells, rcv, buf);
BUG_ON (buf->filled_cells > rcv_buf_size);
DEBUG_ON (buf->filled_cells > rcv_buf_size);
/* may not be in_interrupt() */
spin_lock_irqsave (&instance->receive_lock, flags);
......@@ -1216,8 +1223,7 @@ static void udsl_usb_disconnect (struct usb_interface *intf)
count = 0;
spin_lock_irq (&instance->receive_lock);
list_for_each (pos, &instance->spare_receivers)
if (++count > num_rcv_urbs)
panic (__FILE__ ": memory corruption detected at line %d!\n", __LINE__);
DEBUG_ON (++count > num_rcv_urbs);
spin_unlock_irq (&instance->receive_lock);
dbg ("udsl_usb_disconnect: found %u spare receivers", count);
......@@ -1253,8 +1259,7 @@ static void udsl_usb_disconnect (struct usb_interface *intf)
count = 0;
spin_lock_irq (&instance->send_lock);
list_for_each (pos, &instance->spare_senders)
if (++count > num_snd_urbs)
panic (__FILE__ ": memory corruption detected at line %d!\n", __LINE__);
DEBUG_ON (++count > num_snd_urbs);
spin_unlock_irq (&instance->send_lock);
dbg ("udsl_usb_disconnect: found %u spare senders", count);
......
......@@ -87,7 +87,7 @@ get_endpoints (struct usbtest_dev *dev, struct usb_interface *intf)
struct usb_host_endpoint *in, *out;
struct usb_device *udev;
for (tmp = 0; tmp < intf->max_altsetting; tmp++) {
for (tmp = 0; tmp < intf->num_altsetting; tmp++) {
unsigned ep;
in = out = 0;
......
......@@ -252,6 +252,8 @@ struct driver_info {
/* for new devices, use the descriptor-reading code instead */
int in; /* rx endpoint */
int out; /* tx endpoint */
unsigned long data; /* Misc driver specific data */
};
// we record the state for each of our queued skbs
......@@ -298,6 +300,9 @@ MODULE_PARM_DESC (msg_level, "Initial message level (default = 1)");
/*-------------------------------------------------------------------------*/
static struct ethtool_ops usbnet_ethtool_ops;
static void usbnet_get_drvinfo (struct net_device *, struct ethtool_drvinfo *);
/* mostly for PDA style devices, which are always connected if present */
static int always_connected (struct usbnet *dev)
{
......@@ -312,7 +317,7 @@ get_endpoints (struct usbnet *dev, struct usb_interface *intf)
struct usb_host_interface *alt;
struct usb_host_endpoint *in, *out;
for (tmp = 0; tmp < intf->max_altsetting; tmp++) {
for (tmp = 0; tmp < intf->num_altsetting; tmp++) {
unsigned ep;
in = out = 0;
......@@ -383,10 +388,10 @@ static const struct driver_info an2720_info = {
#ifdef CONFIG_USB_AX8817X
#define NEED_MII
/* ASIX AX8817X based USB 2.0 Ethernet Devices */
#define HAVE_HARDWARE
#define NEED_MII
#include <linux/crc32.h>
......@@ -394,6 +399,8 @@ static const struct driver_info an2720_info = {
#define AX_CMD_READ_MII_REG 0x07
#define AX_CMD_WRITE_MII_REG 0x08
#define AX_CMD_SET_HW_MII 0x0a
#define AX_CMD_READ_EEPROM 0x0b
#define AX_CMD_WRITE_EEPROM 0x0c
#define AX_CMD_WRITE_RX_CTL 0x10
#define AX_CMD_READ_IPG012 0x11
#define AX_CMD_WRITE_IPG0 0x12
......@@ -403,8 +410,15 @@ static const struct driver_info an2720_info = {
#define AX_CMD_READ_NODE_ID 0x17
#define AX_CMD_READ_PHY_ID 0x19
#define AX_CMD_WRITE_MEDIUM_MODE 0x1b
#define AX_CMD_READ_MONITOR_MODE 0x1c
#define AX_CMD_WRITE_MONITOR_MODE 0x1d
#define AX_CMD_WRITE_GPIOS 0x1f
#define AX_MONITOR_MODE 0x01
#define AX_MONITOR_LINK 0x02
#define AX_MONITOR_MAGIC 0x04
#define AX_MONITOR_HSFS 0x10
#define AX_MCAST_FILTER_SIZE 8
#define AX_MAX_MCAST 64
......@@ -496,17 +510,15 @@ static void ax8817x_set_multicast(struct net_device *net)
} else if (net->mc_count == 0) {
/* just broadcast and directed */
} else {
/* We use the 20 byte dev->data
* for our 8 byte filter buffer
* to avoid allocating memory that
* is tricky to free later */
u8 *multi_filter = (u8 *)dev->data;
struct dev_mc_list *mc_list = net->mc_list;
u8 *multi_filter;
u32 crc_bits;
int i;
multi_filter = kmalloc(AX_MCAST_FILTER_SIZE, GFP_ATOMIC);
if (multi_filter == NULL) {
/* Oops, couldn't allocate a buffer for setting the multicast
filter. Try all multi mode. */
rx_ctl |= 0x02;
} else {
memset(multi_filter, 0, AX_MCAST_FILTER_SIZE);
/* Build the multicast hash filter. */
......@@ -524,7 +536,6 @@ static void ax8817x_set_multicast(struct net_device *net)
rx_ctl |= 0x10;
}
}
ax8817x_write_cmd_async(dev, AX_CMD_WRITE_RX_CTL, rx_ctl, 0, 0, NULL);
}
......@@ -533,7 +544,7 @@ static int ax8817x_mdio_read(struct net_device *netdev, int phy_id, int loc)
{
struct usbnet *dev = netdev->priv;
u16 res;
u8 buf[4];
u8 buf[1];
ax8817x_write_cmd(dev, AX_CMD_SET_SW_MII, 0, 0, 0, &buf);
ax8817x_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id, (__u16)loc, 2, (u16 *)&res);
......@@ -546,23 +557,103 @@ static void ax8817x_mdio_write(struct net_device *netdev, int phy_id, int loc, i
{
struct usbnet *dev = netdev->priv;
u16 res = val;
u8 buf[4];
u8 buf[1];
ax8817x_write_cmd(dev, AX_CMD_SET_SW_MII, 0, 0, 0, &buf);
ax8817x_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, (__u16)loc, 2, (u16 *)&res);
ax8817x_write_cmd(dev, AX_CMD_SET_HW_MII, 0, 0, 0, &buf);
}
void ax8817x_get_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
{
struct usbnet *dev = (struct usbnet *)net->priv;
u8 opt;
if (ax8817x_read_cmd(dev, AX_CMD_READ_MONITOR_MODE, 0, 0, 1, &opt) < 0) {
wolinfo->supported = 0;
wolinfo->wolopts = 0;
return;
}
wolinfo->supported = WAKE_PHY | WAKE_MAGIC;
wolinfo->wolopts = 0;
if (opt & AX_MONITOR_MODE) {
if (opt & AX_MONITOR_LINK)
wolinfo->wolopts |= WAKE_PHY;
if (opt & AX_MONITOR_MAGIC)
wolinfo->wolopts |= WAKE_MAGIC;
}
}
int ax8817x_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
{
struct usbnet *dev = (struct usbnet *)net->priv;
u8 opt = 0;
u8 buf[1];
if (wolinfo->wolopts & WAKE_PHY)
opt |= AX_MONITOR_LINK;
if (wolinfo->wolopts & WAKE_MAGIC)
opt |= AX_MONITOR_MAGIC;
if (opt != 0)
opt |= AX_MONITOR_MODE;
if (ax8817x_write_cmd(dev, AX_CMD_WRITE_MONITOR_MODE,
opt, 0, 0, &buf) < 0)
return -EINVAL;
return 0;
}
int ax8817x_get_eeprom(struct net_device *net,
struct ethtool_eeprom *eeprom, u8 *data)
{
struct usbnet *dev = (struct usbnet *)net->priv;
u16 *ebuf = (u16 *)data;
int i;
/* Crude hack to ensure that we don't overwrite memory
* if an odd length is supplied
*/
if (eeprom->len % 2)
return -EINVAL;
/* ax8817x returns 2 bytes from eeprom on read */
for (i=0; i < eeprom->len / 2; i++) {
if (ax8817x_read_cmd(dev, AX_CMD_READ_EEPROM,
eeprom->offset + i, 0, 2, &ebuf[i]) < 0)
return -EINVAL;
}
return i * 2;
}
static void ax8817x_get_drvinfo (struct net_device *net,
struct ethtool_drvinfo *info)
{
/* Inherit standard device info */
usbnet_get_drvinfo(net, info);
info->eedump_len = 0x3e;
}
static int ax8817x_bind(struct usbnet *dev, struct usb_interface *intf)
{
int ret;
u8 buf[6];
u16 *buf16 = (u16 *) buf;
int i;
unsigned long gpio_bits = dev->driver_info->data;
dev->in = usb_rcvbulkpipe(dev->udev, 3);
dev->out = usb_sndbulkpipe(dev->udev, 2);
/* Toggle the GPIOs in a manufacturer/model specific way */
for (i = 2; i >= 0; i--) {
if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_GPIOS,
(gpio_bits >> (i * 8)) & 0xff, 0, 0,
buf)) < 0)
return ret;
wait_ms(5);
}
if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_RX_CTL, 0x80, 0, 0, buf)) < 0) {
dbg("send AX_CMD_WRITE_RX_CTL failed: %d", ret);
return ret;
......@@ -640,6 +731,11 @@ static int ax8817x_bind(struct usbnet *dev, struct usb_interface *intf)
dev->net->set_multicast_list = ax8817x_set_multicast;
usbnet_ethtool_ops.get_drvinfo = &ax8817x_get_drvinfo;
usbnet_ethtool_ops.get_wol = &ax8817x_get_wol;
usbnet_ethtool_ops.set_wol = &ax8817x_set_wol;
usbnet_ethtool_ops.get_eeprom = &ax8817x_get_eeprom;
return 0;
}
......@@ -647,7 +743,30 @@ static const struct driver_info ax8817x_info = {
.description = "ASIX AX8817x USB 2.0 Ethernet",
.bind = ax8817x_bind,
.flags = FLAG_ETHER,
.data = 0x00130103,
};
static const struct driver_info dlink_dub_e100_info = {
.description = "DLink DUB-E100 USB Ethernet",
.bind = ax8817x_bind,
.flags = FLAG_ETHER,
.data = 0x009f9d9f,
};
static const struct driver_info netgear_fa120_info = {
.description = "Netgear FA-120 USB Ethernet",
.bind = ax8817x_bind,
.flags = FLAG_ETHER,
.data = 0x00130103,
};
static const struct driver_info hawking_uf200_info = {
.description = "Hawking UF200 USB Ethernet",
.bind = ax8817x_bind,
.flags = FLAG_ETHER,
.data = 0x001f1d1f,
};
#endif /* CONFIG_USB_AX8817X */
......@@ -2415,72 +2534,45 @@ static int usbnet_open (struct net_device *net)
/*-------------------------------------------------------------------------*/
static inline int
usbnet_ethtool_ioctl (struct net_device *net, void __user *useraddr)
static void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info)
{
struct usbnet *dev = (struct usbnet *) net->priv;
u32 cmd;
if (get_user (cmd, (u32 *)useraddr))
return -EFAULT;
switch (cmd) {
case ETHTOOL_GDRVINFO: { /* get driver info */
struct ethtool_drvinfo info;
memset (&info, 0, sizeof info);
info.cmd = ETHTOOL_GDRVINFO;
strncpy (info.driver, driver_name, sizeof info.driver);
strncpy (info.version, DRIVER_VERSION, sizeof info.version);
strncpy (info.fw_version, dev->driver_info->description,
sizeof info.fw_version);
usb_make_path (dev->udev, info.bus_info, sizeof info.bus_info);
if (copy_to_user (useraddr, &info, sizeof (info)))
return -EFAULT;
return 0;
}
struct usbnet *dev = net->priv;
case ETHTOOL_GLINK: /* get link status */
if (dev->driver_info->check_connect) {
struct ethtool_value edata = { ETHTOOL_GLINK };
strncpy (info->driver, driver_name, sizeof info->driver);
strncpy (info->version, DRIVER_VERSION, sizeof info->version);
strncpy (info->fw_version, dev->driver_info->description,
sizeof info->fw_version);
usb_make_path (dev->udev, info->bus_info, sizeof info->bus_info);
}
edata.data = dev->driver_info->check_connect (dev) == 0;
if (copy_to_user (useraddr, &edata, sizeof (edata)))
return -EFAULT;
return 0;
}
break;
static u32 usbnet_get_link (struct net_device *net)
{
struct usbnet *dev = net->priv;
case ETHTOOL_GMSGLVL: { /* get message-level */
struct ethtool_value edata = {ETHTOOL_GMSGLVL};
/* If a check_connect is defined, return it's results */
if (dev->driver_info->check_connect)
return dev->driver_info->check_connect (dev) == 0;
edata.data = dev->msg_level;
if (copy_to_user (useraddr, &edata, sizeof (edata)))
return -EFAULT;
return 0;
}
/* Otherwise, we're up to avoid breaking scripts */
return 1;
}
case ETHTOOL_SMSGLVL: { /* set message-level */
struct ethtool_value edata;
static u32 usbnet_get_msglevel (struct net_device *net)
{
struct usbnet *dev = net->priv;
if (copy_from_user (&edata, useraddr, sizeof (edata)))
return -EFAULT;
dev->msg_level = edata.data;
return 0;
}
return dev->msg_level;
}
/* could also map RINGPARAM to RX/TX QLEN */
static void usbnet_set_msglevel (struct net_device *net, u32 level)
{
struct usbnet *dev = net->priv;
}
/* Note that the ethtool user space code requires EOPNOTSUPP */
return -EOPNOTSUPP;
dev->msg_level = level;
}
static int usbnet_ioctl (struct net_device *net, struct ifreq *rq, int cmd)
{
if (cmd == SIOCETHTOOL)
return usbnet_ethtool_ioctl (net, (void __user *)rq->ifr_data);
#ifdef NEED_MII
{
struct usbnet *dev = (struct usbnet *)net->priv;
......@@ -2889,6 +2981,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
net->watchdog_timeo = TX_TIMEOUT_JIFFIES;
net->tx_timeout = usbnet_tx_timeout;
net->do_ioctl = usbnet_ioctl;
net->ethtool_ops = &usbnet_ethtool_ops;
// allow device-specific bind/init procedures
// NOTE net->name still not usable ...
......@@ -2991,11 +3084,11 @@ static const struct usb_device_id products [] = {
}, {
// Netgear FA120
USB_DEVICE (0x0846, 0x1040),
.driver_info = (unsigned long) &ax8817x_info,
.driver_info = (unsigned long) &netgear_fa120_info,
}, {
// DLink DUB-E100
USB_DEVICE (0x2001, 0x1a00),
.driver_info = (unsigned long) &ax8817x_info,
.driver_info = (unsigned long) &dlink_dub_e100_info,
}, {
// Intellinet, ST Lab USB Ethernet
USB_DEVICE (0x0b95, 0x1720),
......@@ -3003,7 +3096,7 @@ static const struct usb_device_id products [] = {
}, {
// Hawking UF200, TrendNet TU2-ET100
USB_DEVICE (0x07b8, 0x420a),
.driver_info = (unsigned long) &ax8817x_info,
.driver_info = (unsigned long) &hawking_uf200_info,
},
#endif
......@@ -3167,6 +3260,14 @@ static struct usb_driver usbnet_driver = {
.disconnect = usbnet_disconnect,
};
/* Default ethtool_ops assigned. Devices can override in their bind() routine */
static struct ethtool_ops usbnet_ethtool_ops = {
.get_drvinfo = usbnet_get_drvinfo,
.get_link = usbnet_get_link,
.get_msglevel = usbnet_get_msglevel,
.set_msglevel = usbnet_set_msglevel,
};
/*-------------------------------------------------------------------------*/
static int __init usbnet_init (void)
......
......@@ -17,10 +17,8 @@ config USB_SERIAL
information on the specifics of the different devices that are
supported, and on how to use them.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called usbserial. If you want to compile it
as a module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called usbserial.
config USB_SERIAL_DEBUG
bool "USB Serial Converter verbose debug"
......@@ -70,10 +68,8 @@ config USB_SERIAL_BELKIN
adaptor (F5U103 is one of the model numbers) or the Peracom single
port USB to serial adapter.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called belkin_sa. If you want to compile it as
a module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called belkin_sa.
config USB_SERIAL_WHITEHEAT
tristate "USB ConnectTech WhiteHEAT Serial Driver"
......@@ -82,10 +78,8 @@ config USB_SERIAL_WHITEHEAT
Say Y here if you want to use a ConnectTech WhiteHEAT 4 port
USB to serial converter device.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called whiteheat. If you want to compile it as
a module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called whiteheat.
config USB_SERIAL_DIGI_ACCELEPORT
tristate "USB Digi International AccelePort USB Serial Driver"
......@@ -99,11 +93,8 @@ config USB_SERIAL_DIGI_ACCELEPORT
This driver works under SMP with the usb-uhci driver. It does not
work under SMP with the uhci driver.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called digi_acceleport. If you want to compile
it as a module, say M here and read
<file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called digi_acceleport.
config USB_SERIAL_EMPEG
tristate "USB Empeg empeg-car Mark I/II Driver"
......@@ -114,10 +105,8 @@ config USB_SERIAL_EMPEG
device node. See <file:Documentation/usb/usb-serial.txt> for more
tidbits of information.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called empeg. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called empeg.
config USB_SERIAL_FTDI_SIO
tristate "USB FTDI Single Port Serial Driver (EXPERIMENTAL)"
......@@ -130,10 +119,8 @@ config USB_SERIAL_FTDI_SIO
See <http://ftdi-usb-sio.sourceforge.net/> for more
information on this driver and the device.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called ftdi_sio. If you want to compile it as
a module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called ftdi_sio.
config USB_SERIAL_VISOR
tristate "USB Handspring Visor / Palm m50x / Sony Clie Driver"
......@@ -144,10 +131,8 @@ config USB_SERIAL_VISOR
<http://usbvisor.sourceforge.net/> for more information on using this
driver.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called visor. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called visor.
config USB_SERIAL_IPAQ
tristate "USB PocketPC PDA Driver"
......@@ -158,10 +143,8 @@ config USB_SERIAL_IPAQ
using a USB cradle/cable. For information on using the driver,
read <file:Documentation/usb/usb-serial.txt>.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called ipaq. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called ipaq.
config USB_SERIAL_IR
tristate "USB IR Dongle Serial Driver (EXPERIMENTAL)"
......@@ -171,10 +154,8 @@ config USB_SERIAL_IR
devices. This is useful if you do not want to use the full IrDA
stack.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called ir-usb. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called ir-usb.
config USB_SERIAL_EDGEPORT
tristate "USB Inside Out Edgeport Serial Driver"
......@@ -199,10 +180,8 @@ config USB_SERIAL_EDGEPORT
Edgeport/4 DIN
Edgeport/16 Dual
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called io_edgeport. If you want to compile it
as a module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called io_edgeport.
config USB_SERIAL_EDGEPORT_TI
tristate "USB Inside Out Edgeport Serial Driver (TI devices)"
......@@ -212,10 +191,8 @@ config USB_SERIAL_EDGEPORT_TI
Networks (Digi) that are not supported by the io_edgeport driver.
This includes the Edgeport/1 device.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called io_ti. If you want to compile it
as a module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called io_ti.
config USB_SERIAL_KEYSPAN_PDA
tristate "USB Keyspan PDA Single Port Serial Driver"
......@@ -225,10 +202,8 @@ config USB_SERIAL_KEYSPAN_PDA
serial converter device. This driver makes use of firmware
developed from scratch by Brian Warner.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called keyspan_pda. If you want to compile it
as a module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called keyspan_pda.
config USB_SERIAL_KEYSPAN
tristate "USB Keyspan USA-xxx Serial Driver"
......@@ -241,10 +216,8 @@ config USB_SERIAL_KEYSPAN
See <http://misc.nu/hugh/keyspan.html> for more information.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called keyspan. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called keyspan.
config USB_SERIAL_KEYSPAN_MPR
bool "USB Keyspan MPR Firmware"
......@@ -337,10 +310,8 @@ config USB_SERIAL_KLSI
Please read <file:Documentation/usb/usb-serial.txt> for more
information.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called kl5kusb105. If you want to compile it as
a module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called kl5kusb105.
config USB_SERIAL_KOBIL_SCT
tristate "USB KOBIL chipcard reader (EXPERIMENTAL)"
......@@ -357,10 +328,8 @@ config USB_SERIAL_KOBIL_SCT
- KAAN Professional
Note that you need a current CT-API.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called kobil_sct. If you want to compile it as
a module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called kobil_sct.
config USB_SERIAL_MCT_U232
tristate "USB MCT Single Port Serial Driver"
......@@ -372,10 +341,8 @@ config USB_SERIAL_MCT_U232
This driver also works with Sitecom U232-P25 and D-Link DU-H3SP USB
BAY devices.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called mct_u232. If you want to compile it as
a module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called mct_u232.
config USB_SERIAL_PL2303
tristate "USB Prolific 2303 Single Port Serial Driver"
......@@ -384,10 +351,8 @@ config USB_SERIAL_PL2303
Say Y here if you want to use the PL2303 USB Serial single port
adapter from Prolific.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called pl2303. If you want to compile it as
a module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called pl2303.
config USB_SERIAL_SAFE
tristate "USB Safe Serial (Encapsulated) Driver (EXPERIMENTAL)"
......@@ -405,10 +370,8 @@ config USB_SERIAL_CYBERJACK
reader. This is an interface to ISO 7816 compatible contactbased
chipcards, e.g. GSM SIMs.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called cyberjack. If you want to compile it as
a module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called cyberjack.
If unsure, say N.
......@@ -420,10 +383,8 @@ config USB_SERIAL_XIRCOM
serial converter device. This driver makes use of firmware
developed from scratch by Brian Warner.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called keyspan_pda. If you want to compile it
as a module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called keyspan_pda.
config USB_SERIAL_OMNINET
tristate "USB ZyXEL omni.net LCD Plus Driver (EXPERIMENTAL)"
......@@ -431,10 +392,8 @@ config USB_SERIAL_OMNINET
help
Say Y here if you want to use a ZyXEL omni.net LCD ISDN TA.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called omninet. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called omninet.
config USB_EZUSB
bool
......
......@@ -341,7 +341,7 @@ static void ipaq_read_bulk_callback(struct urb *urb, struct pt_regs *regs)
usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
tty = port->tty;
if (urb->actual_length) {
if (tty && urb->actual_length) {
for (i = 0; i < urb->actual_length ; ++i) {
/* if we insert more than TTY_FLIPBUF_SIZE characters, we drop them. */
if(tty->flip.count >= TTY_FLIPBUF_SIZE) {
......
......@@ -871,8 +871,10 @@ static void destroy_serial (struct kobject *kobj)
/* the ports are cleaned up and released in port_release() */
for (i = 0; i < serial->num_ports; ++i)
if (serial->port[i]->dev.parent != NULL)
if (serial->port[i]->dev.parent != NULL) {
device_unregister(&serial->port[i]->dev);
serial->port[i] = NULL;
}
/* If this is a "fake" port, we have to clean it up here, as it will
* not get cleaned up in port_release() as it was never registered with
......
......@@ -15,10 +15,8 @@ config USB_STORAGE
similar devices. This driver may also be used for some cameras and
card readers.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called usb-storage. If you want to compile it
as a module, say M here and read <file:Documentation/modules.txt>.
To compile this driver as a module, say M here: the
module will be called usb-storage.
config USB_STORAGE_DEBUG
bool "USB Mass Storage verbose debug"
......
......@@ -289,7 +289,7 @@ UNUSUAL_DEV( 0x054c, 0x006d, 0x0000, 0x9999,
UNUSUAL_DEV( 0x057b, 0x0000, 0x0000, 0x0299,
"Y-E Data",
"Flashbuster-U",
US_SC_UFI, US_PR_CB, NULL,
US_SC_DEVICE, US_PR_CB, NULL,
US_FL_SINGLE_LUN),
UNUSUAL_DEV( 0x057b, 0x0000, 0x0300, 0x9999,
......
......@@ -80,7 +80,6 @@ struct usb_host_interface {
* @act_altsetting: index of current altsetting. this number is always
* less than num_altsetting. after the device is configured, each
* interface uses its default setting of zero.
* @max_altsetting: the max number of altsettings for this interface.
* @driver: the USB driver that is bound to this interface.
* @minor: the minor number assigned to this interface, if this
* interface is bound to a driver that uses the USB major number.
......@@ -118,7 +117,6 @@ struct usb_interface {
unsigned act_altsetting; /* active alternate setting */
unsigned num_altsetting; /* number of alternate settings */
unsigned max_altsetting; /* total memory allocated */
struct usb_driver *driver; /* driver */
int minor; /* minor number this interface is bound to */
......
......@@ -72,9 +72,9 @@ struct usb_request {
unsigned length;
dma_addr_t dma;
unsigned no_interrupt : 1,
zero : 1,
short_not_ok : 1;
unsigned no_interrupt:1;
unsigned zero:1;
unsigned short_not_ok:1;
void (*complete)(struct usb_ep *ep,
struct usb_request *req);
......@@ -122,9 +122,11 @@ struct usb_ep_ops {
/**
* struct usb_ep - device side representation of USB endpoint
* @name:identifier for the endpoint, such as "ep-a" or "ep9in-bulk"
* @ops: Function pointers used to access hardware-specific operations.
* @ep_list:the gadget's ep_list holds all of its endpoints
* @maxpacket:the maximum packet size used on this endpoint, as
* configured when the endpoint was enabled.
* @maxpacket:The maximum packet size used on this endpoint. The initial
* value can sometimes be reduced (hardware allowing), according to
* the endpoint descriptor used to configure the endpoint.
* @driver_data:for use by the gadget driver. all other fields are
* read-only to gadget drivers.
*
......@@ -138,7 +140,7 @@ struct usb_ep {
const char *name;
const struct usb_ep_ops *ops;
struct list_head ep_list;
unsigned maxpacket : 16;
unsigned maxpacket:16;
};
/*-------------------------------------------------------------------------*/
......@@ -443,18 +445,21 @@ struct usb_gadget_ops {
/**
* struct usb_gadget - represents a usb slave device
* @ops: Function pointers used to access hardware-specific operations.
* @ep0: Endpoint zero, used when reading or writing responses to
* driver setup() requests
* @ep_list: List of other endpoints supported by the device.
* @speed: Speed of current connection to USB host.
* @name: Identifies the controller hardware type. Used in diagnostics
* and sometimes configuration.
* @dev: Driver model state for this abstract device.
*
* Gadgets have a mostly-portable "gadget driver" implementing device
* functions, handling all usb configurations and interfaces. They
* also have a hardware-specific driver (accessed through ops vectors),
* which insulates the gadget driver from hardware details and packages
* the hardware endpoints through generic i/o queues.
* functions, handling all usb configurations and interfaces. Gadget
* drivers talk to hardware-specific code indirectly, through ops vectors.
* That insulates the gadget driver from hardware details, and packages
* the hardware endpoints through generic i/o queues. The "usb_gadget"
* and "usb_ep" interfaces provide that insulation from the hardware.
*
* Except for the driver data, all fields in this structure are
* read-only to the gadget driver. That driver data is part of the
......@@ -469,10 +474,6 @@ struct usb_gadget {
struct list_head ep_list; /* of usb_ep */
enum usb_device_speed speed;
const char *name;
/* use this to allocate dma-coherent buffers or set up
* dma mappings. or print diagnostics, etc.
*/
struct device dev;
};
......@@ -576,6 +577,7 @@ usb_gadget_clear_selfpowered (struct usb_gadget *gadget)
* Called in a context that permits sleeping.
* @suspend: Invoked on USB suspend. May be called in_interrupt.
* @resume: Invoked on USB resume. May be called in_interrupt.
* @driver: Driver model state for this driver.
*
* Devices are disabled till a gadget driver successfully bind()s, which
* means the driver will handle setup() requests needed to enumerate (and
......
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