projects
/
deliverable
/
linux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
USB: refactor usb device matching and create usb_device_match
[deliverable/linux.git]
/
drivers
/
usb
/
core
/
devices.c
diff --git
a/drivers/usb/core/devices.c
b/drivers/usb/core/devices.c
index ea398e5d50af5c6bd90621d06946ad6617af0bdb..aefc7987120d37bfa4d67c11bfb37f84b5dc18bc 100644
(file)
--- a/
drivers/usb/core/devices.c
+++ b/
drivers/usb/core/devices.c
@@
-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*/
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 */
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;
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,
int speed,
char *start,
char *end,
@@
-212,9
+212,9
@@
static char *usb_dump_endpoint_descriptor (
break;
case USB_ENDPOINT_XFER_INT:
type = "Int.";
break;
case USB_ENDPOINT_XFER_INT:
type = "Int.";
- if (speed == USB_SPEED_HIGH)
{
+ if (speed == USB_SPEED_HIGH)
interval = 1 << (desc->bInterval - 1);
interval = 1 << (desc->bInterval - 1);
-
}
else
+ else
interval = desc->bInterval;
break;
default: /* "can't happen" */
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 = "";
{
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 (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)");
driver_name = (iface->dev.driver
? iface->dev.driver->name
: "(none)");
+ active = (desc == &iface->cur_altsetting->desc);
+ }
start += sprintf(start, format_iface,
start += sprintf(start, format_iface,
+ active ? '*' : ' ', /* mark active altsetting */
desc->bInterfaceNumber,
desc->bAlternateSetting,
desc->bNumEndpoints,
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;
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),
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.
*/
/*
* 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;
{
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;
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)
for (i = 0; i < dev->descriptor.bNumConfigurations; i++) {
if (start > end)
@@
-600,10
+604,6
@@
static unsigned int usb_device_poll(struct file *file, struct poll_table_struct
lock_kernel();
if (!st) {
st = kmalloc(sizeof(struct usb_device_status), GFP_KERNEL);
lock_kernel();
if (!st) {
st = kmalloc(sizeof(struct usb_device_status), GFP_KERNEL);
- if (!st) {
- unlock_kernel();
- return POLLIN;
- }
/* we may have dropped BKL - need to check for having lost the race */
if (file->private_data) {
/* we may have dropped BKL - need to check for having lost the race */
if (file->private_data) {
@@
-611,6
+611,11
@@
static unsigned int usb_device_poll(struct file *file, struct poll_table_struct
st = file->private_data;
goto lost_race;
}
st = file->private_data;
goto lost_race;
}
+ /* we haven't lost - check for allocation failure now */
+ if (!st) {
+ unlock_kernel();
+ return POLLIN;
+ }
/*
* need to prevent the module from being unloaded, since
/*
* need to prevent the module from being unloaded, since
This page took
0.025253 seconds
and
5
git commands to generate.