Commit 9f8e35fc authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6

* 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
parents 970e2dfa a9475226
...@@ -48,6 +48,7 @@ obj-$(CONFIG_USB_SISUSBVGA) += misc/ ...@@ -48,6 +48,7 @@ obj-$(CONFIG_USB_SISUSBVGA) += misc/
obj-$(CONFIG_USB_TEST) += misc/ obj-$(CONFIG_USB_TEST) += misc/
obj-$(CONFIG_USB_TRANCEVIBRATOR)+= misc/ obj-$(CONFIG_USB_TRANCEVIBRATOR)+= misc/
obj-$(CONFIG_USB_USS720) += misc/ obj-$(CONFIG_USB_USS720) += misc/
obj-$(CONFIG_USB_IOWARRIOR) += misc/
obj-$(CONFIG_USB_ATM) += atm/ obj-$(CONFIG_USB_ATM) += atm/
obj-$(CONFIG_USB_SPEEDTOUCH) += atm/ obj-$(CONFIG_USB_SPEEDTOUCH) += atm/
...@@ -18,9 +18,17 @@ ...@@ -18,9 +18,17 @@
#include "hcd.h" /* for usbcore internals */ #include "hcd.h" /* for usbcore internals */
#include "usb.h" #include "usb.h"
struct api_context {
struct completion done;
int status;
};
static void usb_api_blocking_completion(struct urb *urb) 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);
} }
...@@ -32,20 +40,21 @@ static void usb_api_blocking_completion(struct urb *urb) ...@@ -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) static int usb_start_wait_urb(struct urb *urb, int timeout, int *actual_length)
{ {
struct completion done; struct api_context ctx;
unsigned long expire; unsigned long expire;
int retval; int retval;
int status = urb->status;
init_completion(&done); init_completion(&ctx.done);
urb->context = &done; urb->context = &ctx;
urb->actual_length = 0; urb->actual_length = 0;
retval = usb_submit_urb(urb, GFP_NOIO); retval = usb_submit_urb(urb, GFP_NOIO);
if (unlikely(retval)) if (unlikely(retval))
goto out; goto out;
expire = timeout ? msecs_to_jiffies(timeout) : MAX_SCHEDULE_TIMEOUT; 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, dev_dbg(&urb->dev->dev,
"%s timed out on ep%d%s len=%d/%d\n", "%s timed out on ep%d%s len=%d/%d\n",
...@@ -54,11 +63,8 @@ static int usb_start_wait_urb(struct urb *urb, int timeout, int *actual_length) ...@@ -54,11 +63,8 @@ static int usb_start_wait_urb(struct urb *urb, int timeout, int *actual_length)
usb_pipein(urb->pipe) ? "in" : "out", usb_pipein(urb->pipe) ? "in" : "out",
urb->actual_length, urb->actual_length,
urb->transfer_buffer_length); urb->transfer_buffer_length);
usb_kill_urb(urb);
retval = status == -ENOENT ? -ETIMEDOUT : status;
} else } else
retval = status; retval = ctx.status;
out: out:
if (actual_length) if (actual_length)
*actual_length = urb->actual_length; *actual_length = urb->actual_length;
...@@ -411,15 +417,22 @@ int usb_sg_init ( ...@@ -411,15 +417,22 @@ int usb_sg_init (
* Some systems need to revert to PIO when DMA is temporarily * Some systems need to revert to PIO when DMA is temporarily
* unavailable. For their sakes, both transfer_buffer and * unavailable. For their sakes, both transfer_buffer and
* transfer_dma are set when possible. However this can only * transfer_dma are set when possible. However this can only
* work on systems without HIGHMEM, since DMA buffers located * work on systems without:
* in high memory are not directly addressable by the CPU for *
* PIO ... so when HIGHMEM is in use, transfer_buffer is NULL * - 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. * to prevent stale pointers and to help spot bugs.
*/ */
if (dma) { if (dma) {
io->urbs [i]->transfer_dma = sg_dma_address (sg + i); io->urbs [i]->transfer_dma = sg_dma_address (sg + i);
len = sg_dma_len (sg + i); len = sg_dma_len (sg + i);
#ifdef CONFIG_HIGHMEM #if defined(CONFIG_HIGHMEM) || defined(CONFIG_IOMMU)
io->urbs[i]->transfer_buffer = NULL; io->urbs[i]->transfer_buffer = NULL;
#else #else
io->urbs[i]->transfer_buffer = io->urbs[i]->transfer_buffer =
......
...@@ -30,18 +30,40 @@ ...@@ -30,18 +30,40 @@
static const struct usb_device_id usb_quirk_list[] = { static const struct usb_device_id usb_quirk_list[] = {
/* HP 5300/5370C scanner */ /* HP 5300/5370C scanner */
{ USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 }, { 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 */ /* Benq S2W 3300U */
{ USB_DEVICE(0x04a5, 0x20b0), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, { 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 */ /* Seiko Epson Corp. Perfection 1200 */
{ USB_DEVICE(0x04b8, 0x0104), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, { 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 */ /* Seiko Epson Corp - Perfection 1670 */
{ USB_DEVICE(0x04b8, 0x011f), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, { 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 */ /* Samsung ML-2510 Series printer */
{ USB_DEVICE(0x04e8, 0x327e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, { USB_DEVICE(0x04e8, 0x327e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Elsa MicroLink 56k (V.250) */ /* Elsa MicroLink 56k (V.250) */
{ USB_DEVICE(0x05cc, 0x2267), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, { USB_DEVICE(0x05cc, 0x2267), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Ultima Electronics Corp.*/ /* Ultima Electronics Corp.*/
{ USB_DEVICE(0x05d8, 0x4005), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, { 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 */ /* Umax [hex] Astra 3400U */
{ USB_DEVICE(0x1606, 0x0060), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, { USB_DEVICE(0x1606, 0x0060), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
......
...@@ -50,7 +50,7 @@ usb_descriptor_fillbuf(void *buf, unsigned buflen, ...@@ -50,7 +50,7 @@ usb_descriptor_fillbuf(void *buf, unsigned buflen,
return -EINVAL; return -EINVAL;
/* fill buffer from src[] until null descriptor ptr */ /* fill buffer from src[] until null descriptor ptr */
for (; 0 != *src; src++) { for (; NULL != *src; src++) {
unsigned len = (*src)->bLength; unsigned len = (*src)->bLength;
if (len > buflen) if (len > buflen)
......
...@@ -71,7 +71,7 @@ ep_matches ( ...@@ -71,7 +71,7 @@ ep_matches (
u16 max; u16 max;
/* endpoint already claimed? */ /* endpoint already claimed? */
if (0 != ep->driver_data) if (NULL != ep->driver_data)
return 0; return 0;
/* only support ep0 for portable CONTROL traffic */ /* only support ep0 for portable CONTROL traffic */
......
...@@ -1723,7 +1723,8 @@ rx_submit (struct eth_dev *dev, struct usb_request *req, gfp_t gfp_flags) ...@@ -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 += sizeof (struct rndis_packet_msg_type);
size -= size % dev->out_ep->maxpacket; 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"); DEBUG (dev, "no rx skb\n");
goto enomem; goto enomem;
} }
......
...@@ -964,7 +964,7 @@ static int setup_req (struct usb_ep *ep, struct usb_request *req, u16 len) ...@@ -964,7 +964,7 @@ static int setup_req (struct usb_ep *ep, struct usb_request *req, u16 len)
} }
if (len > sizeof (dev->rbuf)) if (len > sizeof (dev->rbuf))
req->buf = kmalloc(len, GFP_ATOMIC); req->buf = kmalloc(len, GFP_ATOMIC);
if (req->buf == 0) { if (req->buf == NULL) {
req->buf = dev->rbuf; req->buf = dev->rbuf;
return -ENOMEM; return -ENOMEM;
} }
...@@ -1394,7 +1394,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) ...@@ -1394,7 +1394,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
dev->setup_abort = 0; dev->setup_abort = 0;
if (dev->state == STATE_DEV_UNCONNECTED) { if (dev->state == STATE_DEV_UNCONNECTED) {
#ifdef CONFIG_USB_GADGET_DUALSPEED #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); spin_unlock(&dev->lock);
ERROR (dev, "no high speed config??\n"); ERROR (dev, "no high speed config??\n");
return -EINVAL; return -EINVAL;
......
...@@ -1299,7 +1299,7 @@ static int m66592_queue(struct usb_ep *_ep, struct usb_request *_req, ...@@ -1299,7 +1299,7 @@ static int m66592_queue(struct usb_ep *_ep, struct usb_request *_req,
req->req.actual = 0; req->req.actual = 0;
req->req.status = -EINPROGRESS; req->req.status = -EINPROGRESS;
if (ep->desc == 0) /* control */ if (ep->desc == NULL) /* control */
start_ep0(ep, req); start_ep0(ep, req);
else { else {
if (request && !ep->busy) if (request && !ep->busy)
......
...@@ -93,8 +93,6 @@ static const char driver_name [] = "pxa2xx_udc"; ...@@ -93,8 +93,6 @@ static const char driver_name [] = "pxa2xx_udc";
static const char ep0name [] = "ep0"; static const char ep0name [] = "ep0";
// #define DISABLE_TEST_MODE
#ifdef CONFIG_ARCH_IXP4XX #ifdef CONFIG_ARCH_IXP4XX
/* cpu-specific register addresses are compiled in to this code */ /* cpu-specific register addresses are compiled in to this code */
...@@ -113,17 +111,6 @@ static const char ep0name [] = "ep0"; ...@@ -113,17 +111,6 @@ static const char ep0name [] = "ep0";
#define SIZE_STR "" #define SIZE_STR ""
#endif #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, * endpoint related parts of the api to the usb controller hardware,
* used by gadget driver; and the inner talker-to-hardware core. * used by gadget driver; and the inner talker-to-hardware core.
...@@ -1252,23 +1239,6 @@ static void udc_enable (struct pxa2xx_udc *dev) ...@@ -1252,23 +1239,6 @@ static void udc_enable (struct pxa2xx_udc *dev)
UDC_RES2 = 0x00; 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 */ /* enable suspend/resume and reset irqs */
udc_clear_mask_UDCCR(UDCCR_SRM | UDCCR_REM); udc_clear_mask_UDCCR(UDCCR_SRM | UDCCR_REM);
......
...@@ -653,7 +653,8 @@ set_source_sink_config (struct zero_dev *dev, gfp_t gfp_flags) ...@@ -653,7 +653,8 @@ set_source_sink_config (struct zero_dev *dev, gfp_t gfp_flags)
result = usb_ep_enable (ep, d); result = usb_ep_enable (ep, d);
if (result == 0) { if (result == 0) {
ep->driver_data = dev; 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; dev->in_ep = ep;
continue; continue;
} }
...@@ -667,7 +668,8 @@ set_source_sink_config (struct zero_dev *dev, gfp_t gfp_flags) ...@@ -667,7 +668,8 @@ set_source_sink_config (struct zero_dev *dev, gfp_t gfp_flags)
result = usb_ep_enable (ep, d); result = usb_ep_enable (ep, d);
if (result == 0) { if (result == 0) {
ep->driver_data = dev; 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; dev->out_ep = ep;
continue; continue;
} }
......
...@@ -356,7 +356,7 @@ static void cp2101_get_termios (struct usb_serial_port *port) ...@@ -356,7 +356,7 @@ static void cp2101_get_termios (struct usb_serial_port *port)
dbg("%s - port %d", __FUNCTION__, port->number); 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__); dbg("%s - no tty structures", __FUNCTION__);
return; return;
} }
...@@ -526,50 +526,35 @@ static void cp2101_set_termios (struct usb_serial_port *port, ...@@ -526,50 +526,35 @@ static void cp2101_set_termios (struct usb_serial_port *port,
return; return;
} }
cflag = port->tty->termios->c_cflag; cflag = port->tty->termios->c_cflag;
old_cflag = old_termios->c_cflag;
/* Check that they really want us to change something */ baud = tty_get_baud_rate(port->tty);
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;
}
/* If the baud rate is to be updated*/ /* If the baud rate is to be updated*/
if ((cflag & CBAUD) != (old_cflag & CBAUD)) { if (baud != tty_termios_baud_rate(old_termios)) {
switch (cflag & CBAUD) { switch (baud) {
/* case 0:
* The baud rates which are commented out below case 600:
* appear to be supported by the device case 1200:
* but are non-standard case 1800:
*/ case 2400:
case B0: baud = 0; break; case 4800:
case B600: baud = 600; break; case 7200:
case B1200: baud = 1200; break; case 9600:
case B1800: baud = 1800; break; case 14400:
case B2400: baud = 2400; break; case 19200:
case B4800: baud = 4800; break; case 28800:
/*case B7200: baud = 7200; break;*/ case 38400:
case B9600: baud = 9600; break; case 55854:
/*ase B14400: baud = 14400; break;*/ case 57600:
case B19200: baud = 19200; break; case 115200:
/*case B28800: baud = 28800; break;*/ case 127117:
case B38400: baud = 38400; break; case 230400:
/*case B55854: baud = 55054; break;*/ case 460800:
case B57600: baud = 57600; break; case 921600:
case B115200: baud = 115200; break; case 3686400:
/*case B127117: baud = 127117; break;*/ break;
case B230400: baud = 230400; break;
case B460800: baud = 460800; break;
case B921600: baud = 921600; break;
/*case B3686400: baud = 3686400; break;*/
default: default:
dev_err(&port->dev, "cp2101 driver does not " baud = 9600;
"support the baudrate requested\n");
break; break;
} }
......
This diff is collapsed.
...@@ -2366,9 +2366,8 @@ static int send_cmd_write_baud_rate (struct edgeport_port *edge_port, int baudRa ...@@ -2366,9 +2366,8 @@ static int send_cmd_write_baud_rate (struct edgeport_port *edge_port, int baudRa
int status; int status;
unsigned char number = edge_port->port->number - edge_port->port->serial->minor; unsigned char number = edge_port->port->number - edge_port->port->serial->minor;
if ((!edge_serial->is_epic) || if (edge_serial->is_epic &&
((edge_serial->is_epic) && !edge_serial->epic_descriptor.Supports.IOSPSetBaudRate) {
(!edge_serial->epic_descriptor.Supports.IOSPSetBaudRate))) {
dbg("SendCmdWriteBaudRate - NOT Setting baud rate for port = %d, baud = %d", dbg("SendCmdWriteBaudRate - NOT Setting baud rate for port = %d, baud = %d",
edge_port->port->number, baudRate); edge_port->port->number, baudRate);
return 0; return 0;
...@@ -2461,18 +2460,16 @@ static int send_cmd_write_uart_register (struct edgeport_port *edge_port, __u8 r ...@@ -2461,18 +2460,16 @@ static int send_cmd_write_uart_register (struct edgeport_port *edge_port, __u8 r
dbg("%s - write to %s register 0x%02x", (regNum == MCR) ? "MCR" : "LCR", __FUNCTION__, regValue); dbg("%s - write to %s register 0x%02x", (regNum == MCR) ? "MCR" : "LCR", __FUNCTION__, regValue);
if ((!edge_serial->is_epic) || if (edge_serial->is_epic &&
((edge_serial->is_epic) && !edge_serial->epic_descriptor.Supports.IOSPWriteMCR &&
(!edge_serial->epic_descriptor.Supports.IOSPWriteMCR) && regNum == MCR) {
(regNum == MCR))) {
dbg("SendCmdWriteUartReg - Not writing to MCR Register"); dbg("SendCmdWriteUartReg - Not writing to MCR Register");
return 0; return 0;
} }
if ((!edge_serial->is_epic) || if (edge_serial->is_epic &&
((edge_serial->is_epic) && !edge_serial->epic_descriptor.Supports.IOSPWriteLCR &&
(!edge_serial->epic_descriptor.Supports.IOSPWriteLCR) && regNum == LCR) {
(regNum == LCR))) {
dbg ("SendCmdWriteUartReg - Not writing to LCR Register"); dbg ("SendCmdWriteUartReg - Not writing to LCR Register");
return 0; return 0;
} }
......
...@@ -184,21 +184,21 @@ struct mct_u232_private { ...@@ -184,21 +184,21 @@ struct mct_u232_private {
* we do not know how to support. We ignore them for the moment. * we do not know how to support. We ignore them for the moment.
* XXX Rate-limit the error message, it's user triggerable. * XXX Rate-limit the error message, it's user triggerable.
*/ */
static int mct_u232_calculate_baud_rate(struct usb_serial *serial, int value) static int mct_u232_calculate_baud_rate(struct usb_serial *serial, speed_t value)
{ {
if (le16_to_cpu(serial->dev->descriptor.idProduct) == MCT_U232_SITECOM_PID if (le16_to_cpu(serial->dev->descriptor.idProduct) == MCT_U232_SITECOM_PID
|| le16_to_cpu(serial->dev->descriptor.idProduct) == MCT_U232_BELKIN_F5U109_PID) { || le16_to_cpu(serial->dev->descriptor.idProduct) == MCT_U232_BELKIN_F5U109_PID) {
switch (value) { switch (value) {
case B300: return 0x01; case 300: return 0x01;
case B600: return 0x02; /* this one not tested */ case 600: return 0x02; /* this one not tested */
case B1200: return 0x03; case 1200: return 0x03;
case B2400: return 0x04; case 2400: return 0x04;
case B4800: return 0x06; case 4800: return 0x06;
case B9600: return 0x08; case 9600: return 0x08;
case B19200: return 0x09; case 19200: return 0x09;
case B38400: return 0x0a; case 38400: return 0x0a;
case B57600: return 0x0b; case 57600: return 0x0b;
case B115200: return 0x0c; case 115200: return 0x0c;
default: default:
err("MCT USB-RS232: unsupported baudrate request 0x%x," err("MCT USB-RS232: unsupported baudrate request 0x%x,"
" using default of B9600", value); " using default of B9600", value);
...@@ -206,27 +206,27 @@ static int mct_u232_calculate_baud_rate(struct usb_serial *serial, int value) ...@@ -206,27 +206,27 @@ static int mct_u232_calculate_baud_rate(struct usb_serial *serial, int value)
} }
} else { } else {
switch (value) { switch (value) {
case B300: value = 300; break; case 300: break;
case B600: value = 600; break; case 600: break;
case B1200: value = 1200; break; case 1200: break;
case B2400: value = 2400; break; case 2400: break;
case B4800: value = 4800; break; case 4800: break;
case B9600: value = 9600; break; case 9600: break;
case B19200: value = 19200; break; case 19200: break;
case B38400: value = 38400; break; case 38400: break;
case B57600: value = 57600; break; case 57600: break;
case B115200: value = 115200; break; case 115200: break;
default: default:
err("MCT USB-RS232: unsupported baudrate request 0x%x," err("MCT USB-RS232: unsupported baudrate request 0x%x,"
" using default of B9600", value); " using default of B9600", value);
value = 9600; value = 9600;
} }
return 115200/value; return 115200/value;
} }
} }
static int mct_u232_set_baud_rate(struct usb_serial *serial, struct usb_serial_port *port, static int mct_u232_set_baud_rate(struct usb_serial *serial, struct usb_serial_port *port,
int value) speed_t value)
{ {
__le32 divisor; __le32 divisor;
int rc; int rc;
...@@ -634,7 +634,7 @@ static void mct_u232_set_termios (struct usb_serial_port *port, ...@@ -634,7 +634,7 @@ static void mct_u232_set_termios (struct usb_serial_port *port,
mct_u232_set_modem_ctrl(serial, control_state); mct_u232_set_modem_ctrl(serial, control_state);
} }
mct_u232_set_baud_rate(serial, port, cflag & CBAUD); mct_u232_set_baud_rate(serial, port, tty_get_baud_rate(port->tty));
if ((cflag & CBAUD) == B0 ) { if ((cflag & CBAUD) == B0 ) {
dbg("%s: baud is B0", __FUNCTION__); dbg("%s: baud is B0", __FUNCTION__);
......
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
* and "Intel solution". They are the regular MCT and "Sitecom" for us. * and "Intel solution". They are the regular MCT and "Sitecom" for us.
* This is pointless to document in the header, see the code for the bits. * This is pointless to document in the header, see the code for the bits.
*/ */
static int mct_u232_calculate_baud_rate(struct usb_serial *serial, int value); static int mct_u232_calculate_baud_rate(struct usb_serial *serial, speed_t value);
/* /*
* Line Control Register (LCR) * Line Control Register (LCR)
......
...@@ -45,7 +45,7 @@ enum devicetype { ...@@ -45,7 +45,7 @@ enum devicetype {
DEVICE_INSTALLER = 2, DEVICE_INSTALLER = 2,
}; };
int sierra_set_power_state(struct usb_device *udev, __u16 swiState) static int sierra_set_power_state(struct usb_device *udev, __u16 swiState)
{ {
int result; int result;
dev_dbg(&udev->dev, "%s", "SET POWER STATE"); dev_dbg(&udev->dev, "%s", "SET POWER STATE");
...@@ -60,7 +60,7 @@ int sierra_set_power_state(struct usb_device *udev, __u16 swiState) ...@@ -60,7 +60,7 @@ int sierra_set_power_state(struct usb_device *udev, __u16 swiState)
return result; return result;
} }
int sierra_set_ms_mode(struct usb_device *udev, __u16 eSocMode) static int sierra_set_ms_mode(struct usb_device *udev, __u16 eSocMode)
{ {
int result; int result;
dev_dbg(&udev->dev, "%s", "DEVICE MODE SWITCH"); dev_dbg(&udev->dev, "%s", "DEVICE MODE SWITCH");
...@@ -75,7 +75,8 @@ int sierra_set_ms_mode(struct usb_device *udev, __u16 eSocMode) ...@@ -75,7 +75,8 @@ int sierra_set_ms_mode(struct usb_device *udev, __u16 eSocMode)
return result; return result;
} }
int sierra_probe(struct usb_interface *iface, const struct usb_device_id *id) static int sierra_probe(struct usb_interface *iface,
const struct usb_device_id *id)
{ {
int result; int result;
struct usb_device *udev; struct usb_device *udev;
......
...@@ -60,19 +60,19 @@ static struct usb_driver usb_serial_driver = { ...@@ -60,19 +60,19 @@ static struct usb_driver usb_serial_driver = {
static int debug; static int debug;
static struct usb_serial *serial_table[SERIAL_TTY_MINORS]; /* initially all NULL */ static struct usb_serial *serial_table[SERIAL_TTY_MINORS]; /* initially all NULL */
static spinlock_t table_lock; static DEFINE_MUTEX(table_lock);
static LIST_HEAD(usb_serial_driver_list); static LIST_HEAD(usb_serial_driver_list);
struct usb_serial *usb_serial_get_by_index(unsigned index) struct usb_serial *usb_serial_get_by_index(unsigned index)
{ {
struct usb_serial *serial; struct usb_serial *serial;
spin_lock(&table_lock); mutex_lock(&table_lock);
serial = serial_table[index]; serial = serial_table[index];
if (serial) if (serial)
kref_get(&serial->kref); kref_get(&serial->kref);
spin_unlock(&table_lock); mutex_unlock(&table_lock);
return serial; return serial;
} }
...@@ -84,7 +84,7 @@ static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_po ...@@ -84,7 +84,7 @@ static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_po
dbg("%s %d", __FUNCTION__, num_ports); dbg("%s %d", __FUNCTION__, num_ports);
*minor = 0; *minor = 0;
spin_lock(&table_lock); mutex_lock(&table_lock);
for (i = 0; i < SERIAL_TTY_MINORS; ++i) { for (i = 0; i < SERIAL_TTY_MINORS; ++i) {
if (serial_table[i]) if (serial_table[i])
continue; continue;
...@@ -106,10 +106,10 @@ static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_po ...@@ -106,10 +106,10 @@ static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_po
serial_table[i] = serial; serial_table[i] = serial;
serial->port[j++]->number = i; serial->port[j++]->number = i;
} }
spin_unlock(&table_lock); mutex_unlock(&table_lock);
return serial; return serial;
} }
spin_unlock(&table_lock); mutex_unlock(&table_lock);
return NULL; return NULL;
} }
...@@ -172,9 +172,9 @@ static void destroy_serial(struct kref *kref) ...@@ -172,9 +172,9 @@ static void destroy_serial(struct kref *kref)
void usb_serial_put(struct usb_serial *serial) void usb_serial_put(struct usb_serial *serial)
{ {
spin_lock(&table_lock); mutex_lock(&table_lock);
kref_put(&serial->kref, destroy_serial); kref_put(&serial->kref, destroy_serial);
spin_unlock(&table_lock); mutex_unlock(&table_lock);
} }
/***************************************************************************** /*****************************************************************************
...@@ -1077,16 +1077,17 @@ int usb_serial_suspend(struct usb_interface *intf, pm_message_t message) ...@@ -1077,16 +1077,17 @@ int usb_serial_suspend(struct usb_interface *intf, pm_message_t message)
struct usb_serial_port *port; struct usb_serial_port *port;
int i, r = 0; int i, r = 0;
if (serial) { if (!serial) /* device has been disconnected */
for (i = 0; i < serial->num_ports; ++i) { return 0;
port = serial->port[i];
if (port) for (i = 0; i < serial->num_ports; ++i) {
kill_traffic(port); port = serial->port[i];
} if (port)
kill_traffic(port);
} }
if (serial->type->suspend) if (serial->type->suspend)
serial->type->suspend(serial, message); r = serial->type->suspend(serial, message);
return r; return r;
} }
...@@ -1128,7 +1129,6 @@ static int __init usb_serial_init(void) ...@@ -1128,7 +1129,6 @@ static int __init usb_serial_init(void)
return -ENOMEM; return -ENOMEM;
/* Initialize our global data */ /* Initialize our global data */
spin_lock_init(&table_lock);
for (i = 0; i < SERIAL_TTY_MINORS; ++i) { for (i = 0; i < SERIAL_TTY_MINORS; ++i) {
serial_table[i] = NULL; serial_table[i] = NULL;
} }
......
...@@ -320,6 +320,13 @@ UNUSUAL_DEV( 0x04b0, 0x0401, 0x0200, 0x0200, ...@@ -320,6 +320,13 @@ UNUSUAL_DEV( 0x04b0, 0x0401, 0x0200, 0x0200,
US_SC_DEVICE, US_PR_DEVICE, NULL, US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY), US_FL_FIX_CAPACITY),
/* Reported by Milinevsky Dmitry <niam.niam@gmail.com> */
UNUSUAL_DEV( 0x04b0, 0x0409, 0x0100, 0x0100,
"NIKON",
"NIKON DSC D50",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY),
/* Reported by Andreas Bockhold <andreas@bockionline.de> */ /* Reported by Andreas Bockhold <andreas@bockionline.de> */
UNUSUAL_DEV( 0x04b0, 0x0405, 0x0100, 0x0100, UNUSUAL_DEV( 0x04b0, 0x0405, 0x0100, 0x0100,
"NIKON", "NIKON",
...@@ -1357,6 +1364,20 @@ UNUSUAL_DEV( 0x0f19, 0x0105, 0x0100, 0x0100, ...@@ -1357,6 +1364,20 @@ UNUSUAL_DEV( 0x0f19, 0x0105, 0x0100, 0x0100,
US_SC_DEVICE, US_PR_DEVICE, NULL, US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_IGNORE_RESIDUE ), US_FL_IGNORE_RESIDUE ),
/* Jeremy Katz <katzj@redhat.com>:
* The Blackberry Pearl can run in two modes; a usb-storage only mode
* and a mode that allows access via mass storage and to its database.
* The berry_charge module will set the device to dual mode and thus we
* should ignore its native mode if that module is built
*/
#ifdef CONFIG_USB_BERRY_CHARGE
UNUSUAL_DEV( 0x0fca, 0x0006, 0x0001, 0x0001,
"RIM",
"Blackberry Pearl",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_IGNORE_DEVICE ),
#endif
/* Reported by Michael Stattmann <michael@stattmann.com> */ /* Reported by Michael Stattmann <michael@stattmann.com> */
UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000, UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000,
"Sony Ericsson", "Sony Ericsson",
......
...@@ -94,6 +94,7 @@ enum usb_interface_condition { ...@@ -94,6 +94,7 @@ enum usb_interface_condition {
* endpoint configurations. They will be in no particular order. * endpoint configurations. They will be in no particular order.
* @num_altsetting: number of altsettings defined. * @num_altsetting: number of altsettings defined.
* @cur_altsetting: the current altsetting. * @cur_altsetting: the current altsetting.
* @intf_assoc: interface association descriptor
* @driver: the USB driver that is bound to this interface. * @driver: the USB driver that is bound to this interface.
* @minor: the minor number assigned to this interface, if this * @minor: the minor number assigned to this interface, if this
* interface is bound to a driver that uses the USB major number. * interface is bound to a driver that uses the USB major number.
...@@ -213,6 +214,7 @@ struct usb_interface_cache { ...@@ -213,6 +214,7 @@ struct usb_interface_cache {
* @desc: the device's configuration descriptor. * @desc: the device's configuration descriptor.
* @string: pointer to the cached version of the iConfiguration string, if * @string: pointer to the cached version of the iConfiguration string, if
* present for this configuration. * present for this configuration.
* @intf_assoc: list of any interface association descriptors in this config
* @interface: array of pointers to usb_interface structures, one for each * @interface: array of pointers to usb_interface structures, one for each
* interface in the configuration. The number of interfaces is stored * interface in the configuration. The number of interfaces is stored
* in desc.bNumInterfaces. These pointers are valid only while the * in desc.bNumInterfaces. These pointers are valid only while the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment