Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6: (70 commits) USB: remove duplicate device id from zc0301 USB: remove duplicate device id from usb_storage USB: remove duplicate device id from keyspan USB: remove duplicate device id from ftdi_sio USB: remove duplicate device id from visor USB: a bit more coding style cleanup usbcore: trivial whitespace fixes usb-storage: use first bulk endpoints, not last EHCI: fix interrupt-driven remote wakeup USB: switch ehci-hcd to new polling scheme USB: autosuspend for usb printer driver USB Input: Added kernel module to support all GTCO CalComp USB InterWrite School products USB: Sierra Wireless auto set D0 USB: usb ethernet gadget recognizes HUSB2DEV USB: list atmel husb2_udc gadget controller USB: gadgetfs AIO tweaks USB: gadgetfs behaves better on userspace init bug USB: gadgetfs race fix USB: gadgetfs simplifications USB: gadgetfs cleanups ...
This commit is contained in:
@ -33,19 +33,6 @@ config USB_DEVICEFS
|
||||
|
||||
Most users want to say Y here.
|
||||
|
||||
config USB_BANDWIDTH
|
||||
bool "Enforce USB bandwidth allocation (EXPERIMENTAL)"
|
||||
depends on USB && EXPERIMENTAL
|
||||
help
|
||||
If you say Y here, the USB subsystem enforces USB bandwidth
|
||||
allocation and will prevent some device opens from succeeding
|
||||
if they would cause USB bandwidth usage to go above 90% of
|
||||
the bus bandwidth.
|
||||
|
||||
If you say N here, these conditions will cause warning messages
|
||||
about USB bandwidth usage to be logged and some devices or
|
||||
drivers may not work correctly.
|
||||
|
||||
config USB_DYNAMIC_MINORS
|
||||
bool "Dynamic USB minor allocation (EXPERIMENTAL)"
|
||||
depends on USB && EXPERIMENTAL
|
||||
|
@ -49,9 +49,9 @@ static const size_t pool_max [HCD_BUFFER_POOLS] = {
|
||||
*
|
||||
* Call hcd_buffer_destroy() to clean up after using those pools.
|
||||
*/
|
||||
int hcd_buffer_create (struct usb_hcd *hcd)
|
||||
int hcd_buffer_create(struct usb_hcd *hcd)
|
||||
{
|
||||
char name [16];
|
||||
char name[16];
|
||||
int i, size;
|
||||
|
||||
if (!hcd->self.controller->dma_mask)
|
||||
@ -60,11 +60,11 @@ int hcd_buffer_create (struct usb_hcd *hcd)
|
||||
for (i = 0; i < HCD_BUFFER_POOLS; i++) {
|
||||
if (!(size = pool_max [i]))
|
||||
continue;
|
||||
snprintf (name, sizeof name, "buffer-%d", size);
|
||||
hcd->pool [i] = dma_pool_create (name, hcd->self.controller,
|
||||
snprintf(name, sizeof name, "buffer-%d", size);
|
||||
hcd->pool[i] = dma_pool_create(name, hcd->self.controller,
|
||||
size, size, 0);
|
||||
if (!hcd->pool [i]) {
|
||||
hcd_buffer_destroy (hcd);
|
||||
hcd_buffer_destroy(hcd);
|
||||
return -ENOMEM;
|
||||
}
|
||||
}
|
||||
@ -79,14 +79,14 @@ int hcd_buffer_create (struct usb_hcd *hcd)
|
||||
*
|
||||
* This frees the buffer pools created by hcd_buffer_create().
|
||||
*/
|
||||
void hcd_buffer_destroy (struct usb_hcd *hcd)
|
||||
void hcd_buffer_destroy(struct usb_hcd *hcd)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < HCD_BUFFER_POOLS; i++) {
|
||||
struct dma_pool *pool = hcd->pool [i];
|
||||
struct dma_pool *pool = hcd->pool[i];
|
||||
if (pool) {
|
||||
dma_pool_destroy (pool);
|
||||
dma_pool_destroy(pool);
|
||||
hcd->pool[i] = NULL;
|
||||
}
|
||||
}
|
||||
@ -97,8 +97,8 @@ void hcd_buffer_destroy (struct usb_hcd *hcd)
|
||||
* better sharing and to leverage mm/slab.c intelligence.
|
||||
*/
|
||||
|
||||
void *hcd_buffer_alloc (
|
||||
struct usb_bus *bus,
|
||||
void *hcd_buffer_alloc(
|
||||
struct usb_bus *bus,
|
||||
size_t size,
|
||||
gfp_t mem_flags,
|
||||
dma_addr_t *dma
|
||||
@ -110,18 +110,18 @@ void *hcd_buffer_alloc (
|
||||
/* some USB hosts just use PIO */
|
||||
if (!bus->controller->dma_mask) {
|
||||
*dma = ~(dma_addr_t) 0;
|
||||
return kmalloc (size, mem_flags);
|
||||
return kmalloc(size, mem_flags);
|
||||
}
|
||||
|
||||
for (i = 0; i < HCD_BUFFER_POOLS; i++) {
|
||||
if (size <= pool_max [i])
|
||||
return dma_pool_alloc (hcd->pool [i], mem_flags, dma);
|
||||
return dma_pool_alloc(hcd->pool [i], mem_flags, dma);
|
||||
}
|
||||
return dma_alloc_coherent (hcd->self.controller, size, dma, 0);
|
||||
return dma_alloc_coherent(hcd->self.controller, size, dma, 0);
|
||||
}
|
||||
|
||||
void hcd_buffer_free (
|
||||
struct usb_bus *bus,
|
||||
void hcd_buffer_free(
|
||||
struct usb_bus *bus,
|
||||
size_t size,
|
||||
void *addr,
|
||||
dma_addr_t dma
|
||||
@ -134,15 +134,15 @@ void hcd_buffer_free (
|
||||
return;
|
||||
|
||||
if (!bus->controller->dma_mask) {
|
||||
kfree (addr);
|
||||
kfree(addr);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < HCD_BUFFER_POOLS; i++) {
|
||||
if (size <= pool_max [i]) {
|
||||
dma_pool_free (hcd->pool [i], addr, dma);
|
||||
dma_pool_free(hcd->pool [i], addr, dma);
|
||||
return;
|
||||
}
|
||||
}
|
||||
dma_free_coherent (hcd->self.controller, size, addr, dma);
|
||||
dma_free_coherent(hcd->self.controller, size, addr, dma);
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ static const char *format_config =
|
||||
|
||||
static const char *format_iface =
|
||||
/* I: If#=dd Alt=dd #EPs=dd Cls=xx(sssss) Sub=xx Prot=xx Driver=xxxx*/
|
||||
"I: If#=%2d Alt=%2d #EPs=%2d Cls=%02x(%-5s) Sub=%02x Prot=%02x Driver=%s\n";
|
||||
"I:%c If#=%2d Alt=%2d #EPs=%2d Cls=%02x(%-5s) Sub=%02x Prot=%02x Driver=%s\n";
|
||||
|
||||
static const char *format_endpt =
|
||||
/* E: Ad=xx(s) Atr=xx(ssss) MxPS=dddd Ivl=D?s */
|
||||
@ -164,10 +164,10 @@ static const char *class_decode(const int class)
|
||||
for (ix = 0; clas_info[ix].class != -1; ix++)
|
||||
if (clas_info[ix].class == class)
|
||||
break;
|
||||
return (clas_info[ix].class_name);
|
||||
return clas_info[ix].class_name;
|
||||
}
|
||||
|
||||
static char *usb_dump_endpoint_descriptor (
|
||||
static char *usb_dump_endpoint_descriptor(
|
||||
int speed,
|
||||
char *start,
|
||||
char *end,
|
||||
@ -212,9 +212,9 @@ static char *usb_dump_endpoint_descriptor (
|
||||
break;
|
||||
case USB_ENDPOINT_XFER_INT:
|
||||
type = "Int.";
|
||||
if (speed == USB_SPEED_HIGH) {
|
||||
if (speed == USB_SPEED_HIGH)
|
||||
interval = 1 << (desc->bInterval - 1);
|
||||
} else
|
||||
else
|
||||
interval = desc->bInterval;
|
||||
break;
|
||||
default: /* "can't happen" */
|
||||
@ -242,15 +242,19 @@ static char *usb_dump_interface_descriptor(char *start, char *end,
|
||||
{
|
||||
const struct usb_interface_descriptor *desc = &intfc->altsetting[setno].desc;
|
||||
const char *driver_name = "";
|
||||
int active = 0;
|
||||
|
||||
if (start > end)
|
||||
return start;
|
||||
down_read(&usb_bus_type.subsys.rwsem);
|
||||
if (iface)
|
||||
if (iface) {
|
||||
driver_name = (iface->dev.driver
|
||||
? iface->dev.driver->name
|
||||
: "(none)");
|
||||
active = (desc == &iface->cur_altsetting->desc);
|
||||
}
|
||||
start += sprintf(start, format_iface,
|
||||
active ? '*' : ' ', /* mark active altsetting */
|
||||
desc->bInterfaceNumber,
|
||||
desc->bAlternateSetting,
|
||||
desc->bNumEndpoints,
|
||||
@ -343,7 +347,7 @@ static char *usb_dump_device_descriptor(char *start, char *end, const struct usb
|
||||
|
||||
if (start > end)
|
||||
return start;
|
||||
start += sprintf (start, format_device1,
|
||||
start += sprintf(start, format_device1,
|
||||
bcdUSB >> 8, bcdUSB & 0xff,
|
||||
desc->bDeviceClass,
|
||||
class_decode (desc->bDeviceClass),
|
||||
@ -363,7 +367,7 @@ static char *usb_dump_device_descriptor(char *start, char *end, const struct usb
|
||||
/*
|
||||
* Dump the different strings that this device holds.
|
||||
*/
|
||||
static char *usb_dump_device_strings (char *start, char *end, struct usb_device *dev)
|
||||
static char *usb_dump_device_strings(char *start, char *end, struct usb_device *dev)
|
||||
{
|
||||
if (start > end)
|
||||
return start;
|
||||
@ -395,7 +399,7 @@ static char *usb_dump_desc(char *start, char *end, struct usb_device *dev)
|
||||
if (start > end)
|
||||
return start;
|
||||
|
||||
start = usb_dump_device_strings (start, end, dev);
|
||||
start = usb_dump_device_strings(start, end, dev);
|
||||
|
||||
for (i = 0; i < dev->descriptor.bNumConfigurations; i++) {
|
||||
if (start > end)
|
||||
|
@ -522,19 +522,19 @@ static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype, unsig
|
||||
|
||||
static struct usb_device *usbdev_lookup_minor(int minor)
|
||||
{
|
||||
struct class_device *class_dev;
|
||||
struct usb_device *dev = NULL;
|
||||
struct device *device;
|
||||
struct usb_device *udev = NULL;
|
||||
|
||||
down(&usb_device_class->sem);
|
||||
list_for_each_entry(class_dev, &usb_device_class->children, node) {
|
||||
if (class_dev->devt == MKDEV(USB_DEVICE_MAJOR, minor)) {
|
||||
dev = class_dev->class_data;
|
||||
list_for_each_entry(device, &usb_device_class->devices, node) {
|
||||
if (device->devt == MKDEV(USB_DEVICE_MAJOR, minor)) {
|
||||
udev = device->platform_data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
up(&usb_device_class->sem);
|
||||
|
||||
return dev;
|
||||
return udev;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -570,6 +570,7 @@ static int usbdev_open(struct inode *inode, struct file *file)
|
||||
ps->dev = dev;
|
||||
ps->file = file;
|
||||
spin_lock_init(&ps->lock);
|
||||
INIT_LIST_HEAD(&ps->list);
|
||||
INIT_LIST_HEAD(&ps->async_pending);
|
||||
INIT_LIST_HEAD(&ps->async_completed);
|
||||
init_waitqueue_head(&ps->wait);
|
||||
@ -1596,19 +1597,19 @@ static int usbdev_add(struct usb_device *dev)
|
||||
{
|
||||
int minor = ((dev->bus->busnum-1) * 128) + (dev->devnum-1);
|
||||
|
||||
dev->class_dev = class_device_create(usb_device_class, NULL,
|
||||
MKDEV(USB_DEVICE_MAJOR, minor), &dev->dev,
|
||||
dev->usbfs_dev = device_create(usb_device_class, &dev->dev,
|
||||
MKDEV(USB_DEVICE_MAJOR, minor),
|
||||
"usbdev%d.%d", dev->bus->busnum, dev->devnum);
|
||||
if (IS_ERR(dev->class_dev))
|
||||
return PTR_ERR(dev->class_dev);
|
||||
if (IS_ERR(dev->usbfs_dev))
|
||||
return PTR_ERR(dev->usbfs_dev);
|
||||
|
||||
dev->class_dev->class_data = dev;
|
||||
dev->usbfs_dev->platform_data = dev;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void usbdev_remove(struct usb_device *dev)
|
||||
{
|
||||
class_device_unregister(dev->class_dev);
|
||||
device_unregister(dev->usbfs_dev);
|
||||
}
|
||||
|
||||
static int usbdev_notify(struct notifier_block *self, unsigned long action,
|
||||
|
@ -28,24 +28,16 @@
|
||||
#include "hcd.h"
|
||||
#include "usb.h"
|
||||
|
||||
static int usb_match_one_id(struct usb_interface *interface,
|
||||
const struct usb_device_id *id);
|
||||
|
||||
struct usb_dynid {
|
||||
struct list_head node;
|
||||
struct usb_device_id id;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_HOTPLUG
|
||||
|
||||
/*
|
||||
* Adds a new dynamic USBdevice ID to this driver,
|
||||
* and cause the driver to probe for all devices again.
|
||||
*/
|
||||
static ssize_t store_new_id(struct device_driver *driver,
|
||||
const char *buf, size_t count)
|
||||
ssize_t usb_store_new_id(struct usb_dynids *dynids,
|
||||
struct device_driver *driver,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct usb_driver *usb_drv = to_usb_driver(driver);
|
||||
struct usb_dynid *dynid;
|
||||
u32 idVendor = 0;
|
||||
u32 idProduct = 0;
|
||||
@ -65,9 +57,9 @@ static ssize_t store_new_id(struct device_driver *driver,
|
||||
dynid->id.idProduct = idProduct;
|
||||
dynid->id.match_flags = USB_DEVICE_ID_MATCH_DEVICE;
|
||||
|
||||
spin_lock(&usb_drv->dynids.lock);
|
||||
list_add_tail(&usb_drv->dynids.list, &dynid->node);
|
||||
spin_unlock(&usb_drv->dynids.lock);
|
||||
spin_lock(&dynids->lock);
|
||||
list_add_tail(&dynids->list, &dynid->node);
|
||||
spin_unlock(&dynids->lock);
|
||||
|
||||
if (get_driver(driver)) {
|
||||
retval = driver_attach(driver);
|
||||
@ -78,6 +70,15 @@ static ssize_t store_new_id(struct device_driver *driver,
|
||||
return retval;
|
||||
return count;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(usb_store_new_id);
|
||||
|
||||
static ssize_t store_new_id(struct device_driver *driver,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct usb_driver *usb_drv = to_usb_driver(driver);
|
||||
|
||||
return usb_store_new_id(&usb_drv->dynids, driver, buf, count);
|
||||
}
|
||||
static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id);
|
||||
|
||||
static int usb_create_newid_file(struct usb_driver *usb_drv)
|
||||
@ -365,8 +366,8 @@ void usb_driver_release_interface(struct usb_driver *driver,
|
||||
EXPORT_SYMBOL(usb_driver_release_interface);
|
||||
|
||||
/* returns 0 if no match, 1 if match */
|
||||
static int usb_match_one_id(struct usb_interface *interface,
|
||||
const struct usb_device_id *id)
|
||||
int usb_match_one_id(struct usb_interface *interface,
|
||||
const struct usb_device_id *id)
|
||||
{
|
||||
struct usb_host_interface *intf;
|
||||
struct usb_device *dev;
|
||||
@ -432,6 +433,8 @@ static int usb_match_one_id(struct usb_interface *interface,
|
||||
|
||||
return 1;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(usb_match_one_id);
|
||||
|
||||
/**
|
||||
* usb_match_id - find first usb_device_id matching device or interface
|
||||
* @interface: the interface of interest
|
||||
|
@ -194,14 +194,13 @@ int usb_register_dev(struct usb_interface *intf,
|
||||
++temp;
|
||||
else
|
||||
temp = name;
|
||||
intf->class_dev = class_device_create(usb_class->class, NULL,
|
||||
MKDEV(USB_MAJOR, minor),
|
||||
&intf->dev, "%s", temp);
|
||||
if (IS_ERR(intf->class_dev)) {
|
||||
intf->usb_dev = device_create(usb_class->class, &intf->dev,
|
||||
MKDEV(USB_MAJOR, minor), "%s", temp);
|
||||
if (IS_ERR(intf->usb_dev)) {
|
||||
spin_lock (&minor_lock);
|
||||
usb_minors[intf->minor] = NULL;
|
||||
spin_unlock (&minor_lock);
|
||||
retval = PTR_ERR(intf->class_dev);
|
||||
retval = PTR_ERR(intf->usb_dev);
|
||||
}
|
||||
exit:
|
||||
return retval;
|
||||
@ -242,8 +241,8 @@ void usb_deregister_dev(struct usb_interface *intf,
|
||||
spin_unlock (&minor_lock);
|
||||
|
||||
snprintf(name, BUS_ID_SIZE, class_driver->name, intf->minor - minor_base);
|
||||
class_device_destroy(usb_class->class, MKDEV(USB_MAJOR, intf->minor));
|
||||
intf->class_dev = NULL;
|
||||
device_destroy(usb_class->class, MKDEV(USB_MAJOR, intf->minor));
|
||||
intf->usb_dev = NULL;
|
||||
intf->minor = -1;
|
||||
destroy_usb_class();
|
||||
}
|
||||
|
@ -25,6 +25,20 @@ static inline const char *plural(int n)
|
||||
return (n == 1 ? "" : "s");
|
||||
}
|
||||
|
||||
static int is_rndis(struct usb_interface_descriptor *desc)
|
||||
{
|
||||
return desc->bInterfaceClass == USB_CLASS_COMM
|
||||
&& desc->bInterfaceSubClass == 2
|
||||
&& desc->bInterfaceProtocol == 0xff;
|
||||
}
|
||||
|
||||
static int is_activesync(struct usb_interface_descriptor *desc)
|
||||
{
|
||||
return desc->bInterfaceClass == USB_CLASS_MISC
|
||||
&& desc->bInterfaceSubClass == 1
|
||||
&& desc->bInterfaceProtocol == 1;
|
||||
}
|
||||
|
||||
static int choose_configuration(struct usb_device *udev)
|
||||
{
|
||||
int i;
|
||||
@ -87,14 +101,12 @@ static int choose_configuration(struct usb_device *udev)
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If the first config's first interface is COMM/2/0xff
|
||||
* (MSFT RNDIS), rule it out unless Linux has host-side
|
||||
* RNDIS support. */
|
||||
if (i == 0 && desc
|
||||
&& desc->bInterfaceClass == USB_CLASS_COMM
|
||||
&& desc->bInterfaceSubClass == 2
|
||||
&& desc->bInterfaceProtocol == 0xff) {
|
||||
#ifndef CONFIG_USB_NET_RNDIS_HOST
|
||||
/* When the first config's first interface is one of Microsoft's
|
||||
* pet nonstandard Ethernet-over-USB protocols, ignore it unless
|
||||
* this kernel has enabled the necessary host side driver.
|
||||
*/
|
||||
if (i == 0 && desc && (is_rndis(desc) || is_activesync(desc))) {
|
||||
#if !defined(CONFIG_USB_NET_RNDIS_HOST) && !defined(CONFIG_USB_NET_RNDIS_HOST_MODULE)
|
||||
continue;
|
||||
#else
|
||||
best = c;
|
||||
|
@ -45,8 +45,6 @@
|
||||
#include "hub.h"
|
||||
|
||||
|
||||
// #define USB_BANDWIDTH_MESSAGES
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
@ -891,136 +889,6 @@ long usb_calc_bus_time (int speed, int is_input, int isoc, int bytecount)
|
||||
}
|
||||
EXPORT_SYMBOL (usb_calc_bus_time);
|
||||
|
||||
/*
|
||||
* usb_check_bandwidth():
|
||||
*
|
||||
* old_alloc is from host_controller->bandwidth_allocated in microseconds;
|
||||
* bustime is from calc_bus_time(), but converted to microseconds.
|
||||
*
|
||||
* returns <bustime in us> if successful,
|
||||
* or -ENOSPC if bandwidth request fails.
|
||||
*
|
||||
* FIXME:
|
||||
* This initial implementation does not use Endpoint.bInterval
|
||||
* in managing bandwidth allocation.
|
||||
* It probably needs to be expanded to use Endpoint.bInterval.
|
||||
* This can be done as a later enhancement (correction).
|
||||
*
|
||||
* This will also probably require some kind of
|
||||
* frame allocation tracking...meaning, for example,
|
||||
* that if multiple drivers request interrupts every 10 USB frames,
|
||||
* they don't all have to be allocated at
|
||||
* frame numbers N, N+10, N+20, etc. Some of them could be at
|
||||
* N+11, N+21, N+31, etc., and others at
|
||||
* N+12, N+22, N+32, etc.
|
||||
*
|
||||
* Similarly for isochronous transfers...
|
||||
*
|
||||
* Individual HCDs can schedule more directly ... this logic
|
||||
* is not correct for high speed transfers.
|
||||
*/
|
||||
int usb_check_bandwidth (struct usb_device *dev, struct urb *urb)
|
||||
{
|
||||
unsigned int pipe = urb->pipe;
|
||||
long bustime;
|
||||
int is_in = usb_pipein (pipe);
|
||||
int is_iso = usb_pipeisoc (pipe);
|
||||
int old_alloc = dev->bus->bandwidth_allocated;
|
||||
int new_alloc;
|
||||
|
||||
|
||||
bustime = NS_TO_US (usb_calc_bus_time (dev->speed, is_in, is_iso,
|
||||
usb_maxpacket (dev, pipe, !is_in)));
|
||||
if (is_iso)
|
||||
bustime /= urb->number_of_packets;
|
||||
|
||||
new_alloc = old_alloc + (int) bustime;
|
||||
if (new_alloc > FRAME_TIME_MAX_USECS_ALLOC) {
|
||||
#ifdef DEBUG
|
||||
char *mode =
|
||||
#ifdef CONFIG_USB_BANDWIDTH
|
||||
"";
|
||||
#else
|
||||
"would have ";
|
||||
#endif
|
||||
dev_dbg (&dev->dev, "usb_check_bandwidth %sFAILED: %d + %ld = %d usec\n",
|
||||
mode, old_alloc, bustime, new_alloc);
|
||||
#endif
|
||||
#ifdef CONFIG_USB_BANDWIDTH
|
||||
bustime = -ENOSPC; /* report error */
|
||||
#endif
|
||||
}
|
||||
|
||||
return bustime;
|
||||
}
|
||||
EXPORT_SYMBOL (usb_check_bandwidth);
|
||||
|
||||
|
||||
/**
|
||||
* usb_claim_bandwidth - records bandwidth for a periodic transfer
|
||||
* @dev: source/target of request
|
||||
* @urb: request (urb->dev == dev)
|
||||
* @bustime: bandwidth consumed, in (average) microseconds per frame
|
||||
* @isoc: true iff the request is isochronous
|
||||
*
|
||||
* Bus bandwidth reservations are recorded purely for diagnostic purposes.
|
||||
* HCDs are expected not to overcommit periodic bandwidth, and to record such
|
||||
* reservations whenever endpoints are added to the periodic schedule.
|
||||
*
|
||||
* FIXME averaging per-frame is suboptimal. Better to sum over the HCD's
|
||||
* entire periodic schedule ... 32 frames for OHCI, 1024 for UHCI, settable
|
||||
* for EHCI (256/512/1024 frames, default 1024) and have the bus expose how
|
||||
* large its periodic schedule is.
|
||||
*/
|
||||
void usb_claim_bandwidth (struct usb_device *dev, struct urb *urb, int bustime, int isoc)
|
||||
{
|
||||
dev->bus->bandwidth_allocated += bustime;
|
||||
if (isoc)
|
||||
dev->bus->bandwidth_isoc_reqs++;
|
||||
else
|
||||
dev->bus->bandwidth_int_reqs++;
|
||||
urb->bandwidth = bustime;
|
||||
|
||||
#ifdef USB_BANDWIDTH_MESSAGES
|
||||
dev_dbg (&dev->dev, "bandwidth alloc increased by %d (%s) to %d for %d requesters\n",
|
||||
bustime,
|
||||
isoc ? "ISOC" : "INTR",
|
||||
dev->bus->bandwidth_allocated,
|
||||
dev->bus->bandwidth_int_reqs + dev->bus->bandwidth_isoc_reqs);
|
||||
#endif
|
||||
}
|
||||
EXPORT_SYMBOL (usb_claim_bandwidth);
|
||||
|
||||
|
||||
/**
|
||||
* usb_release_bandwidth - reverses effect of usb_claim_bandwidth()
|
||||
* @dev: source/target of request
|
||||
* @urb: request (urb->dev == dev)
|
||||
* @isoc: true iff the request is isochronous
|
||||
*
|
||||
* This records that previously allocated bandwidth has been released.
|
||||
* Bandwidth is released when endpoints are removed from the host controller's
|
||||
* periodic schedule.
|
||||
*/
|
||||
void usb_release_bandwidth (struct usb_device *dev, struct urb *urb, int isoc)
|
||||
{
|
||||
dev->bus->bandwidth_allocated -= urb->bandwidth;
|
||||
if (isoc)
|
||||
dev->bus->bandwidth_isoc_reqs--;
|
||||
else
|
||||
dev->bus->bandwidth_int_reqs--;
|
||||
|
||||
#ifdef USB_BANDWIDTH_MESSAGES
|
||||
dev_dbg (&dev->dev, "bandwidth alloc reduced by %d (%s) to %d for %d requesters\n",
|
||||
urb->bandwidth,
|
||||
isoc ? "ISOC" : "INTR",
|
||||
dev->bus->bandwidth_allocated,
|
||||
dev->bus->bandwidth_int_reqs + dev->bus->bandwidth_isoc_reqs);
|
||||
#endif
|
||||
urb->bandwidth = 0;
|
||||
}
|
||||
EXPORT_SYMBOL (usb_release_bandwidth);
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
@ -1034,11 +902,6 @@ static void urb_unlink (struct urb *urb)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
/* Release any periodic transfer bandwidth */
|
||||
if (urb->bandwidth)
|
||||
usb_release_bandwidth (urb->dev, urb,
|
||||
usb_pipeisoc (urb->pipe));
|
||||
|
||||
/* clear all state linking urb to this dev (and hcd) */
|
||||
|
||||
spin_lock_irqsave (&hcd_data_lock, flags);
|
||||
|
@ -308,10 +308,6 @@ extern void usb_destroy_configuration(struct usb_device *dev);
|
||||
#define NS_TO_US(ns) ((ns + 500L) / 1000L)
|
||||
/* convert & round nanoseconds to microseconds */
|
||||
|
||||
extern void usb_claim_bandwidth (struct usb_device *dev, struct urb *urb,
|
||||
int bustime, int isoc);
|
||||
extern void usb_release_bandwidth (struct usb_device *dev, struct urb *urb,
|
||||
int isoc);
|
||||
|
||||
/*
|
||||
* Full/low speed bandwidth allocation constants/support.
|
||||
@ -324,8 +320,6 @@ extern void usb_release_bandwidth (struct usb_device *dev, struct urb *urb,
|
||||
#define FRAME_TIME_MAX_BITS_ALLOC (90L * FRAME_TIME_BITS / 100L)
|
||||
#define FRAME_TIME_MAX_USECS_ALLOC (90L * FRAME_TIME_USECS / 100L)
|
||||
|
||||
extern int usb_check_bandwidth (struct usb_device *dev, struct urb *urb);
|
||||
|
||||
/*
|
||||
* Ceiling [nano/micro]seconds (typical) for that many bytes at high speed
|
||||
* ISO is a bit less, no ACK ... from USB 2.0 spec, 5.11.3 (and needed
|
||||
|
@ -87,9 +87,6 @@ static DECLARE_WAIT_QUEUE_HEAD(khubd_wait);
|
||||
|
||||
static struct task_struct *khubd_task;
|
||||
|
||||
/* multithreaded probe logic */
|
||||
static int multithread_probe = 0;
|
||||
|
||||
/* cycle leds on hubs that aren't blinking for attention */
|
||||
static int blinkenlights = 0;
|
||||
module_param (blinkenlights, bool, S_IRUGO);
|
||||
@ -1256,9 +1253,28 @@ static inline void show_string(struct usb_device *udev, char *id, char *string)
|
||||
static int __usb_port_suspend(struct usb_device *, int port1);
|
||||
#endif
|
||||
|
||||
static int __usb_new_device(void *void_data)
|
||||
/**
|
||||
* usb_new_device - perform initial device setup (usbcore-internal)
|
||||
* @udev: newly addressed device (in ADDRESS state)
|
||||
*
|
||||
* This is called with devices which have been enumerated, but not yet
|
||||
* configured. The device descriptor is available, but not descriptors
|
||||
* for any device configuration. The caller must have locked either
|
||||
* the parent hub (if udev is a normal device) or else the
|
||||
* usb_bus_list_lock (if udev is a root hub). The parent's pointer to
|
||||
* udev has already been installed, but udev is not yet visible through
|
||||
* sysfs or other filesystem code.
|
||||
*
|
||||
* It will return if the device is configured properly or not. Zero if
|
||||
* the interface was registered with the driver core; else a negative
|
||||
* errno value.
|
||||
*
|
||||
* This call is synchronous, and may not be used in an interrupt context.
|
||||
*
|
||||
* Only the hub driver or root-hub registrar should ever call this.
|
||||
*/
|
||||
int usb_new_device(struct usb_device *udev)
|
||||
{
|
||||
struct usb_device *udev = void_data;
|
||||
int err;
|
||||
|
||||
/* Lock ourself into memory in order to keep a probe sequence
|
||||
@ -1375,44 +1391,6 @@ fail:
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* usb_new_device - perform initial device setup (usbcore-internal)
|
||||
* @udev: newly addressed device (in ADDRESS state)
|
||||
*
|
||||
* This is called with devices which have been enumerated, but not yet
|
||||
* configured. The device descriptor is available, but not descriptors
|
||||
* for any device configuration. The caller must have locked either
|
||||
* the parent hub (if udev is a normal device) or else the
|
||||
* usb_bus_list_lock (if udev is a root hub). The parent's pointer to
|
||||
* udev has already been installed, but udev is not yet visible through
|
||||
* sysfs or other filesystem code.
|
||||
*
|
||||
* The return value for this function depends on if the
|
||||
* multithread_probe variable is set or not. If it's set, it will
|
||||
* return a if the probe thread was successfully created or not. If the
|
||||
* variable is not set, it will return if the device is configured
|
||||
* properly or not. interfaces, in sysfs); else a negative errno value.
|
||||
*
|
||||
* This call is synchronous, and may not be used in an interrupt context.
|
||||
*
|
||||
* Only the hub driver or root-hub registrar should ever call this.
|
||||
*/
|
||||
int usb_new_device(struct usb_device *udev)
|
||||
{
|
||||
struct task_struct *probe_task;
|
||||
int ret = 0;
|
||||
|
||||
if (multithread_probe) {
|
||||
probe_task = kthread_run(__usb_new_device, udev,
|
||||
"usb-probe-%s", udev->devnum);
|
||||
if (IS_ERR(probe_task))
|
||||
ret = PTR_ERR(probe_task);
|
||||
} else
|
||||
ret = __usb_new_device(udev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int hub_port_status(struct usb_hub *hub, int port1,
|
||||
u16 *status, u16 *change)
|
||||
{
|
||||
|
@ -1545,11 +1545,7 @@ int usb_driver_set_configuration(struct usb_device *udev, int config)
|
||||
INIT_WORK(&req->work, driver_set_config_work);
|
||||
|
||||
usb_get_dev(udev);
|
||||
if (!schedule_work(&req->work)) {
|
||||
usb_put_dev(udev);
|
||||
kfree(req);
|
||||
return -EINVAL;
|
||||
}
|
||||
schedule_work(&req->work);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(usb_driver_set_configuration);
|
||||
|
@ -16,16 +16,16 @@
|
||||
|
||||
/* Active configuration fields */
|
||||
#define usb_actconfig_show(field, multiplier, format_string) \
|
||||
static ssize_t show_##field (struct device *dev, \
|
||||
static ssize_t show_##field(struct device *dev, \
|
||||
struct device_attribute *attr, char *buf) \
|
||||
{ \
|
||||
struct usb_device *udev; \
|
||||
struct usb_host_config *actconfig; \
|
||||
\
|
||||
udev = to_usb_device (dev); \
|
||||
udev = to_usb_device(dev); \
|
||||
actconfig = udev->actconfig; \
|
||||
if (actconfig) \
|
||||
return sprintf (buf, format_string, \
|
||||
return sprintf(buf, format_string, \
|
||||
actconfig->desc.field * multiplier); \
|
||||
else \
|
||||
return 0; \
|
||||
@ -35,9 +35,9 @@ static ssize_t show_##field (struct device *dev, \
|
||||
usb_actconfig_show(field, multiplier, format_string) \
|
||||
static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL);
|
||||
|
||||
usb_actconfig_attr (bNumInterfaces, 1, "%2d\n")
|
||||
usb_actconfig_attr (bmAttributes, 1, "%2x\n")
|
||||
usb_actconfig_attr (bMaxPower, 2, "%3dmA\n")
|
||||
usb_actconfig_attr(bNumInterfaces, 1, "%2d\n")
|
||||
usb_actconfig_attr(bmAttributes, 1, "%2x\n")
|
||||
usb_actconfig_attr(bMaxPower, 2, "%3dmA\n")
|
||||
|
||||
static ssize_t show_configuration_string(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
@ -45,7 +45,7 @@ static ssize_t show_configuration_string(struct device *dev,
|
||||
struct usb_device *udev;
|
||||
struct usb_host_config *actconfig;
|
||||
|
||||
udev = to_usb_device (dev);
|
||||
udev = to_usb_device(dev);
|
||||
actconfig = udev->actconfig;
|
||||
if ((!actconfig) || (!actconfig->string))
|
||||
return 0;
|
||||
@ -57,16 +57,16 @@ static DEVICE_ATTR(configuration, S_IRUGO, show_configuration_string, NULL);
|
||||
usb_actconfig_show(bConfigurationValue, 1, "%u\n");
|
||||
|
||||
static ssize_t
|
||||
set_bConfigurationValue (struct device *dev, struct device_attribute *attr,
|
||||
set_bConfigurationValue(struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct usb_device *udev = to_usb_device (dev);
|
||||
struct usb_device *udev = to_usb_device(dev);
|
||||
int config, value;
|
||||
|
||||
if (sscanf (buf, "%u", &config) != 1 || config > 255)
|
||||
if (sscanf(buf, "%u", &config) != 1 || config > 255)
|
||||
return -EINVAL;
|
||||
usb_lock_device(udev);
|
||||
value = usb_set_configuration (udev, config);
|
||||
value = usb_set_configuration(udev, config);
|
||||
usb_unlock_device(udev);
|
||||
return (value < 0) ? value : count;
|
||||
}
|
||||
@ -81,7 +81,7 @@ static ssize_t show_##name(struct device *dev, \
|
||||
{ \
|
||||
struct usb_device *udev; \
|
||||
\
|
||||
udev = to_usb_device (dev); \
|
||||
udev = to_usb_device(dev); \
|
||||
return sprintf(buf, "%s\n", udev->name); \
|
||||
} \
|
||||
static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL);
|
||||
@ -91,12 +91,12 @@ usb_string_attr(manufacturer);
|
||||
usb_string_attr(serial);
|
||||
|
||||
static ssize_t
|
||||
show_speed (struct device *dev, struct device_attribute *attr, char *buf)
|
||||
show_speed(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct usb_device *udev;
|
||||
char *speed;
|
||||
|
||||
udev = to_usb_device (dev);
|
||||
udev = to_usb_device(dev);
|
||||
|
||||
switch (udev->speed) {
|
||||
case USB_SPEED_LOW:
|
||||
@ -112,22 +112,22 @@ show_speed (struct device *dev, struct device_attribute *attr, char *buf)
|
||||
default:
|
||||
speed = "unknown";
|
||||
}
|
||||
return sprintf (buf, "%s\n", speed);
|
||||
return sprintf(buf, "%s\n", speed);
|
||||
}
|
||||
static DEVICE_ATTR(speed, S_IRUGO, show_speed, NULL);
|
||||
|
||||
static ssize_t
|
||||
show_devnum (struct device *dev, struct device_attribute *attr, char *buf)
|
||||
show_devnum(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct usb_device *udev;
|
||||
|
||||
udev = to_usb_device (dev);
|
||||
return sprintf (buf, "%d\n", udev->devnum);
|
||||
udev = to_usb_device(dev);
|
||||
return sprintf(buf, "%d\n", udev->devnum);
|
||||
}
|
||||
static DEVICE_ATTR(devnum, S_IRUGO, show_devnum, NULL);
|
||||
|
||||
static ssize_t
|
||||
show_version (struct device *dev, struct device_attribute *attr, char *buf)
|
||||
show_version(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct usb_device *udev;
|
||||
u16 bcdUSB;
|
||||
@ -139,25 +139,25 @@ show_version (struct device *dev, struct device_attribute *attr, char *buf)
|
||||
static DEVICE_ATTR(version, S_IRUGO, show_version, NULL);
|
||||
|
||||
static ssize_t
|
||||
show_maxchild (struct device *dev, struct device_attribute *attr, char *buf)
|
||||
show_maxchild(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct usb_device *udev;
|
||||
|
||||
udev = to_usb_device (dev);
|
||||
return sprintf (buf, "%d\n", udev->maxchild);
|
||||
udev = to_usb_device(dev);
|
||||
return sprintf(buf, "%d\n", udev->maxchild);
|
||||
}
|
||||
static DEVICE_ATTR(maxchild, S_IRUGO, show_maxchild, NULL);
|
||||
|
||||
/* Descriptor fields */
|
||||
#define usb_descriptor_attr_le16(field, format_string) \
|
||||
static ssize_t \
|
||||
show_##field (struct device *dev, struct device_attribute *attr, \
|
||||
show_##field(struct device *dev, struct device_attribute *attr, \
|
||||
char *buf) \
|
||||
{ \
|
||||
struct usb_device *udev; \
|
||||
\
|
||||
udev = to_usb_device (dev); \
|
||||
return sprintf (buf, format_string, \
|
||||
udev = to_usb_device(dev); \
|
||||
return sprintf(buf, format_string, \
|
||||
le16_to_cpu(udev->descriptor.field)); \
|
||||
} \
|
||||
static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL);
|
||||
@ -168,21 +168,21 @@ usb_descriptor_attr_le16(bcdDevice, "%04x\n")
|
||||
|
||||
#define usb_descriptor_attr(field, format_string) \
|
||||
static ssize_t \
|
||||
show_##field (struct device *dev, struct device_attribute *attr, \
|
||||
show_##field(struct device *dev, struct device_attribute *attr, \
|
||||
char *buf) \
|
||||
{ \
|
||||
struct usb_device *udev; \
|
||||
\
|
||||
udev = to_usb_device (dev); \
|
||||
return sprintf (buf, format_string, udev->descriptor.field); \
|
||||
udev = to_usb_device(dev); \
|
||||
return sprintf(buf, format_string, udev->descriptor.field); \
|
||||
} \
|
||||
static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL);
|
||||
|
||||
usb_descriptor_attr (bDeviceClass, "%02x\n")
|
||||
usb_descriptor_attr (bDeviceSubClass, "%02x\n")
|
||||
usb_descriptor_attr (bDeviceProtocol, "%02x\n")
|
||||
usb_descriptor_attr (bNumConfigurations, "%d\n")
|
||||
usb_descriptor_attr (bMaxPacketSize0, "%d\n")
|
||||
usb_descriptor_attr(bDeviceClass, "%02x\n")
|
||||
usb_descriptor_attr(bDeviceSubClass, "%02x\n")
|
||||
usb_descriptor_attr(bDeviceProtocol, "%02x\n")
|
||||
usb_descriptor_attr(bNumConfigurations, "%d\n")
|
||||
usb_descriptor_attr(bMaxPacketSize0, "%d\n")
|
||||
|
||||
static struct attribute *dev_attrs[] = {
|
||||
/* current configuration's attributes */
|
||||
@ -220,17 +220,17 @@ int usb_create_sysfs_dev_files(struct usb_device *udev)
|
||||
return retval;
|
||||
|
||||
if (udev->manufacturer) {
|
||||
retval = device_create_file (dev, &dev_attr_manufacturer);
|
||||
retval = device_create_file(dev, &dev_attr_manufacturer);
|
||||
if (retval)
|
||||
goto error;
|
||||
}
|
||||
if (udev->product) {
|
||||
retval = device_create_file (dev, &dev_attr_product);
|
||||
retval = device_create_file(dev, &dev_attr_product);
|
||||
if (retval)
|
||||
goto error;
|
||||
}
|
||||
if (udev->serial) {
|
||||
retval = device_create_file (dev, &dev_attr_serial);
|
||||
retval = device_create_file(dev, &dev_attr_serial);
|
||||
if (retval)
|
||||
goto error;
|
||||
}
|
||||
@ -246,7 +246,7 @@ error:
|
||||
return retval;
|
||||
}
|
||||
|
||||
void usb_remove_sysfs_dev_files (struct usb_device *udev)
|
||||
void usb_remove_sysfs_dev_files(struct usb_device *udev)
|
||||
{
|
||||
struct device *dev = &udev->dev;
|
||||
|
||||
@ -264,22 +264,22 @@ void usb_remove_sysfs_dev_files (struct usb_device *udev)
|
||||
/* Interface fields */
|
||||
#define usb_intf_attr(field, format_string) \
|
||||
static ssize_t \
|
||||
show_##field (struct device *dev, struct device_attribute *attr, \
|
||||
show_##field(struct device *dev, struct device_attribute *attr, \
|
||||
char *buf) \
|
||||
{ \
|
||||
struct usb_interface *intf = to_usb_interface (dev); \
|
||||
struct usb_interface *intf = to_usb_interface(dev); \
|
||||
\
|
||||
return sprintf (buf, format_string, \
|
||||
return sprintf(buf, format_string, \
|
||||
intf->cur_altsetting->desc.field); \
|
||||
} \
|
||||
static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL);
|
||||
|
||||
usb_intf_attr (bInterfaceNumber, "%02x\n")
|
||||
usb_intf_attr (bAlternateSetting, "%2d\n")
|
||||
usb_intf_attr (bNumEndpoints, "%02x\n")
|
||||
usb_intf_attr (bInterfaceClass, "%02x\n")
|
||||
usb_intf_attr (bInterfaceSubClass, "%02x\n")
|
||||
usb_intf_attr (bInterfaceProtocol, "%02x\n")
|
||||
usb_intf_attr(bInterfaceNumber, "%02x\n")
|
||||
usb_intf_attr(bAlternateSetting, "%2d\n")
|
||||
usb_intf_attr(bNumEndpoints, "%02x\n")
|
||||
usb_intf_attr(bInterfaceClass, "%02x\n")
|
||||
usb_intf_attr(bInterfaceSubClass, "%02x\n")
|
||||
usb_intf_attr(bInterfaceProtocol, "%02x\n")
|
||||
|
||||
static ssize_t show_interface_string(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
@ -288,8 +288,8 @@ static ssize_t show_interface_string(struct device *dev,
|
||||
struct usb_device *udev;
|
||||
int len;
|
||||
|
||||
intf = to_usb_interface (dev);
|
||||
udev = interface_to_usbdev (intf);
|
||||
intf = to_usb_interface(dev);
|
||||
udev = interface_to_usbdev(intf);
|
||||
len = snprintf(buf, 256, "%s", intf->cur_altsetting->string);
|
||||
if (len < 0)
|
||||
return 0;
|
||||
@ -384,7 +384,7 @@ error:
|
||||
return retval;
|
||||
}
|
||||
|
||||
void usb_remove_sysfs_intf_files (struct usb_interface *intf)
|
||||
void usb_remove_sysfs_intf_files(struct usb_interface *intf)
|
||||
{
|
||||
usb_remove_intf_ep_files(intf);
|
||||
sysfs_remove_group(&intf->dev.kobj, &intf_attr_grp);
|
||||
|
@ -235,16 +235,15 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
|
||||
|
||||
urb->status = -EINPROGRESS;
|
||||
urb->actual_length = 0;
|
||||
urb->bandwidth = 0;
|
||||
|
||||
/* Lots of sanity checks, so HCDs can rely on clean data
|
||||
* and don't need to duplicate tests
|
||||
*/
|
||||
pipe = urb->pipe;
|
||||
temp = usb_pipetype (pipe);
|
||||
is_out = usb_pipeout (pipe);
|
||||
temp = usb_pipetype(pipe);
|
||||
is_out = usb_pipeout(pipe);
|
||||
|
||||
if (!usb_pipecontrol (pipe) && dev->state < USB_STATE_CONFIGURED)
|
||||
if (!usb_pipecontrol(pipe) && dev->state < USB_STATE_CONFIGURED)
|
||||
return -ENODEV;
|
||||
|
||||
/* FIXME there should be a sharable lock protecting us against
|
||||
@ -253,11 +252,11 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
|
||||
* checks get made.)
|
||||
*/
|
||||
|
||||
max = usb_maxpacket (dev, pipe, is_out);
|
||||
max = usb_maxpacket(dev, pipe, is_out);
|
||||
if (max <= 0) {
|
||||
dev_dbg(&dev->dev,
|
||||
"bogus endpoint ep%d%s in %s (bad maxpacket %d)\n",
|
||||
usb_pipeendpoint (pipe), is_out ? "out" : "in",
|
||||
usb_pipeendpoint(pipe), is_out ? "out" : "in",
|
||||
__FUNCTION__, max);
|
||||
return -EMSGSIZE;
|
||||
}
|
||||
@ -279,11 +278,11 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
|
||||
if (urb->number_of_packets <= 0)
|
||||
return -EINVAL;
|
||||
for (n = 0; n < urb->number_of_packets; n++) {
|
||||
len = urb->iso_frame_desc [n].length;
|
||||
len = urb->iso_frame_desc[n].length;
|
||||
if (len < 0 || len > max)
|
||||
return -EMSGSIZE;
|
||||
urb->iso_frame_desc [n].status = -EXDEV;
|
||||
urb->iso_frame_desc [n].actual_length = 0;
|
||||
urb->iso_frame_desc[n].status = -EXDEV;
|
||||
urb->iso_frame_desc[n].actual_length = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -322,7 +321,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
|
||||
|
||||
/* fail if submitter gave bogus flags */
|
||||
if (urb->transfer_flags != orig_flags) {
|
||||
err ("BOGUS urb flags, %x --> %x",
|
||||
err("BOGUS urb flags, %x --> %x",
|
||||
orig_flags, urb->transfer_flags);
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -373,7 +372,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
|
||||
urb->interval = temp;
|
||||
}
|
||||
|
||||
return usb_hcd_submit_urb (urb, mem_flags);
|
||||
return usb_hcd_submit_urb(urb, mem_flags);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------*/
|
||||
|
@ -233,7 +233,7 @@ static void usb_autosuspend_work(struct work_struct *work)
|
||||
* @parent: hub to which device is connected; null to allocate a root hub
|
||||
* @bus: bus used to access the device
|
||||
* @port1: one-based index of port; ignored for root hubs
|
||||
* Context: !in_interrupt ()
|
||||
* Context: !in_interrupt()
|
||||
*
|
||||
* Only hub drivers (including virtual root hub drivers for host
|
||||
* controllers) should ever call this.
|
||||
@ -277,22 +277,22 @@ usb_alloc_dev(struct usb_device *parent, struct usb_bus *bus, unsigned port1)
|
||||
* as stable: bus->busnum changes easily from modprobe order,
|
||||
* cardbus or pci hotplugging, and so on.
|
||||
*/
|
||||
if (unlikely (!parent)) {
|
||||
dev->devpath [0] = '0';
|
||||
if (unlikely(!parent)) {
|
||||
dev->devpath[0] = '0';
|
||||
|
||||
dev->dev.parent = bus->controller;
|
||||
sprintf (&dev->dev.bus_id[0], "usb%d", bus->busnum);
|
||||
sprintf(&dev->dev.bus_id[0], "usb%d", bus->busnum);
|
||||
} else {
|
||||
/* match any labeling on the hubs; it's one-based */
|
||||
if (parent->devpath [0] == '0')
|
||||
snprintf (dev->devpath, sizeof dev->devpath,
|
||||
if (parent->devpath[0] == '0')
|
||||
snprintf(dev->devpath, sizeof dev->devpath,
|
||||
"%d", port1);
|
||||
else
|
||||
snprintf (dev->devpath, sizeof dev->devpath,
|
||||
snprintf(dev->devpath, sizeof dev->devpath,
|
||||
"%s.%d", parent->devpath, port1);
|
||||
|
||||
dev->dev.parent = &parent->dev;
|
||||
sprintf (&dev->dev.bus_id[0], "%d-%s",
|
||||
sprintf(&dev->dev.bus_id[0], "%d-%s",
|
||||
bus->busnum, dev->devpath);
|
||||
|
||||
/* hub driver sets up TT records */
|
||||
@ -463,7 +463,7 @@ static struct usb_device *match_device(struct usb_device *dev,
|
||||
/* see if this device matches */
|
||||
if ((vendor_id == le16_to_cpu(dev->descriptor.idVendor)) &&
|
||||
(product_id == le16_to_cpu(dev->descriptor.idProduct))) {
|
||||
dev_dbg (&dev->dev, "matched this device!\n");
|
||||
dev_dbg(&dev->dev, "matched this device!\n");
|
||||
ret_dev = usb_get_dev(dev);
|
||||
goto exit;
|
||||
}
|
||||
@ -535,7 +535,7 @@ exit:
|
||||
*/
|
||||
int usb_get_current_frame_number(struct usb_device *dev)
|
||||
{
|
||||
return usb_hcd_get_frame_number (dev);
|
||||
return usb_hcd_get_frame_number(dev);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------*/
|
||||
@ -593,7 +593,7 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size,
|
||||
*
|
||||
* When the buffer is no longer used, free it with usb_buffer_free().
|
||||
*/
|
||||
void *usb_buffer_alloc (
|
||||
void *usb_buffer_alloc(
|
||||
struct usb_device *dev,
|
||||
size_t size,
|
||||
gfp_t mem_flags,
|
||||
@ -602,7 +602,7 @@ void *usb_buffer_alloc (
|
||||
{
|
||||
if (!dev || !dev->bus)
|
||||
return NULL;
|
||||
return hcd_buffer_alloc (dev->bus, size, mem_flags, dma);
|
||||
return hcd_buffer_alloc(dev->bus, size, mem_flags, dma);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -616,7 +616,7 @@ void *usb_buffer_alloc (
|
||||
* been allocated using usb_buffer_alloc(), and the parameters must match
|
||||
* those provided in that allocation request.
|
||||
*/
|
||||
void usb_buffer_free (
|
||||
void usb_buffer_free(
|
||||
struct usb_device *dev,
|
||||
size_t size,
|
||||
void *addr,
|
||||
@ -627,7 +627,7 @@ void usb_buffer_free (
|
||||
return;
|
||||
if (!addr)
|
||||
return;
|
||||
hcd_buffer_free (dev->bus, size, addr, dma);
|
||||
hcd_buffer_free(dev->bus, size, addr, dma);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -647,7 +647,7 @@ void usb_buffer_free (
|
||||
* Reverse the effect of this call with usb_buffer_unmap().
|
||||
*/
|
||||
#if 0
|
||||
struct urb *usb_buffer_map (struct urb *urb)
|
||||
struct urb *usb_buffer_map(struct urb *urb)
|
||||
{
|
||||
struct usb_bus *bus;
|
||||
struct device *controller;
|
||||
@ -659,14 +659,14 @@ struct urb *usb_buffer_map (struct urb *urb)
|
||||
return NULL;
|
||||
|
||||
if (controller->dma_mask) {
|
||||
urb->transfer_dma = dma_map_single (controller,
|
||||
urb->transfer_dma = dma_map_single(controller,
|
||||
urb->transfer_buffer, urb->transfer_buffer_length,
|
||||
usb_pipein (urb->pipe)
|
||||
usb_pipein(urb->pipe)
|
||||
? DMA_FROM_DEVICE : DMA_TO_DEVICE);
|
||||
if (usb_pipecontrol (urb->pipe))
|
||||
urb->setup_dma = dma_map_single (controller,
|
||||
if (usb_pipecontrol(urb->pipe))
|
||||
urb->setup_dma = dma_map_single(controller,
|
||||
urb->setup_packet,
|
||||
sizeof (struct usb_ctrlrequest),
|
||||
sizeof(struct usb_ctrlrequest),
|
||||
DMA_TO_DEVICE);
|
||||
// FIXME generic api broken like pci, can't report errors
|
||||
// if (urb->transfer_dma == DMA_ADDR_INVALID) return 0;
|
||||
@ -689,7 +689,7 @@ struct urb *usb_buffer_map (struct urb *urb)
|
||||
* usb_buffer_dmasync - synchronize DMA and CPU view of buffer(s)
|
||||
* @urb: urb whose transfer_buffer/setup_packet will be synchronized
|
||||
*/
|
||||
void usb_buffer_dmasync (struct urb *urb)
|
||||
void usb_buffer_dmasync(struct urb *urb)
|
||||
{
|
||||
struct usb_bus *bus;
|
||||
struct device *controller;
|
||||
@ -702,14 +702,14 @@ void usb_buffer_dmasync (struct urb *urb)
|
||||
return;
|
||||
|
||||
if (controller->dma_mask) {
|
||||
dma_sync_single (controller,
|
||||
dma_sync_single(controller,
|
||||
urb->transfer_dma, urb->transfer_buffer_length,
|
||||
usb_pipein (urb->pipe)
|
||||
usb_pipein(urb->pipe)
|
||||
? DMA_FROM_DEVICE : DMA_TO_DEVICE);
|
||||
if (usb_pipecontrol (urb->pipe))
|
||||
dma_sync_single (controller,
|
||||
if (usb_pipecontrol(urb->pipe))
|
||||
dma_sync_single(controller,
|
||||
urb->setup_dma,
|
||||
sizeof (struct usb_ctrlrequest),
|
||||
sizeof(struct usb_ctrlrequest),
|
||||
DMA_TO_DEVICE);
|
||||
}
|
||||
}
|
||||
@ -722,7 +722,7 @@ void usb_buffer_dmasync (struct urb *urb)
|
||||
* Reverses the effect of usb_buffer_map().
|
||||
*/
|
||||
#if 0
|
||||
void usb_buffer_unmap (struct urb *urb)
|
||||
void usb_buffer_unmap(struct urb *urb)
|
||||
{
|
||||
struct usb_bus *bus;
|
||||
struct device *controller;
|
||||
@ -735,14 +735,14 @@ void usb_buffer_unmap (struct urb *urb)
|
||||
return;
|
||||
|
||||
if (controller->dma_mask) {
|
||||
dma_unmap_single (controller,
|
||||
dma_unmap_single(controller,
|
||||
urb->transfer_dma, urb->transfer_buffer_length,
|
||||
usb_pipein (urb->pipe)
|
||||
usb_pipein(urb->pipe)
|
||||
? DMA_FROM_DEVICE : DMA_TO_DEVICE);
|
||||
if (usb_pipecontrol (urb->pipe))
|
||||
dma_unmap_single (controller,
|
||||
if (usb_pipecontrol(urb->pipe))
|
||||
dma_unmap_single(controller,
|
||||
urb->setup_dma,
|
||||
sizeof (struct usb_ctrlrequest),
|
||||
sizeof(struct usb_ctrlrequest),
|
||||
DMA_TO_DEVICE);
|
||||
}
|
||||
urb->transfer_flags &= ~(URB_NO_TRANSFER_DMA_MAP
|
||||
@ -783,15 +783,15 @@ int usb_buffer_map_sg(const struct usb_device *dev, unsigned pipe,
|
||||
struct device *controller;
|
||||
|
||||
if (!dev
|
||||
|| usb_pipecontrol (pipe)
|
||||
|| usb_pipecontrol(pipe)
|
||||
|| !(bus = dev->bus)
|
||||
|| !(controller = bus->controller)
|
||||
|| !controller->dma_mask)
|
||||
return -1;
|
||||
|
||||
// FIXME generic api broken like pci, can't report errors
|
||||
return dma_map_sg (controller, sg, nents,
|
||||
usb_pipein (pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE);
|
||||
return dma_map_sg(controller, sg, nents,
|
||||
usb_pipein(pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE);
|
||||
}
|
||||
|
||||
/* XXX DISABLED, no users currently. If you wish to re-enable this
|
||||
@ -823,8 +823,8 @@ void usb_buffer_dmasync_sg(const struct usb_device *dev, unsigned pipe,
|
||||
|| !controller->dma_mask)
|
||||
return;
|
||||
|
||||
dma_sync_sg (controller, sg, n_hw_ents,
|
||||
usb_pipein (pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE);
|
||||
dma_sync_sg(controller, sg, n_hw_ents,
|
||||
usb_pipein(pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -849,8 +849,8 @@ void usb_buffer_unmap_sg(const struct usb_device *dev, unsigned pipe,
|
||||
|| !controller->dma_mask)
|
||||
return;
|
||||
|
||||
dma_unmap_sg (controller, sg, n_hw_ents,
|
||||
usb_pipein (pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE);
|
||||
dma_unmap_sg(controller, sg, n_hw_ents,
|
||||
usb_pipein(pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE);
|
||||
}
|
||||
|
||||
/* format to disable USB on kernel command line is: nousb */
|
||||
@ -871,7 +871,7 @@ static int __init usb_init(void)
|
||||
{
|
||||
int retval;
|
||||
if (nousb) {
|
||||
pr_info ("%s: USB support disabled\n", usbcore_name);
|
||||
pr_info("%s: USB support disabled\n", usbcore_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -971,19 +971,19 @@ EXPORT_SYMBOL(__usb_get_extra_descriptor);
|
||||
EXPORT_SYMBOL(usb_find_device);
|
||||
EXPORT_SYMBOL(usb_get_current_frame_number);
|
||||
|
||||
EXPORT_SYMBOL (usb_buffer_alloc);
|
||||
EXPORT_SYMBOL (usb_buffer_free);
|
||||
EXPORT_SYMBOL(usb_buffer_alloc);
|
||||
EXPORT_SYMBOL(usb_buffer_free);
|
||||
|
||||
#if 0
|
||||
EXPORT_SYMBOL (usb_buffer_map);
|
||||
EXPORT_SYMBOL (usb_buffer_dmasync);
|
||||
EXPORT_SYMBOL (usb_buffer_unmap);
|
||||
EXPORT_SYMBOL(usb_buffer_map);
|
||||
EXPORT_SYMBOL(usb_buffer_dmasync);
|
||||
EXPORT_SYMBOL(usb_buffer_unmap);
|
||||
#endif
|
||||
|
||||
EXPORT_SYMBOL (usb_buffer_map_sg);
|
||||
EXPORT_SYMBOL(usb_buffer_map_sg);
|
||||
#if 0
|
||||
EXPORT_SYMBOL (usb_buffer_dmasync_sg);
|
||||
EXPORT_SYMBOL(usb_buffer_dmasync_sg);
|
||||
#endif
|
||||
EXPORT_SYMBOL (usb_buffer_unmap_sg);
|
||||
EXPORT_SYMBOL(usb_buffer_unmap_sg);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
Reference in New Issue
Block a user