Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
Browse files Browse the repository at this point in the history
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (97 commits)
  USB: qcserial: add device id for HP devices
  USB: isp1760: Add a delay before reading the SKIPMAP registers in isp1760-hcd.c
  USB: allow malformed LANGID descriptors
  USB: pxa27x_udc: typo fixes and code cleanups
  USB: gadget: gadget zero uses new suspend/resume hooks
  USB: gadget: composite device-level suspend/resume hooks
  USB: r8a66597-hcd: suspend/resume support
  USB: more u32 conversion after transfer_buffer_length and actual_length
  USB: Fix cp2101 USB serial device driver termios functions for console use
  USB: CP2101 New Device ID
  USB: ipaq: handle 4 endpoint devices
  USB: S3C: Move usb-control.h to platform include
  USB: ohci-hcd: Add ARCH_S3C24XX to the ohci-s3c2410.c glue
  USB: pedantic: spelling correction in comment for ch9.h
  USB: host: fix sparse warning: Using plain integer as NULL pointer
  USB: ohci-s3c2410: fix name of bus clock
  USB: ohci-s3c2410: remove <mach/hardware.h> include
  USB: serial: rename cp2101 driver to cp210x
  USB: CP2101 Reduce Error Logging
  USB: CP2101 Support AN205 baud rates
  ...
  • Loading branch information
Linus Torvalds committed Mar 26, 2009
2 parents 0c93ea4 + fd8345f commit 61a0918
Show file tree
Hide file tree
Showing 157 changed files with 5,226 additions and 3,827 deletions.
27 changes: 20 additions & 7 deletions Documentation/usb/usbmon.txt
Original file line number Diff line number Diff line change
Expand Up @@ -229,16 +229,26 @@ struct usbmon_packet {
int status; /* 28: */
unsigned int length; /* 32: Length of data (submitted or actual) */
unsigned int len_cap; /* 36: Delivered length */
unsigned char setup[8]; /* 40: Only for Control 'S' */
}; /* 48 bytes total */
union { /* 40: */
unsigned char setup[SETUP_LEN]; /* Only for Control S-type */
struct iso_rec { /* Only for ISO */
int error_count;
int numdesc;
} iso;
} s;
int interval; /* 48: Only for Interrupt and ISO */
int start_frame; /* 52: For ISO */
unsigned int xfer_flags; /* 56: copy of URB's transfer_flags */
unsigned int ndesc; /* 60: Actual number of ISO descriptors */
}; /* 64 total length */

These events can be received from a character device by reading with read(2),
with an ioctl(2), or by accessing the buffer with mmap.
with an ioctl(2), or by accessing the buffer with mmap. However, read(2)
only returns first 48 bytes for compatibility reasons.

The character device is usually called /dev/usbmonN, where N is the USB bus
number. Number zero (/dev/usbmon0) is special and means "all buses".
However, this feature is not implemented yet. Note that specific naming
policy is set by your Linux distribution.
Note that specific naming policy is set by your Linux distribution.

If you create /dev/usbmon0 by hand, make sure that it is owned by root
and has mode 0600. Otherwise, unpriviledged users will be able to snoop
Expand Down Expand Up @@ -279,9 +289,10 @@ size is out of [unspecified] bounds for this kernel, the call fails with
This call returns the current size of the buffer in bytes.

MON_IOCX_GET, defined as _IOW(MON_IOC_MAGIC, 6, struct mon_get_arg)
MON_IOCX_GETX, defined as _IOW(MON_IOC_MAGIC, 10, struct mon_get_arg)

This call waits for events to arrive if none were in the kernel buffer,
then returns the first event. Its argument is a pointer to the following
These calls wait for events to arrive if none were in the kernel buffer,
then return the first event. The argument is a pointer to the following
structure:

struct mon_get_arg {
Expand All @@ -294,6 +305,8 @@ Before the call, hdr, data, and alloc should be filled. Upon return, the area
pointed by hdr contains the next event structure, and the data buffer contains
the data, if any. The event is removed from the kernel buffer.

The MON_IOCX_GET copies 48 bytes, MON_IOCX_GETX copies 64 bytes.

MON_IOCX_MFETCH, defined as _IOWR(MON_IOC_MAGIC, 7, struct mon_mfetch_arg)

This ioctl is primarily used when the application accesses the buffer
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/mach-s3c2410/usb-simtec.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@

#include <mach/bast-map.h>
#include <mach/bast-irq.h>
#include <mach/usb-control.h>
#include <mach/regs-gpio.h>

#include <mach/hardware.h>
#include <asm/irq.h>

#include <plat/usb-control.h>
#include <plat/devs.h>

#include "usb-simtec.h"

/* control power and monitor over-current events on various Simtec
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/* arch/arm/mach-s3c2410/include/mach/usb-control.h
/* arch/arm/plat-s3c/include/plat/usb-control.h
*
* Copyright (c) 2004 Simtec Electronics
* Ben Dooks <ben@simtec.co.uk>
*
* S3C2410 - usb port information
* S3C - USB host port information
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef __ASM_ARCH_USBCONTROL_H
#define __ASM_ARCH_USBCONTROL_H "arch/arm/mach-s3c2410/include/mach/usb-control.h"
#define __ASM_ARCH_USBCONTROL_H

#define S3C_HCDFLG_USED (1)

Expand Down
11 changes: 5 additions & 6 deletions drivers/block/ub.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum);
*/
#ifdef CONFIG_USB_LIBUSUAL

#define ub_usb_ids storage_usb_ids
#define ub_usb_ids usb_storage_usb_ids
#else

static struct usb_device_id ub_usb_ids[] = {
Expand Down Expand Up @@ -2146,10 +2146,9 @@ static int ub_get_pipes(struct ub_dev *sc, struct usb_device *dev,
ep = &altsetting->endpoint[i].desc;

/* Is it a BULK endpoint? */
if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
== USB_ENDPOINT_XFER_BULK) {
if (usb_endpoint_xfer_bulk(ep)) {
/* BULK in or out? */
if (ep->bEndpointAddress & USB_DIR_IN) {
if (usb_endpoint_dir_in(ep)) {
if (ep_in == NULL)
ep_in = ep;
} else {
Expand All @@ -2168,9 +2167,9 @@ static int ub_get_pipes(struct ub_dev *sc, struct usb_device *dev,
sc->send_ctrl_pipe = usb_sndctrlpipe(dev, 0);
sc->recv_ctrl_pipe = usb_rcvctrlpipe(dev, 0);
sc->send_bulk_pipe = usb_sndbulkpipe(dev,
ep_out->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
usb_endpoint_num(ep_out));
sc->recv_bulk_pipe = usb_rcvbulkpipe(dev,
ep_in->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
usb_endpoint_num(ep_in));

return 0;
}
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ obj-$(CONFIG_USB_SL811_HCD) += host/
obj-$(CONFIG_USB_U132_HCD) += host/
obj-$(CONFIG_USB_R8A66597_HCD) += host/
obj-$(CONFIG_USB_HWA_HCD) += host/
obj-$(CONFIG_USB_ISP1760_HCD) += host/

obj-$(CONFIG_USB_C67X00_HCD) += c67x00/

Expand Down
11 changes: 7 additions & 4 deletions drivers/usb/class/usblp.c
Original file line number Diff line number Diff line change
Expand Up @@ -880,16 +880,19 @@ static int usblp_wwait(struct usblp *usblp, int nonblock)
if (rc <= 0)
break;

if (usblp->flags & LP_ABORT) {
if (schedule_timeout(msecs_to_jiffies(5000)) == 0) {
if (schedule_timeout(msecs_to_jiffies(1500)) == 0) {
if (usblp->flags & LP_ABORT) {
err = usblp_check_status(usblp, err);
if (err == 1) { /* Paper out */
rc = -ENOSPC;
break;
}
} else {
/* Prod the printer, Gentoo#251237. */
mutex_lock(&usblp->mut);
usblp_read_status(usblp, usblp->statusbuf);
mutex_unlock(&usblp->mut);
}
} else {
schedule();
}
}
set_current_state(TASK_RUNNING);
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/core/devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ static char *usb_dump_endpoint_descriptor(int speed, char *start, char *end,
}

/* this isn't checking for illegal values */
switch (desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) {
switch (usb_endpoint_type(desc)) {
case USB_ENDPOINT_XFER_CONTROL:
type = "Ctrl";
if (speed == USB_SPEED_HIGH) /* uframes per NAK */
Expand Down
21 changes: 11 additions & 10 deletions drivers/usb/core/devio.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ MODULE_PARM_DESC(usbfs_snoop, "true to log all usbfs traffic");

#define MAX_USBFS_BUFFER_SIZE 16384

static inline int connected(struct dev_state *ps)
static int connected(struct dev_state *ps)
{
return (!list_empty(&ps->list) &&
ps->dev->state != USB_STATE_NOTATTACHED);
Expand Down Expand Up @@ -248,7 +248,7 @@ static void free_async(struct async *as)
kfree(as);
}

static inline void async_newpending(struct async *as)
static void async_newpending(struct async *as)
{
struct dev_state *ps = as->ps;
unsigned long flags;
Expand All @@ -258,7 +258,7 @@ static inline void async_newpending(struct async *as)
spin_unlock_irqrestore(&ps->lock, flags);
}

static inline void async_removepending(struct async *as)
static void async_removepending(struct async *as)
{
struct dev_state *ps = as->ps;
unsigned long flags;
Expand All @@ -268,7 +268,7 @@ static inline void async_removepending(struct async *as)
spin_unlock_irqrestore(&ps->lock, flags);
}

static inline struct async *async_getcompleted(struct dev_state *ps)
static struct async *async_getcompleted(struct dev_state *ps)
{
unsigned long flags;
struct async *as = NULL;
Expand All @@ -283,7 +283,7 @@ static inline struct async *async_getcompleted(struct dev_state *ps)
return as;
}

static inline struct async *async_getpending(struct dev_state *ps,
static struct async *async_getpending(struct dev_state *ps,
void __user *userurb)
{
unsigned long flags;
Expand All @@ -302,7 +302,7 @@ static inline struct async *async_getpending(struct dev_state *ps,

static void snoop_urb(struct urb *urb, void __user *userurb)
{
int j;
unsigned j;
unsigned char *data = urb->transfer_buffer;

if (!usbfs_snoop)
Expand All @@ -311,9 +311,9 @@ static void snoop_urb(struct urb *urb, void __user *userurb)
dev_info(&urb->dev->dev, "direction=%s\n",
usb_urb_dir_in(urb) ? "IN" : "OUT");
dev_info(&urb->dev->dev, "userurb=%p\n", userurb);
dev_info(&urb->dev->dev, "transfer_buffer_length=%d\n",
dev_info(&urb->dev->dev, "transfer_buffer_length=%u\n",
urb->transfer_buffer_length);
dev_info(&urb->dev->dev, "actual_length=%d\n", urb->actual_length);
dev_info(&urb->dev->dev, "actual_length=%u\n", urb->actual_length);
dev_info(&urb->dev->dev, "data: ");
for (j = 0; j < urb->transfer_buffer_length; ++j)
printk("%02x ", data[j]);
Expand Down Expand Up @@ -376,7 +376,7 @@ static void destroy_async_on_interface(struct dev_state *ps,
destroy_async(ps, &hitlist);
}

static inline void destroy_all_async(struct dev_state *ps)
static void destroy_all_async(struct dev_state *ps)
{
destroy_async(ps, &ps->async_pending);
}
Expand Down Expand Up @@ -525,7 +525,8 @@ static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype,
{
int ret = 0;

if (ps->dev->state != USB_STATE_ADDRESS
if (ps->dev->state != USB_STATE_UNAUTHENTICATED
&& ps->dev->state != USB_STATE_ADDRESS
&& ps->dev->state != USB_STATE_CONFIGURED)
return -EHOSTUNREACH;
if (USB_TYPE_VENDOR == (USB_TYPE_MASK & requesttype))
Expand Down
9 changes: 4 additions & 5 deletions drivers/usb/core/endpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static ssize_t show_ep_type(struct device *dev, struct device_attribute *attr,
struct ep_device *ep = to_ep_device(dev);
char *type = "unknown";

switch (ep->desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) {
switch (usb_endpoint_type(ep->desc)) {
case USB_ENDPOINT_XFER_CONTROL:
type = "Control";
break;
Expand Down Expand Up @@ -94,7 +94,7 @@ static ssize_t show_ep_interval(struct device *dev,

in = (ep->desc->bEndpointAddress & USB_DIR_IN);

switch (ep->desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) {
switch (usb_endpoint_type(ep->desc)) {
case USB_ENDPOINT_XFER_CONTROL:
if (ep->udev->speed == USB_SPEED_HIGH) /* uframes per NAK */
interval = ep->desc->bInterval;
Expand Down Expand Up @@ -131,10 +131,9 @@ static ssize_t show_ep_direction(struct device *dev,
struct ep_device *ep = to_ep_device(dev);
char *direction;

if ((ep->desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_CONTROL)
if (usb_endpoint_xfer_control(ep->desc))
direction = "both";
else if (ep->desc->bEndpointAddress & USB_DIR_IN)
else if (usb_endpoint_dir_in(ep->desc))
direction = "in";
else
direction = "out";
Expand Down
33 changes: 13 additions & 20 deletions drivers/usb/core/hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ static const u8 hs_rh_config_descriptor [] = {
* helper routine for returning string descriptors in UTF-16LE
* input can actually be ISO-8859-1; ASCII is its 7-bit subset
*/
static int ascii2utf (char *s, u8 *utf, int utfmax)
static unsigned ascii2utf(char *s, u8 *utf, int utfmax)
{
int retval;
unsigned retval;

for (retval = 0; *s && utfmax > 1; utfmax -= 2, retval += 2) {
*utf++ = *s++;
Expand All @@ -304,19 +304,15 @@ static int ascii2utf (char *s, u8 *utf, int utfmax)
* Produces either a manufacturer, product or serial number string for the
* virtual root hub device.
*/
static int rh_string (
int id,
struct usb_hcd *hcd,
u8 *data,
int len
) {
static unsigned rh_string(int id, struct usb_hcd *hcd, u8 *data, unsigned len)
{
char buf [100];

// language ids
if (id == 0) {
buf[0] = 4; buf[1] = 3; /* 4 bytes string data */
buf[2] = 0x09; buf[3] = 0x04; /* MSFT-speak for "en-us" */
len = min (len, 4);
len = min_t(unsigned, len, 4);
memcpy (data, buf, len);
return len;

Expand All @@ -332,10 +328,7 @@ static int rh_string (
} else if (id == 3) {
snprintf (buf, sizeof buf, "%s %s %s", init_utsname()->sysname,
init_utsname()->release, hcd->driver->description);

// unsupported IDs --> "protocol stall"
} else
return -EPIPE;
}

switch (len) { /* All cases fall through */
default:
Expand All @@ -360,9 +353,8 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
u8 tbuf [sizeof (struct usb_hub_descriptor)]
__attribute__((aligned(4)));
const u8 *bufp = tbuf;
int len = 0;
unsigned len = 0;
int status;
int n;
u8 patch_wakeup = 0;
u8 patch_protocol = 0;

Expand Down Expand Up @@ -456,10 +448,11 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
patch_wakeup = 1;
break;
case USB_DT_STRING << 8:
n = rh_string (wValue & 0xff, hcd, ubuf, wLength);
if (n < 0)
if ((wValue & 0xff) < 4)
urb->actual_length = rh_string(wValue & 0xff,
hcd, ubuf, wLength);
else /* unsupported IDs --> "protocol stall" */
goto error;
urb->actual_length = n;
break;
default:
goto error;
Expand Down Expand Up @@ -629,7 +622,7 @@ static int rh_queue_status (struct usb_hcd *hcd, struct urb *urb)
{
int retval;
unsigned long flags;
int len = 1 + (urb->dev->maxchild / 8);
unsigned len = 1 + (urb->dev->maxchild / 8);

spin_lock_irqsave (&hcd_root_hub_lock, flags);
if (hcd->status_urb || urb->transfer_buffer_length < len) {
Expand Down Expand Up @@ -901,7 +894,7 @@ static int register_root_hub(struct usb_hcd *hcd)

mutex_lock(&usb_bus_list_lock);

usb_dev->ep0.desc.wMaxPacketSize = __constant_cpu_to_le16(64);
usb_dev->ep0.desc.wMaxPacketSize = cpu_to_le16(64);
retval = usb_get_device_descriptor(usb_dev, USB_DT_DEVICE_SIZE);
if (retval != sizeof usb_dev->descriptor) {
mutex_unlock(&usb_bus_list_lock);
Expand Down
Loading

0 comments on commit 61a0918

Please sign in to comment.