提交 2c044a48 编写于 作者: G Greg Kroah-Hartman

USB: fix codingstyle issues in drivers/usb/core/*.c

Fixes a number of coding style issues in the remaining .c files in
drivers/usb/core/
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 3e35bf39
...@@ -57,8 +57,9 @@ int hcd_buffer_create(struct usb_hcd *hcd) ...@@ -57,8 +57,9 @@ int hcd_buffer_create(struct usb_hcd *hcd)
!(hcd->driver->flags & HCD_LOCAL_MEM)) !(hcd->driver->flags & HCD_LOCAL_MEM))
return 0; return 0;
for (i = 0; i < HCD_BUFFER_POOLS; i++) { for (i = 0; i < HCD_BUFFER_POOLS; i++) {
if (!(size = pool_max [i])) size = pool_max[i];
if (!size)
continue; continue;
snprintf(name, sizeof name, "buffer-%d", size); snprintf(name, sizeof name, "buffer-%d", size);
hcd->pool[i] = dma_pool_create(name, hcd->self.controller, hcd->pool[i] = dma_pool_create(name, hcd->self.controller,
...@@ -81,10 +82,10 @@ int hcd_buffer_create(struct usb_hcd *hcd) ...@@ -81,10 +82,10 @@ int hcd_buffer_create(struct usb_hcd *hcd)
*/ */
void hcd_buffer_destroy(struct usb_hcd *hcd) void hcd_buffer_destroy(struct usb_hcd *hcd)
{ {
int i; int i;
for (i = 0; i < HCD_BUFFER_POOLS; 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) { if (pool) {
dma_pool_destroy(pool); dma_pool_destroy(pool);
hcd->pool[i] = NULL; hcd->pool[i] = NULL;
......
...@@ -238,7 +238,7 @@ static int usb_parse_interface(struct device *ddev, int cfgno, ...@@ -238,7 +238,7 @@ static int usb_parse_interface(struct device *ddev, int cfgno,
/* Allocate space for the right(?) number of endpoints */ /* Allocate space for the right(?) number of endpoints */
num_ep = num_ep_orig = alt->desc.bNumEndpoints; num_ep = num_ep_orig = alt->desc.bNumEndpoints;
alt->desc.bNumEndpoints = 0; // Use as a counter alt->desc.bNumEndpoints = 0; /* Use as a counter */
if (num_ep > USB_MAXENDPOINTS) { if (num_ep > USB_MAXENDPOINTS) {
dev_warn(ddev, "too many endpoints for config %d interface %d " dev_warn(ddev, "too many endpoints for config %d interface %d "
"altsetting %d: %d, using maximum allowed: %d\n", "altsetting %d: %d, using maximum allowed: %d\n",
...@@ -246,7 +246,8 @@ static int usb_parse_interface(struct device *ddev, int cfgno, ...@@ -246,7 +246,8 @@ static int usb_parse_interface(struct device *ddev, int cfgno,
num_ep = USB_MAXENDPOINTS; num_ep = USB_MAXENDPOINTS;
} }
if (num_ep > 0) { /* Can't allocate 0 bytes */ if (num_ep > 0) {
/* Can't allocate 0 bytes */
len = sizeof(struct usb_host_endpoint) * num_ep; len = sizeof(struct usb_host_endpoint) * num_ep;
alt->endpoint = kzalloc(len, GFP_KERNEL); alt->endpoint = kzalloc(len, GFP_KERNEL);
if (!alt->endpoint) if (!alt->endpoint)
...@@ -475,8 +476,9 @@ static int usb_parse_configuration(struct device *ddev, int cfgidx, ...@@ -475,8 +476,9 @@ static int usb_parse_configuration(struct device *ddev, int cfgidx,
return 0; return 0;
} }
// hub-only!! ... and only exported for reset/reinit path. /* hub-only!! ... and only exported for reset/reinit path.
// otherwise used internally on disconnect/destroy path * otherwise used internally on disconnect/destroy path
*/
void usb_destroy_configuration(struct usb_device *dev) void usb_destroy_configuration(struct usb_device *dev)
{ {
int c, i; int c, i;
...@@ -498,7 +500,7 @@ void usb_destroy_configuration(struct usb_device *dev) ...@@ -498,7 +500,7 @@ void usb_destroy_configuration(struct usb_device *dev)
kfree(cf->string); kfree(cf->string);
for (i = 0; i < cf->desc.bNumInterfaces; i++) { for (i = 0; i < cf->desc.bNumInterfaces; i++) {
if (cf->intf_cache[i]) if (cf->intf_cache[i])
kref_put(&cf->intf_cache[i]->ref, kref_put(&cf->intf_cache[i]->ref,
usb_release_interface_cache); usb_release_interface_cache);
} }
} }
...@@ -525,7 +527,7 @@ int usb_get_configuration(struct usb_device *dev) ...@@ -525,7 +527,7 @@ int usb_get_configuration(struct usb_device *dev)
unsigned int cfgno, length; unsigned int cfgno, length;
unsigned char *buffer; unsigned char *buffer;
unsigned char *bigbuffer; unsigned char *bigbuffer;
struct usb_config_descriptor *desc; struct usb_config_descriptor *desc;
cfgno = 0; cfgno = 0;
if (dev->authorized == 0) /* Not really an error */ if (dev->authorized == 0) /* Not really an error */
......
...@@ -202,10 +202,10 @@ static int usb_probe_interface(struct device *dev) ...@@ -202,10 +202,10 @@ static int usb_probe_interface(struct device *dev)
intf = to_usb_interface(dev); intf = to_usb_interface(dev);
udev = interface_to_usbdev(intf); udev = interface_to_usbdev(intf);
if (udev->authorized == 0) { if (udev->authorized == 0) {
dev_err(&intf->dev, "Device is not authorized for usage\n"); dev_err(&intf->dev, "Device is not authorized for usage\n");
return -ENODEV; return -ENODEV;
} }
id = usb_match_id(intf, driver->id_table); id = usb_match_id(intf, driver->id_table);
if (!id) if (!id)
...@@ -299,7 +299,7 @@ static int usb_unbind_interface(struct device *dev) ...@@ -299,7 +299,7 @@ static int usb_unbind_interface(struct device *dev)
* lock. * lock.
*/ */
int usb_driver_claim_interface(struct usb_driver *driver, int usb_driver_claim_interface(struct usb_driver *driver,
struct usb_interface *iface, void* priv) struct usb_interface *iface, void *priv)
{ {
struct device *dev = &iface->dev; struct device *dev = &iface->dev;
struct usb_device *udev = interface_to_usbdev(iface); struct usb_device *udev = interface_to_usbdev(iface);
...@@ -398,7 +398,7 @@ int usb_match_device(struct usb_device *dev, const struct usb_device_id *id) ...@@ -398,7 +398,7 @@ int usb_match_device(struct usb_device *dev, const struct usb_device_id *id)
return 0; return 0;
if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_SUBCLASS) && if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_SUBCLASS) &&
(id->bDeviceSubClass!= dev->descriptor.bDeviceSubClass)) (id->bDeviceSubClass != dev->descriptor.bDeviceSubClass))
return 0; return 0;
if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_PROTOCOL) && if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_PROTOCOL) &&
...@@ -586,7 +586,7 @@ static int usb_uevent(struct device *dev, struct kobj_uevent_env *env) ...@@ -586,7 +586,7 @@ static int usb_uevent(struct device *dev, struct kobj_uevent_env *env)
struct usb_device *usb_dev; struct usb_device *usb_dev;
/* driver is often null here; dev_dbg() would oops */ /* driver is often null here; dev_dbg() would oops */
pr_debug ("usb %s: uevent\n", dev->bus_id); pr_debug("usb %s: uevent\n", dev->bus_id);
if (is_usb_device(dev)) if (is_usb_device(dev))
usb_dev = to_usb_device(dev); usb_dev = to_usb_device(dev);
...@@ -596,11 +596,11 @@ static int usb_uevent(struct device *dev, struct kobj_uevent_env *env) ...@@ -596,11 +596,11 @@ static int usb_uevent(struct device *dev, struct kobj_uevent_env *env)
} }
if (usb_dev->devnum < 0) { if (usb_dev->devnum < 0) {
pr_debug ("usb %s: already deleted?\n", dev->bus_id); pr_debug("usb %s: already deleted?\n", dev->bus_id);
return -ENODEV; return -ENODEV;
} }
if (!usb_dev->bus) { if (!usb_dev->bus) {
pr_debug ("usb %s: bus removed?\n", dev->bus_id); pr_debug("usb %s: bus removed?\n", dev->bus_id);
return -ENODEV; return -ENODEV;
} }
...@@ -854,8 +854,10 @@ static int usb_suspend_interface(struct usb_interface *intf, pm_message_t msg) ...@@ -854,8 +854,10 @@ static int usb_suspend_interface(struct usb_interface *intf, pm_message_t msg)
dev_err(&intf->dev, "%s error %d\n", dev_err(&intf->dev, "%s error %d\n",
"suspend", status); "suspend", status);
} else { } else {
// FIXME else if there's no suspend method, disconnect... /*
// Not possible if auto_pm is set... * FIXME else if there's no suspend method, disconnect...
* Not possible if auto_pm is set...
*/
dev_warn(&intf->dev, "no suspend for driver %s?\n", dev_warn(&intf->dev, "no suspend for driver %s?\n",
driver->name); driver->name);
mark_quiesced(intf); mark_quiesced(intf);
...@@ -894,7 +896,7 @@ static int usb_resume_interface(struct usb_interface *intf, int reset_resume) ...@@ -894,7 +896,7 @@ static int usb_resume_interface(struct usb_interface *intf, int reset_resume)
dev_err(&intf->dev, "%s error %d\n", dev_err(&intf->dev, "%s error %d\n",
"reset_resume", status); "reset_resume", status);
} else { } else {
// status = -EOPNOTSUPP; /* status = -EOPNOTSUPP; */
dev_warn(&intf->dev, "no %s for driver %s?\n", dev_warn(&intf->dev, "no %s for driver %s?\n",
"reset_resume", driver->name); "reset_resume", driver->name);
} }
...@@ -905,7 +907,7 @@ static int usb_resume_interface(struct usb_interface *intf, int reset_resume) ...@@ -905,7 +907,7 @@ static int usb_resume_interface(struct usb_interface *intf, int reset_resume)
dev_err(&intf->dev, "%s error %d\n", dev_err(&intf->dev, "%s error %d\n",
"resume", status); "resume", status);
} else { } else {
// status = -EOPNOTSUPP; /* status = -EOPNOTSUPP; */
dev_warn(&intf->dev, "no %s for driver %s?\n", dev_warn(&intf->dev, "no %s for driver %s?\n",
"resume", driver->name); "resume", driver->name);
} }
...@@ -1175,7 +1177,7 @@ static int usb_resume_both(struct usb_device *udev) ...@@ -1175,7 +1177,7 @@ static int usb_resume_both(struct usb_device *udev)
* so if a root hub's controller is suspended * so if a root hub's controller is suspended
* then we're stuck. */ * then we're stuck. */
status = usb_resume_device(udev); status = usb_resume_device(udev);
} }
} else { } else {
/* Needed for setting udev->dev.power.power_state.event, /* Needed for setting udev->dev.power.power_state.event,
......
...@@ -72,7 +72,7 @@ set_bConfigurationValue(struct device *dev, struct device_attribute *attr, ...@@ -72,7 +72,7 @@ set_bConfigurationValue(struct device *dev, struct device_attribute *attr,
return (value < 0) ? value : count; return (value < 0) ? value : count;
} }
static DEVICE_ATTR(bConfigurationValue, S_IRUGO | S_IWUSR, static DEVICE_ATTR(bConfigurationValue, S_IRUGO | S_IWUSR,
show_bConfigurationValue, set_bConfigurationValue); show_bConfigurationValue, set_bConfigurationValue);
/* String fields */ /* String fields */
...@@ -650,21 +650,21 @@ void usb_remove_sysfs_dev_files(struct usb_device *udev) ...@@ -650,21 +650,21 @@ void usb_remove_sysfs_dev_files(struct usb_device *udev)
/* Interface Accociation Descriptor fields */ /* Interface Accociation Descriptor fields */
#define usb_intf_assoc_attr(field, format_string) \ #define usb_intf_assoc_attr(field, format_string) \
static ssize_t \ static ssize_t \
show_iad_##field (struct device *dev, struct device_attribute *attr, \ show_iad_##field(struct device *dev, struct device_attribute *attr, \
char *buf) \ 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->intf_assoc->field); \ intf->intf_assoc->field); \
} \ } \
static DEVICE_ATTR(iad_##field, S_IRUGO, show_iad_##field, NULL); static DEVICE_ATTR(iad_##field, S_IRUGO, show_iad_##field, NULL);
usb_intf_assoc_attr (bFirstInterface, "%02x\n") usb_intf_assoc_attr(bFirstInterface, "%02x\n")
usb_intf_assoc_attr (bInterfaceCount, "%02d\n") usb_intf_assoc_attr(bInterfaceCount, "%02d\n")
usb_intf_assoc_attr (bFunctionClass, "%02x\n") usb_intf_assoc_attr(bFunctionClass, "%02x\n")
usb_intf_assoc_attr (bFunctionSubClass, "%02x\n") usb_intf_assoc_attr(bFunctionSubClass, "%02x\n")
usb_intf_assoc_attr (bFunctionProtocol, "%02x\n") usb_intf_assoc_attr(bFunctionProtocol, "%02x\n")
/* Interface fields */ /* Interface fields */
#define usb_intf_attr(field, format_string) \ #define usb_intf_attr(field, format_string) \
......
...@@ -103,7 +103,7 @@ EXPORT_SYMBOL_GPL(usb_free_urb); ...@@ -103,7 +103,7 @@ EXPORT_SYMBOL_GPL(usb_free_urb);
* *
* A pointer to the urb with the incremented reference counter is returned. * A pointer to the urb with the incremented reference counter is returned.
*/ */
struct urb * usb_get_urb(struct urb *urb) struct urb *usb_get_urb(struct urb *urb)
{ {
if (urb) if (urb)
kref_get(&urb->kref); kref_get(&urb->kref);
...@@ -176,7 +176,7 @@ EXPORT_SYMBOL_GPL(usb_unanchor_urb); ...@@ -176,7 +176,7 @@ EXPORT_SYMBOL_GPL(usb_unanchor_urb);
* describing that request to the USB subsystem. Request completion will * describing that request to the USB subsystem. Request completion will
* be indicated later, asynchronously, by calling the completion handler. * be indicated later, asynchronously, by calling the completion handler.
* The three types of completion are success, error, and unlink * The three types of completion are success, error, and unlink
* (a software-induced fault, also called "request cancellation"). * (a software-induced fault, also called "request cancellation").
* *
* URBs may be submitted in interrupt context. * URBs may be submitted in interrupt context.
* *
...@@ -259,7 +259,7 @@ EXPORT_SYMBOL_GPL(usb_unanchor_urb); ...@@ -259,7 +259,7 @@ EXPORT_SYMBOL_GPL(usb_unanchor_urb);
* semaphores), or * semaphores), or
* (c) current->state != TASK_RUNNING, this is the case only after * (c) current->state != TASK_RUNNING, this is the case only after
* you've changed it. * you've changed it.
* *
* GFP_NOIO is used in the block io path and error handling of storage * GFP_NOIO is used in the block io path and error handling of storage
* devices. * devices.
* *
...@@ -288,7 +288,8 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) ...@@ -288,7 +288,8 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
if (!urb || urb->hcpriv || !urb->complete) if (!urb || urb->hcpriv || !urb->complete)
return -EINVAL; return -EINVAL;
if (!(dev = urb->dev) || dev->state < USB_STATE_DEFAULT) dev = urb->dev;
if ((!dev) || (dev->state < USB_STATE_DEFAULT))
return -ENODEV; return -ENODEV;
/* For now, get the endpoint from the pipe. Eventually drivers /* For now, get the endpoint from the pipe. Eventually drivers
...@@ -351,11 +352,11 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) ...@@ -351,11 +352,11 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
max *= mult; max *= mult;
} }
if (urb->number_of_packets <= 0) if (urb->number_of_packets <= 0)
return -EINVAL; return -EINVAL;
for (n = 0; n < urb->number_of_packets; n++) { 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) if (len < 0 || len > max)
return -EMSGSIZE; return -EMSGSIZE;
urb->iso_frame_desc[n].status = -EXDEV; urb->iso_frame_desc[n].status = -EXDEV;
urb->iso_frame_desc[n].actual_length = 0; urb->iso_frame_desc[n].actual_length = 0;
...@@ -420,7 +421,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) ...@@ -420,7 +421,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
/* too big? */ /* too big? */
switch (dev->speed) { switch (dev->speed) {
case USB_SPEED_HIGH: /* units are microframes */ case USB_SPEED_HIGH: /* units are microframes */
// NOTE usb handles 2^15 /* NOTE usb handles 2^15 */
if (urb->interval > (1024 * 8)) if (urb->interval > (1024 * 8))
urb->interval = 1024 * 8; urb->interval = 1024 * 8;
max = 1024 * 8; max = 1024 * 8;
...@@ -430,12 +431,12 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) ...@@ -430,12 +431,12 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
if (xfertype == USB_ENDPOINT_XFER_INT) { if (xfertype == USB_ENDPOINT_XFER_INT) {
if (urb->interval > 255) if (urb->interval > 255)
return -EINVAL; return -EINVAL;
// NOTE ohci only handles up to 32 /* NOTE ohci only handles up to 32 */
max = 128; max = 128;
} else { } else {
if (urb->interval > 1024) if (urb->interval > 1024)
urb->interval = 1024; urb->interval = 1024;
// NOTE usb and ohci handle up to 2^15 /* NOTE usb and ohci handle up to 2^15 */
max = 1024; max = 1024;
} }
break; break;
...@@ -574,7 +575,8 @@ void usb_kill_anchored_urbs(struct usb_anchor *anchor) ...@@ -574,7 +575,8 @@ void usb_kill_anchored_urbs(struct usb_anchor *anchor)
spin_lock_irq(&anchor->lock); spin_lock_irq(&anchor->lock);
while (!list_empty(&anchor->urb_list)) { while (!list_empty(&anchor->urb_list)) {
victim = list_entry(anchor->urb_list.prev, struct urb, anchor_list); victim = list_entry(anchor->urb_list.prev, struct urb,
anchor_list);
/* we must make sure the URB isn't freed before we kill it*/ /* we must make sure the URB isn't freed before we kill it*/
usb_get_urb(victim); usb_get_urb(victim);
spin_unlock_irq(&anchor->lock); spin_unlock_irq(&anchor->lock);
......
...@@ -116,8 +116,9 @@ EXPORT_SYMBOL_GPL(usb_ifnum_to_if); ...@@ -116,8 +116,9 @@ EXPORT_SYMBOL_GPL(usb_ifnum_to_if);
* Don't call this function unless you are bound to the intf interface * Don't call this function unless you are bound to the intf interface
* or you have locked the device! * or you have locked the device!
*/ */
struct usb_host_interface *usb_altnum_to_altsetting(const struct usb_interface *intf, struct usb_host_interface *usb_altnum_to_altsetting(
unsigned int altnum) const struct usb_interface *intf,
unsigned int altnum)
{ {
int i; int i;
...@@ -134,7 +135,7 @@ struct find_interface_arg { ...@@ -134,7 +135,7 @@ struct find_interface_arg {
struct usb_interface *interface; struct usb_interface *interface;
}; };
static int __find_interface(struct device * dev, void * data) static int __find_interface(struct device *dev, void *data)
{ {
struct find_interface_arg *arg = data; struct find_interface_arg *arg = data;
struct usb_interface *intf; struct usb_interface *intf;
...@@ -156,7 +157,7 @@ static int __find_interface(struct device * dev, void * data) ...@@ -156,7 +157,7 @@ static int __find_interface(struct device * dev, void * data)
* @drv: the driver whose current configuration is considered * @drv: the driver whose current configuration is considered
* @minor: the minor number of the desired device * @minor: the minor number of the desired device
* *
* This walks the driver device list and returns a pointer to the interface * This walks the driver device list and returns a pointer to the interface
* with the matching minor. Note, this only works for devices that share the * with the matching minor. Note, this only works for devices that share the
* USB major number. * USB major number.
*/ */
...@@ -272,8 +273,8 @@ static unsigned usb_bus_is_wusb(struct usb_bus *bus) ...@@ -272,8 +273,8 @@ static unsigned usb_bus_is_wusb(struct usb_bus *bus)
* *
* This call may not be used in a non-sleeping context. * This call may not be used in a non-sleeping context.
*/ */
struct usb_device * struct usb_device *usb_alloc_dev(struct usb_device *parent,
usb_alloc_dev(struct usb_device *parent, struct usb_bus *bus, unsigned port1) struct usb_bus *bus, unsigned port1)
{ {
struct usb_device *dev; struct usb_device *dev;
struct usb_hcd *usb_hcd = container_of(bus, struct usb_hcd, self); struct usb_hcd *usb_hcd = container_of(bus, struct usb_hcd, self);
...@@ -469,11 +470,11 @@ int usb_lock_device_for_reset(struct usb_device *udev, ...@@ -469,11 +470,11 @@ int usb_lock_device_for_reset(struct usb_device *udev,
return -EHOSTUNREACH; return -EHOSTUNREACH;
if (iface) { if (iface) {
switch (iface->condition) { switch (iface->condition) {
case USB_INTERFACE_BINDING: case USB_INTERFACE_BINDING:
return 0; return 0;
case USB_INTERFACE_BOUND: case USB_INTERFACE_BOUND:
break; break;
default: default:
return -EINTR; return -EINTR;
} }
} }
...@@ -548,10 +549,10 @@ struct usb_device *usb_find_device(u16 vendor_id, u16 product_id) ...@@ -548,10 +549,10 @@ struct usb_device *usb_find_device(u16 vendor_id, u16 product_id)
struct list_head *buslist; struct list_head *buslist;
struct usb_bus *bus; struct usb_bus *bus;
struct usb_device *dev = NULL; struct usb_device *dev = NULL;
mutex_lock(&usb_bus_list_lock); mutex_lock(&usb_bus_list_lock);
for (buslist = usb_bus_list.next; for (buslist = usb_bus_list.next;
buslist != &usb_bus_list; buslist != &usb_bus_list;
buslist = buslist->next) { buslist = buslist->next) {
bus = container_of(buslist, struct usb_bus, bus_list); bus = container_of(buslist, struct usb_bus, bus_list);
if (!bus->root_hub) if (!bus->root_hub)
...@@ -593,7 +594,7 @@ EXPORT_SYMBOL_GPL(usb_get_current_frame_number); ...@@ -593,7 +594,7 @@ EXPORT_SYMBOL_GPL(usb_get_current_frame_number);
*/ */
int __usb_get_extra_descriptor(char *buffer, unsigned size, int __usb_get_extra_descriptor(char *buffer, unsigned size,
unsigned char type, void **ptr) unsigned char type, void **ptr)
{ {
struct usb_descriptor_header *header; struct usb_descriptor_header *header;
...@@ -604,7 +605,7 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size, ...@@ -604,7 +605,7 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size,
printk(KERN_ERR printk(KERN_ERR
"%s: bogus descriptor, type %d length %d\n", "%s: bogus descriptor, type %d length %d\n",
usbcore_name, usbcore_name,
header->bDescriptorType, header->bDescriptorType,
header->bLength); header->bLength);
return -1; return -1;
} }
...@@ -643,12 +644,8 @@ EXPORT_SYMBOL_GPL(__usb_get_extra_descriptor); ...@@ -643,12 +644,8 @@ EXPORT_SYMBOL_GPL(__usb_get_extra_descriptor);
* *
* When the buffer is no longer used, free it with usb_buffer_free(). * 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,
struct usb_device *dev, dma_addr_t *dma)
size_t size,
gfp_t mem_flags,
dma_addr_t *dma
)
{ {
if (!dev || !dev->bus) if (!dev || !dev->bus)
return NULL; return NULL;
...@@ -667,12 +664,8 @@ EXPORT_SYMBOL_GPL(usb_buffer_alloc); ...@@ -667,12 +664,8 @@ EXPORT_SYMBOL_GPL(usb_buffer_alloc);
* been allocated using usb_buffer_alloc(), and the parameters must match * been allocated using usb_buffer_alloc(), and the parameters must match
* those provided in that allocation request. * those provided in that allocation request.
*/ */
void usb_buffer_free( void usb_buffer_free(struct usb_device *dev, size_t size, void *addr,
struct usb_device *dev, dma_addr_t dma)
size_t size,
void *addr,
dma_addr_t dma
)
{ {
if (!dev || !dev->bus) if (!dev || !dev->bus)
return; return;
...@@ -720,8 +713,8 @@ struct urb *usb_buffer_map(struct urb *urb) ...@@ -720,8 +713,8 @@ struct urb *usb_buffer_map(struct urb *urb)
urb->setup_packet, urb->setup_packet,
sizeof(struct usb_ctrlrequest), sizeof(struct usb_ctrlrequest),
DMA_TO_DEVICE); DMA_TO_DEVICE);
// FIXME generic api broken like pci, can't report errors /* FIXME generic api broken like pci, can't report errors */
// if (urb->transfer_dma == DMA_ADDR_INVALID) return 0; /* if (urb->transfer_dma == DMA_ADDR_INVALID) return 0; */
} else } else
urb->transfer_dma = ~0; urb->transfer_dma = ~0;
urb->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP urb->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP
...@@ -843,7 +836,7 @@ int usb_buffer_map_sg(const struct usb_device *dev, int is_in, ...@@ -843,7 +836,7 @@ int usb_buffer_map_sg(const struct usb_device *dev, int is_in,
|| !controller->dma_mask) || !controller->dma_mask)
return -1; return -1;
// FIXME generic api broken like pci, can't report errors /* FIXME generic api broken like pci, can't report errors */
return dma_map_sg(controller, sg, nents, return dma_map_sg(controller, sg, nents,
is_in ? DMA_FROM_DEVICE : DMA_TO_DEVICE); is_in ? DMA_FROM_DEVICE : DMA_TO_DEVICE);
} }
...@@ -937,7 +930,7 @@ static int __init usb_init(void) ...@@ -937,7 +930,7 @@ static int __init usb_init(void)
if (retval) if (retval)
goto out; goto out;
retval = bus_register(&usb_bus_type); retval = bus_register(&usb_bus_type);
if (retval) if (retval)
goto bus_register_failed; goto bus_register_failed;
retval = usb_host_init(); retval = usb_host_init();
if (retval) if (retval)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册