Skip to content

Commit

Permalink
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6
Browse files Browse the repository at this point in the history
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6:
  USB: "sparse" cleanups for usb gadgets
  usb-serial: Fix edgeport regression on non-EPiC devices
  USB: more pxa2xx_udc dead code removal
  USB: NIKON D50 is an unusual device
  USB: drivers/usb/serial/sierra.c: make 3 functions static
  USB: fix BUG: sleeping function called from invalid context at /home/jeremy/hg/xen/paravirt/linux/drivers/usb/core/urb.c:524, in_atomic():1, irqs_disabled():0
  USB: mct_u232: Convert to proper speed handling API
  digi_acceleport: Drag the driver kicking and screaming into coding style
  cp2101: Remove broken termios optimisation, use proper speed API
  USB: Fix a bug in usb_start_wait_urb
  USB: fix scatterlist PIO case (IOMMU)
  USB: fix usb_serial_suspend(): buggy code
  USB: yet another quirky device
  USB: Add CanonScan LiDE30 to the quirk list
  USB: even more quirks
  USB: usb.h kernel-doc additions
  USB: more quirky devices
  USB: Don't let usb-storage steal Blackberry Pearl
  USB: devices misc: Trivial patch to build the IOWARRIOR when it is selected in Kconfig
  • Loading branch information
Linus Torvalds committed Jul 30, 2007
2 parents 970e2df + a947522 commit 9f8e35f
Show file tree
Hide file tree
Showing 19 changed files with 577 additions and 712 deletions.
1 change: 1 addition & 0 deletions drivers/usb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ obj-$(CONFIG_USB_SISUSBVGA) += misc/
obj-$(CONFIG_USB_TEST) += misc/
obj-$(CONFIG_USB_TRANCEVIBRATOR)+= misc/
obj-$(CONFIG_USB_USS720) += misc/
obj-$(CONFIG_USB_IOWARRIOR) += misc/

obj-$(CONFIG_USB_ATM) += atm/
obj-$(CONFIG_USB_SPEEDTOUCH) += atm/
41 changes: 27 additions & 14 deletions drivers/usb/core/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,17 @@
#include "hcd.h" /* for usbcore internals */
#include "usb.h"

struct api_context {
struct completion done;
int status;
};

static void usb_api_blocking_completion(struct urb *urb)
{
complete((struct completion *)urb->context);
struct api_context *ctx = urb->context;

ctx->status = urb->status;
complete(&ctx->done);
}


