projects
/
powerpc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6
[powerpc.git]
/
drivers
/
usb
/
core
/
devices.c
diff --git
a/drivers/usb/core/devices.c
b/drivers/usb/core/devices.c
index
c0f3734
..
aefc798
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,
@@
-175,12
+175,13
@@
static char *usb_dump_endpoint_descriptor (
)
{
char dir, unit, *type;
)
{
char dir, unit, *type;
- unsigned interval,
in,
bandwidth = 1;
+ unsigned interval, bandwidth = 1;
if (start > end)
return start;
if (start > end)
return start;
- in = (desc->bEndpointAddress & USB_DIR_IN);
- dir = in ? 'I' : 'O';
+
+ dir = usb_endpoint_dir_in(desc) ? 'I' : 'O';
+
if (speed == USB_SPEED_HIGH) {
switch (le16_to_cpu(desc->wMaxPacketSize) & (0x03 << 11)) {
case 1 << 11: bandwidth = 2; break;
if (speed == USB_SPEED_HIGH) {
switch (le16_to_cpu(desc->wMaxPacketSize) & (0x03 << 11)) {
case 1 << 11: bandwidth = 2; break;
@@
-204,16
+205,16
@@
static char *usb_dump_endpoint_descriptor (
break;
case USB_ENDPOINT_XFER_BULK:
type = "Bulk";
break;
case USB_ENDPOINT_XFER_BULK:
type = "Bulk";
- if (speed == USB_SPEED_HIGH &&
!in)
/* uframes per NAK */
+ if (speed == USB_SPEED_HIGH &&
dir == 'O')
/* uframes per NAK */
interval = desc->bInterval;
else
interval = 0;
break;
case USB_ENDPOINT_XFER_INT:
type = "Int.";
interval = desc->bInterval;
else
interval = 0;
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" */
@@
-241,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,
@@
-342,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),
@@
-362,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;
@@
-394,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)
@@
-593,23
+598,24
@@
static ssize_t usb_device_read(struct file *file, char __user *buf, size_t nbyte
/* Kernel lock for "lastev" protection */
static unsigned int usb_device_poll(struct file *file, struct poll_table_struct *wait)
{
/* Kernel lock for "lastev" protection */
static unsigned int usb_device_poll(struct file *file, struct poll_table_struct *wait)
{
- struct usb_device_status *st =
(struct usb_device_status *)
file->private_data;
+ struct usb_device_status *st = file->private_data;
unsigned int mask = 0;
lock_kernel();
if (!st) {
st = kmalloc(sizeof(struct usb_device_status), GFP_KERNEL);
unsigned int mask = 0;
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) {
kfree(st);
st = file->private_data;
goto lost_race;
}
/* we may have dropped BKL - need to check for having lost the race */
if (file->private_data) {
kfree(st);
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
@@
-667,7
+673,7
@@
static loff_t usb_device_lseek(struct file * file, loff_t offset, int orig)
return ret;
}
return ret;
}
-struct file_operations usbfs_devices_fops = {
+
const
struct file_operations usbfs_devices_fops = {
.llseek = usb_device_lseek,
.read = usb_device_read,
.poll = usb_device_poll,
.llseek = usb_device_lseek,
.read = usb_device_read,
.poll = usb_device_poll,