Skip to content

Commit 61a0918

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* 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 ...
2 parents 0c93ea4 + fd8345f commit 61a0918

File tree

157 files changed

+5226
-3827
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+5226
-3827
lines changed

Documentation/usb/usbmon.txt

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -229,16 +229,26 @@ struct usbmon_packet {
229229
int status; /* 28: */
230230
unsigned int length; /* 32: Length of data (submitted or actual) */
231231
unsigned int len_cap; /* 36: Delivered length */
232-
unsigned char setup[8]; /* 40: Only for Control 'S' */
233-
}; /* 48 bytes total */
232+
union { /* 40: */
233+
unsigned char setup[SETUP_LEN]; /* Only for Control S-type */
234+
struct iso_rec { /* Only for ISO */
235+
int error_count;
236+
int numdesc;
237+
} iso;
238+
} s;
239+
int interval; /* 48: Only for Interrupt and ISO */
240+
int start_frame; /* 52: For ISO */
241+
unsigned int xfer_flags; /* 56: copy of URB's transfer_flags */
242+
unsigned int ndesc; /* 60: Actual number of ISO descriptors */
243+
}; /* 64 total length */
234244

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

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

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

281291
MON_IOCX_GET, defined as _IOW(MON_IOC_MAGIC, 6, struct mon_get_arg)
292+
MON_IOCX_GETX, defined as _IOW(MON_IOC_MAGIC, 10, struct mon_get_arg)
282293

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

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

308+
The MON_IOCX_GET copies 48 bytes, MON_IOCX_GETX copies 64 bytes.
309+
297310
MON_IOCX_MFETCH, defined as _IOWR(MON_IOC_MAGIC, 7, struct mon_mfetch_arg)
298311

299312
This ioctl is primarily used when the application accesses the buffer

arch/arm/mach-s3c2410/usb-simtec.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@
2929

3030
#include <mach/bast-map.h>
3131
#include <mach/bast-irq.h>
32-
#include <mach/usb-control.h>
3332
#include <mach/regs-gpio.h>
3433

3534
#include <mach/hardware.h>
3635
#include <asm/irq.h>
3736

37+
#include <plat/usb-control.h>
3838
#include <plat/devs.h>
39+
3940
#include "usb-simtec.h"
4041

4142
/* control power and monitor over-current events on various Simtec

arch/arm/mach-s3c2410/include/mach/usb-control.h renamed to arch/arm/plat-s3c/include/plat/usb-control.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
/* arch/arm/mach-s3c2410/include/mach/usb-control.h
1+
/* arch/arm/plat-s3c/include/plat/usb-control.h
22
*
33
* Copyright (c) 2004 Simtec Electronics
44
* Ben Dooks <ben@simtec.co.uk>
55
*
6-
* S3C2410 - usb port information
6+
* S3C - USB host port information
77
*
88
* This program is free software; you can redistribute it and/or modify
99
* it under the terms of the GNU General Public License version 2 as
1010
* published by the Free Software Foundation.
1111
*/
1212

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

1616
#define S3C_HCDFLG_USED (1)
1717

drivers/block/ub.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum);
391391
*/
392392
#ifdef CONFIG_USB_LIBUSUAL
393393

394-
#define ub_usb_ids storage_usb_ids
394+
#define ub_usb_ids usb_storage_usb_ids
395395
#else
396396

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