Expand All @@ -32,20 +40,21 @@ static void usb_api_blocking_completion(struct urb *urb)
*/
static int usb_start_wait_urb(struct urb *urb, int timeout, int *actual_length)
{
struct completion done;
struct api_context ctx;
unsigned long expire;
int retval;
int status = urb->status;

init_completion(&done);
urb->context = &done;
init_completion(&ctx.done);
urb->context = &ctx;
urb->actual_length = 0;
retval = usb_submit_urb(urb, GFP_NOIO);
if (unlikely(retval))
goto out;

expire = timeout ? msecs_to_jiffies(timeout) : MAX_SCHEDULE_TIMEOUT;
if (!wait_for_completion_timeout(&done, expire)) {
if (!wait_for_completion_timeout(&ctx.done, expire)) {
usb_kill_urb(urb);
retval = (ctx.status == -ENOENT ? -ETIMEDOUT : ctx.status);

dev_dbg(&urb->dev->dev,
"%s timed out on ep%d%s len=%d/%d\n",
Expand All @@ -54,11 +63,8 @@ static int usb_start_wait_urb(struct urb *urb, int timeout, int *actual_length)
usb_pipein(urb->pipe) ? "in" : "out",
urb->actual_length,
urb->transfer_buffer_length);

usb_kill_urb(urb);
retval = status == -ENOENT ? -ETIMEDOUT : status;
} else
retval = status;
retval = ctx.status;
out:
if (actual_length)
*actual_length = urb->actual_length;
Expand Down Expand Up @@ -411,15 +417,22 @@ int usb_sg_init (
* Some systems need to revert to PIO when DMA is temporarily
* unavailable. For their sakes, both transfer_buffer and
* transfer_dma are set when possible. However this can only
* work on systems without HIGHMEM, since DMA buffers located
* in high memory are not directly addressable by the CPU for
* PIO ... so when HIGHMEM is in use, transfer_buffer is NULL
* work on systems without:
*
* - HIGHMEM, since DMA buffers located in high memory are
* not directly addressable by the CPU for PIO;
*
* - IOMMU, since dma_map_sg() is allowed to use an IOMMU to
* make virtually discontiguous buffers be "dma-contiguous"
* so that PIO and DMA need diferent numbers of URBs.
*
* So when HIGHMEM or IOMMU are in use, transfer_buffer is NULL
* to prevent stale pointers and to help spot bugs.
*/
if (dma) {
io->urbs [i]->transfer_dma = sg_dma_address (sg + i);
len = sg_dma_len (sg + i);
#ifdef CONFIG_HIGHMEM
#if defined(CONFIG_HIGHMEM) || defined(CONFIG_IOMMU)
io->urbs[i]->transfer_buffer = NULL;
#else
io->urbs[i]->transfer_buffer =
Expand Down
22 changes: 22 additions & 0 deletions drivers/usb/core/quirks.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,40 @@
static const struct usb_device_id usb_quirk_list[] = {
/* HP 5300/5370C scanner */
{ USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 },
/* Acer Peripherals Inc. (now BenQ Corp.) Prisa 640BU */
{ USB_DEVICE(0x04a5, 0x207e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Benq S2W 3300U */
{ USB_DEVICE(0x04a5, 0x20b0), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Canon, Inc. CanoScan N1240U/LiDE30 */
{ USB_DEVICE(0x04a9, 0x220e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Canon, Inc. CanoScan N650U/N656U */
{ USB_DEVICE(0x04a9, 0x2206), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Canon, Inc. CanoScan 1220U */
{ USB_DEVICE(0x04a9, 0x2207), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Canon, Inc. CanoScan N670U/N676U/LiDE 20 */
{ USB_DEVICE(0x04a9, 0x220d), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* old Cannon scanner */
{ USB_DEVICE(0x04a9, 0x2220), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Seiko Epson Corp. Perfection 1200 */
{ USB_DEVICE(0x04b8, 0x0104), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Seiko Epson Corp. Perfection 660 */
{ USB_DEVICE(0x04b8, 0x0114), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Epson Perfection 1260 Photo */
{ USB_DEVICE(0x04b8, 0x011d), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Seiko Epson Corp - Perfection 1670 */
{ USB_DEVICE(0x04b8, 0x011f), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* EPSON Perfection 2480 */
{ USB_DEVICE(0x04b8, 0x0121), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Seiko Epson Corp.*/
{ USB_DEVICE(0x04b8, 0x0122), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Samsung ML-2510 Series printer */
{ USB_DEVICE(0x04e8, 0x327e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Elsa MicroLink 56k (V.250) */
{ USB_DEVICE(0x05cc, 0x2267), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Ultima Electronics Corp.*/
{ USB_DEVICE(0x05d8, 0x4005), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Agfa Snapscan1212u */
{ USB_DEVICE(0x06bd, 0x2061), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Umax [hex] Astra 3400U */
{ USB_DEVICE(0x1606, 0x0060), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },

Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ usb_descriptor_fillbuf(void *buf, unsigned buflen,
return -EINVAL;

/* fill buffer from src[] until null descriptor ptr */
for (; 0 != *src; src++) {
for (; NULL != *src; src++) {
unsigned len = (*src)->bLength;

if (len > buflen)
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/epautoconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ ep_matches (
u16 max;

/* endpoint already claimed? */
if (0 != ep->driver_data)
if (NULL != ep->driver_data)
return 0;

/* only support ep0 for portable CONTROL traffic */
Expand Down
3 changes: 2 additions & 1 deletion drivers/usb/gadget/ether.c
Original file line number Diff line number Diff line change
Expand Up @@ -1723,7 +1723,8 @@ rx_submit (struct eth_dev *dev, struct usb_request *req, gfp_t gfp_flags)
size += sizeof (struct rndis_packet_msg_type);
size -= size % dev->out_ep->maxpacket;

if ((skb = alloc_skb (size + NET_IP_ALIGN, gfp_flags)) == 0) {
skb = alloc_skb(size + NET_IP_ALIGN, gfp_flags);
if (skb == NULL) {
DEBUG (dev, "no rx skb\n");
goto enomem;
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/usb/gadget/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ static int setup_req (struct usb_ep *ep, struct usb_request *req, u16 len)
}
if (len > sizeof (dev->rbuf))
req->buf = kmalloc(len, GFP_ATOMIC);
if (req->buf == 0) {
if (req->buf == NULL) {
req->buf = dev->rbuf;
return -ENOMEM;
}
Expand Down Expand Up @@ -1394,7 +1394,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
dev->setup_abort = 0;
if (dev->state == STATE_DEV_UNCONNECTED) {
#ifdef CONFIG_USB_GADGET_DUALSPEED
if (gadget->speed == USB_SPEED_HIGH && dev->hs_config == 0) {
if (gadget->speed == USB_SPEED_HIGH && dev->hs_config == NULL) {
spin_unlock(&dev->lock);
ERROR (dev, "no high speed config??\n");
return -EINVAL;
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/m66592-udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1299,7 +1299,7 @@ static int m66592_queue(struct usb_ep *_ep, struct usb_request *_req,
req->req.actual = 0;
req->req.status = -EINPROGRESS;

if (ep->desc == 0) /* control */
if (ep->desc == NULL) /* control */
start_ep0(ep, req);
else {
if (request && !ep->busy)
Expand Down
30 changes: 0 additions & 30 deletions drivers/usb/gadget/pxa2xx_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ static const char driver_name [] = "pxa2xx_udc";
static const char ep0name [] = "ep0";


// #define DISABLE_TEST_MODE

#ifdef CONFIG_ARCH_IXP4XX

/* cpu-specific register addresses are compiled in to this code */
Expand All @@ -113,17 +111,6 @@ static const char ep0name [] = "ep0";
#define SIZE_STR ""
#endif

#ifdef DISABLE_TEST_MODE
/* (mode == 0) == no undocumented chip tweaks
* (mode & 1) == double buffer bulk IN
* (mode & 2) == double buffer bulk OUT
* ... so mode = 3 (or 7, 15, etc) does it for both
*/
static ushort fifo_mode = 0;
module_param(fifo_mode, ushort, 0);
MODULE_PARM_DESC (fifo_mode, "pxa2xx udc fifo mode");
#endif

/* ---------------------------------------------------------------------------
* endpoint related parts of the api to the usb controller hardware,
* used by gadget driver; and the inner talker-to-hardware core.
Expand Down Expand Up @@ -1252,23 +1239,6 @@ static void udc_enable (struct pxa2xx_udc *dev)
UDC_RES2 = 0x00;
}

#ifdef DISABLE_TEST_MODE
/* "test mode" seems to have become the default in later chip
* revs, preventing double buffering (and invalidating docs).
* this EXPERIMENT enables it for bulk endpoints by tweaking
* undefined/reserved register bits (that other drivers clear).
* Belcarra code comments noted this usage.
*/
if (fifo_mode & 1) { /* IN endpoints */
UDC_RES1 |= USIR0_IR1|USIR0_IR6;
UDC_RES2 |= USIR1_IR11;
}
if (fifo_mode & 2) { /* OUT endpoints */
UDC_RES1 |= USIR0_IR2|USIR0_IR7;
UDC_RES2 |= USIR1_IR12;
}
#endif

/* enable suspend/resume and reset irqs */
udc_clear_mask_UDCCR(UDCCR_SRM | UDCCR_REM);

Expand Down
6 changes: 4 additions & 2 deletions drivers/usb/gadget/zero.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,8 @@ set_source_sink_config (struct zero_dev *dev, gfp_t gfp_flags)
result = usb_ep_enable (ep, d);
if (result == 0) {
ep->driver_data = dev;
if (source_sink_start_ep (ep, gfp_flags) != 0) {
if (source_sink_start_ep(ep, gfp_flags)
!= NULL) {
dev->in_ep = ep;
continue;
}
Expand All @@ -667,7 +668,8 @@ set_source_sink_config (struct zero_dev *dev, gfp_t gfp_flags)
result = usb_ep_enable (ep, d);
if (result == 0) {
ep->driver_data = dev;
if (source_sink_start_ep (ep, gfp_flags) != 0) {
if (source_sink_start_ep(ep, gfp_flags)
!= NULL) {
dev->out_ep = ep;
continue;
}
Expand Down
69 changes: 27 additions & 42 deletions drivers/usb/serial/cp2101.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ static void cp2101_get_termios (struct usb_serial_port *port)

dbg("%s - port %d", __FUNCTION__, port->number);

if ((!port->tty) || (!port->tty->termios)) {
if (!port->tty || !port->tty->termios) {
dbg("%s - no tty structures", __FUNCTION__);
return;
}
Expand Down Expand Up @@ -526,50 +526,35 @@ static void cp2101_set_termios (struct usb_serial_port *port,
return;
}
cflag = port->tty->termios->c_cflag;

/* Check that they really want us to change something */
if (old_termios) {
if ((cflag == old_termios->c_cflag) &&
(RELEVANT_IFLAG(port->tty->termios->c_iflag)
== RELEVANT_IFLAG(old_termios->c_iflag))) {
dbg("%s - nothing to change...", __FUNCTION__);
return;
}

old_cflag = old_termios->c_cflag;
}
old_cflag = old_termios->c_cflag;
baud = tty_get_baud_rate(port->tty);

/* If the baud rate is to be updated*/
if ((cflag & CBAUD) != (old_cflag & CBAUD)) {
switch (cflag & CBAUD) {
/*
* The baud rates which are commented out below
* appear to be supported by the device
* but are non-standard
*/
case B0: baud = 0; break;
case B600: baud = 600; break;
case B1200: baud = 1200; break;
case B1800: baud = 1800; break;
case B2400: baud = 2400; break;
case B4800: baud = 4800; break;
/*case B7200: baud = 7200; break;*/
case B9600: baud = 9600; break;
/*ase B14400: baud = 14400; break;*/
case B19200: baud = 19200; break;
/*case B28800: baud = 28800; break;*/
case B38400: baud = 38400; break;
/*case B55854: baud = 55054; break;*/
case B57600: baud = 57600; break;
case B115200: baud = 115200; break;
/*case B127117: baud = 127117; break;*/
case B230400: baud = 230400; break;
case B460800: baud = 460800; break;
case B921600: baud = 921600; break;
/*case B3686400: baud = 3686400; break;*/
if (baud != tty_termios_baud_rate(old_termios)) {
switch (baud) {
case 0:
case 600:
case 1200:
case 1800:
case 2400:
case 4800:
case 7200:
case 9600:
case 14400:
case 19200:
case 28800:
case 38400:
case 55854:
case 57600:
case 115200:
case 127117:
case 230400:
case 460800:
case 921600:
case 3686400:
break;
default:
dev_err(&port->dev, "cp2101 driver does not "
"support the baudrate requested\n");
baud = 9600;
break;
}

Expand Down
Loading

0 comments on commit 9f8e35f

Please sign in to comment.