21482148
/* Is it a BULK endpoint? */
2149-
if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
2150-
== USB_ENDPOINT_XFER_BULK) {
2149+
if (usb_endpoint_xfer_bulk(ep)) {
21512150
/* BULK in or out? */
2152-
if (ep->bEndpointAddress & USB_DIR_IN) {
2151+
if (usb_endpoint_dir_in(ep)) {
21532152
if (ep_in == NULL)
21542153
ep_in = ep;
21552154
} else {
@@ -2168,9 +2167,9 @@ static int ub_get_pipes(struct ub_dev *sc, struct usb_device *dev,
21682167
sc->send_ctrl_pipe = usb_sndctrlpipe(dev, 0);
21692168
sc->recv_ctrl_pipe = usb_rcvctrlpipe(dev, 0);
21702169
sc->send_bulk_pipe = usb_sndbulkpipe(dev,
2171-
ep_out->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
2170+
usb_endpoint_num(ep_out));
21722171
sc->recv_bulk_pipe = usb_rcvbulkpipe(dev,
2173-
ep_in->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
2172+
usb_endpoint_num(ep_in));
21742173

21752174
return 0;
21762175
}

drivers/usb/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ obj-$(CONFIG_USB_SL811_HCD) += host/
1919
obj-$(CONFIG_USB_U132_HCD) += host/
2020
obj-$(CONFIG_USB_R8A66597_HCD) += host/
2121
obj-$(CONFIG_USB_HWA_HCD) += host/
22+
obj-$(CONFIG_USB_ISP1760_HCD) += host/
2223

2324
obj-$(CONFIG_USB_C67X00_HCD) += c67x00/
2425

drivers/usb/class/usblp.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -880,16 +880,19 @@ static int usblp_wwait(struct usblp *usblp, int nonblock)
880880
if (rc <= 0)
881881
break;
882882

883-
if (usblp->flags & LP_ABORT) {
884-
if (schedule_timeout(msecs_to_jiffies(5000)) == 0) {
883+
if (schedule_timeout(msecs_to_jiffies(1500)) == 0) {
884+
if (usblp->flags & LP_ABORT) {
885885
err = usblp_check_status(usblp, err);
886886
if (err == 1) { /* Paper out */
887887
rc = -ENOSPC;
888888
break;
889889
}
890+
} else {
891+
/* Prod the printer, Gentoo#251237. */
892+
mutex_lock(&usblp->mut);
893+
usblp_read_status(usblp, usblp->statusbuf);
894+
mutex_unlock(&usblp->mut);
890895
}
891-
} else {
892-
schedule();
893896
}
894897
}
895898
set_current_state(TASK_RUNNING);

drivers/usb/core/devices.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static char *usb_dump_endpoint_descriptor(int speed, char *start, char *end,
187187
}
188188

189189
/* this isn't checking for illegal values */
190-
switch (desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) {
190+
switch (usb_endpoint_type(desc)) {
191191
case USB_ENDPOINT_XFER_CONTROL:
192192
type = "Ctrl";
193193
if (speed == USB_SPEED_HIGH) /* uframes per NAK */

drivers/usb/core/devio.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ MODULE_PARM_DESC(usbfs_snoop, "true to log all usbfs traffic");
104104

105105
#define MAX_USBFS_BUFFER_SIZE 16384
106106

107-
static inline int connected(struct dev_state *ps)
107+
static int connected(struct dev_state *ps)
108108
{
109109
return (!list_empty(&ps->list) &&
110110
ps->dev->state != USB_STATE_NOTATTACHED);
@@ -248,7 +248,7 @@ static void free_async(struct async *as)
248248
kfree(as);
249249
}
250250

251-
static inline void async_newpending(struct async *as)
251+
static void async_newpending(struct async *as)
252252
{
253253
struct dev_state *ps = as->ps;
254254
unsigned long flags;
@@ -258,7 +258,7 @@ static inline void async_newpending(struct async *as)
258258
spin_unlock_irqrestore(&ps->lock, flags);
259259
}
260260

261-
static inline void async_removepending(struct async *as)
261+
static void async_removepending(struct async *as)
262262
{
263263
struct dev_state *ps = as->ps;
264264
unsigned long flags;
@@ -268,7 +268,7 @@ static inline void async_removepending(struct async *as)
268268
spin_unlock_irqrestore(&ps->lock, flags);
269269
}
270270

271-
static inline struct async *async_getcompleted(struct dev_state *ps)
271+
static struct async *async_getcompleted(struct dev_state *ps)
272272
{
273273
unsigned long flags;
274274
struct async *as = NULL;
@@ -283,7 +283,7 @@ static inline struct async *async_getcompleted(struct dev_state *ps)
283283
return as;
284284
}
285285

286-
static inline struct async *async_getpending(struct dev_state *ps,
286+
static struct async *async_getpending(struct dev_state *ps,
287287
void __user *userurb)
288288
{
289289
unsigned long flags;
@@ -302,7 +302,7 @@ static inline struct async *async_getpending(struct dev_state *ps,
302302

303303
static void snoop_urb(struct urb *urb, void __user *userurb)
304304
{
305-
int j;
305+
unsigned j;
306306
unsigned char *data = urb->transfer_buffer;
307307

308308
if (!usbfs_snoop)
@@ -311,9 +311,9 @@ static void snoop_urb(struct urb *urb, void __user *userurb)
311311
dev_info(&urb->dev->dev, "direction=%s\n",
312312
usb_urb_dir_in(urb) ? "IN" : "OUT");
313313
dev_info(&urb->dev->dev, "userurb=%p\n", userurb);
314-
dev_info(&urb->dev->dev, "transfer_buffer_length=%d\n",
314+
dev_info(&urb->dev->dev, "transfer_buffer_length=%u\n",
315315
urb->transfer_buffer_length);
316-
dev_info(&urb->dev->dev, "actual_length=%d\n", urb->actual_length);
316+
dev_info(&urb->dev->dev, "actual_length=%u\n", urb->actual_length);
317317
dev_info(&urb->dev->dev, "data: ");
318318
for (j = 0; j < urb->transfer_buffer_length; ++j)
319319
printk("%02x ", data[j]);
@@ -376,7 +376,7 @@ static void destroy_async_on_interface(struct dev_state *ps,
376376
destroy_async(ps, &hitlist);
377377
}
378378

379-
static inline void destroy_all_async(struct dev_state *ps)
379+
static void destroy_all_async(struct dev_state *ps)
380380
{
381381
destroy_async(ps, &ps->async_pending);
382382
}
@@ -525,7 +525,8 @@ static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype,
525525
{
526526
int ret = 0;
527527

528-
if (ps->dev->state != USB_STATE_ADDRESS
528+
if (ps->dev->state != USB_STATE_UNAUTHENTICATED
529+
&& ps->dev->state != USB_STATE_ADDRESS
529530
&& ps->dev->state != USB_STATE_CONFIGURED)
530531
return -EHOSTUNREACH;
531532
if (USB_TYPE_VENDOR == (USB_TYPE_MASK & requesttype))

drivers/usb/core/endpoint.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static ssize_t show_ep_type(struct device *dev, struct device_attribute *attr,
6666
struct ep_device *ep = to_ep_device(dev);
6767
char *type = "unknown";
6868

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

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

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

134-
if ((ep->desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
135-
USB_ENDPOINT_XFER_CONTROL)
134+
if (usb_endpoint_xfer_control(ep->desc))
136135
direction = "both";
137-
else if (ep->desc->bEndpointAddress & USB_DIR_IN)
136+
else if (usb_endpoint_dir_in(ep->desc))
138137
direction = "in";
139138
else
140139
direction = "out";

drivers/usb/core/hcd.c

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,9 @@ static const u8 hs_rh_config_descriptor [] = {
279279
* helper routine for returning string descriptors in UTF-16LE
280280
* input can actually be ISO-8859-1; ASCII is its 7-bit subset
281281
*/
282-
static int ascii2utf (char *s, u8 *utf, int utfmax)
282+
static unsigned ascii2utf(char *s, u8 *utf, int utfmax)
283283
{
284-
int retval;
284+
unsigned retval;
285285

286286
for (retval = 0; *s && utfmax > 1; utfmax -= 2, retval += 2) {
287287
*utf++ = *s++;
@@ -304,19 +304,15 @@ static int ascii2utf (char *s, u8 *utf, int utfmax)
304304
* Produces either a manufacturer, product or serial number string for the
305305
* virtual root hub device.
306306
*/
307-
static int rh_string (
308-
int id,
309-
struct usb_hcd *hcd,
310-
u8 *data,
311-
int len
312-
) {
307+
static unsigned rh_string(int id, struct usb_hcd *hcd, u8 *data, unsigned len)
308+
{
313309
char buf [100];
314310

315311
// language ids
316312
if (id == 0) {
317313
buf[0] = 4; buf[1] = 3; /* 4 bytes string data */
318314
buf[2] = 0x09; buf[3] = 0x04; /* MSFT-speak for "en-us" */
319-
len = min (len, 4);
315+
len = min_t(unsigned, len, 4);
320316
memcpy (data, buf, len);
321317
return len;
322318

@@ -332,10 +328,7 @@ static int rh_string (
332328
} else if (id == 3) {
333329
snprintf (buf, sizeof buf, "%s %s %s", init_utsname()->sysname,
334330
init_utsname()->release, hcd->driver->description);
335-
336-
// unsupported IDs --> "protocol stall"
337-
} else
338-
return -EPIPE;
331+
}
339332

340333
switch (len) { /* All cases fall through */
341334
default:
@@ -360,9 +353,8 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
360353
u8 tbuf [sizeof (struct usb_hub_descriptor)]
361354
__attribute__((aligned(4)));
362355
const u8 *bufp = tbuf;
363-
int len = 0;
356+
unsigned len = 0;
364357
int status;
365-
int n;
366358
u8 patch_wakeup = 0;
367359
u8 patch_protocol = 0;
368360

@@ -456,10 +448,11 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
456448
patch_wakeup = 1;
457449
break;
458450
case USB_DT_STRING << 8:
459-
n = rh_string (wValue & 0xff, hcd, ubuf, wLength);
460-
if (n < 0)
451+
if ((wValue & 0xff) < 4)
452+
urb->actual_length = rh_string(wValue & 0xff,
453+
hcd, ubuf, wLength);
454+
else /* unsupported IDs --> "protocol stall" */
461455
goto error;
462-
urb->actual_length = n;
463456
break;
464457
default:
465458
goto error;
@@ -629,7 +622,7 @@ static int rh_queue_status (struct usb_hcd *hcd, struct urb *urb)
629622
{
630623
int retval;
631624
unsigned long flags;
632-
int len = 1 + (urb->dev->maxchild / 8);
625+
unsigned len = 1 + (urb->dev->maxchild / 8);
633626

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

902895
mutex_lock(&usb_bus_list_lock);
903896

904-
usb_dev->ep0.desc.wMaxPacketSize = __constant_cpu_to_le16(64);
897+
usb_dev->ep0.desc.wMaxPacketSize = cpu_to_le16(64);
905898
retval = usb_get_device_descriptor(usb_dev, USB_DT_DEVICE_SIZE);
906899
if (retval != sizeof usb_dev->descriptor) {
907900
mutex_unlock(&usb_bus_list_lock);

0 commit comments

Comments
 (0)