diff options
| author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-30 19:34:00 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-30 19:34:00 -0400 |
| commit | 9f8e35fc0c1d96e5383eca5f0c7c963a9fadef57 (patch) | |
| tree | 86a0f4606209b21a1ba2c33c61472127a9bfe170 | |
| parent | 970e2dfa672b5b26967b0983e24b8d92f972c907 (diff) | |
| parent | a9475226977917afd5a85621f8a3d7f380a9da31 (diff) | |
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
| -rw-r--r-- | drivers/usb/Makefile | 1 | ||||
| -rw-r--r-- | drivers/usb/core/message.c | 41 | ||||
| -rw-r--r-- | drivers/usb/core/quirks.c | 22 | ||||
| -rw-r--r-- | drivers/usb/gadget/config.c | 2 | ||||
| -rw-r--r-- | drivers/usb/gadget/epautoconf.c | 2 | ||||
| -rw-r--r-- | drivers/usb/gadget/ether.c | 3 | ||||
| -rw-r--r-- | drivers/usb/gadget/inode.c | 4 | ||||
| -rw-r--r-- | drivers/usb/gadget/m66592-udc.c | 2 | ||||
| -rw-r--r-- | drivers/usb/gadget/pxa2xx_udc.c | 30 | ||||
| -rw-r--r-- | drivers/usb/gadget/zero.c | 6 | ||||
| -rw-r--r-- | drivers/usb/serial/cp2101.c | 69 | ||||
| -rw-r--r-- | drivers/usb/serial/digi_acceleport.c | 970 | ||||
| -rw-r--r-- | drivers/usb/serial/io_edgeport.c | 19 | ||||
| -rw-r--r-- | drivers/usb/serial/mct_u232.c | 54 | ||||
| -rw-r--r-- | drivers/usb/serial/mct_u232.h | 2 | ||||
| -rw-r--r-- | drivers/usb/serial/sierra.c | 7 | ||||
| -rw-r--r-- | drivers/usb/serial/usb-serial.c | 32 | ||||
| -rw-r--r-- | drivers/usb/storage/unusual_devs.h | 21 | ||||
| -rw-r--r-- | include/linux/usb.h | 2 |
19 files changed, 577 insertions, 712 deletions
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile index befff5f9d58c..ac49b15fa768 100644 --- a/drivers/usb/Makefile +++ b/drivers/usb/Makefile | |||
| @@ -48,6 +48,7 @@ obj-$(CONFIG_USB_SISUSBVGA) += misc/ | |||
| 48 | obj-$(CONFIG_USB_TEST) += misc/ | 48 | obj-$(CONFIG_USB_TEST) += misc/ |
| 49 | obj-$(CONFIG_USB_TRANCEVIBRATOR)+= misc/ | 49 | obj-$(CONFIG_USB_TRANCEVIBRATOR)+= misc/ |
| 50 | obj-$(CONFIG_USB_USS720) += misc/ | 50 | obj-$(CONFIG_USB_USS720) += misc/ |
| 51 | obj-$(CONFIG_USB_IOWARRIOR) += misc/ | ||
| 51 | 52 | ||
| 52 | obj-$(CONFIG_USB_ATM) += atm/ | 53 | obj-$(CONFIG_USB_ATM) += atm/ |
| 53 | obj-$(CONFIG_USB_SPEEDTOUCH) += atm/ | 54 | obj-$(CONFIG_USB_SPEEDTOUCH) += atm/ |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 25f63f1096b4..b6bd05e3d439 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
| @@ -18,9 +18,17 @@ | |||
| 18 | #include "hcd.h" /* for usbcore internals */ | 18 | #include "hcd.h" /* for usbcore internals */ |
| 19 | #include "usb.h" | 19 | #include "usb.h" |
| 20 | 20 | ||
| 21 | struct api_context { | ||
| 22 | struct completion done; | ||
| 23 | int status; | ||
| 24 | }; | ||
| 25 | |||
| 21 | static void usb_api_blocking_completion(struct urb *urb) | 26 | static void usb_api_blocking_completion(struct urb *urb) |
| 22 | { | 27 | { |
| 23 | complete((struct completion *)urb->context); | 28 | struct api_context *ctx = urb->context; |
| 29 | |||
| 30 | ctx->status = urb->status; | ||
| 31 | complete(&ctx->done); | ||
| 24 | } | 32 | } |
| 25 | 33 | ||
| 26 | 34 | ||
| @@ -32,20 +40,21 @@ static void usb_api_blocking_completion(struct urb *urb) | |||
| 32 | */ | 40 | */ |
| 33 | static int usb_start_wait_urb(struct urb *urb, int timeout, int *actual_length) | 41 | static int usb_start_wait_urb(struct urb *urb, int timeout, int *actual_length) |
| 34 | { | 42 | { |
| 35 | struct completion done; | 43 | struct api_context ctx; |
| 36 | unsigned long expire; | 44 | unsigned long expire; |
| 37 | int retval; | 45 | int retval; |
| 38 | int status = urb->status; | ||
| 39 | 46 | ||
| 40 | init_completion(&done); | 47 | init_completion(&ctx.done); |
| 41 | urb->context = &done; | 48 | urb->context = &ctx; |
| 42 | urb->actual_length = 0; | 49 | urb->actual_length = 0; |
| 43 | retval = usb_submit_urb(urb, GFP_NOIO); | 50 | retval = usb_submit_urb(urb, GFP_NOIO); |
| 44 | if (unlikely(retval)) | 51 | if (unlikely(retval)) |
| 45 | goto out; | 52 | goto out; |
| 46 | 53 | ||
| 47 | expire = timeout ? msecs_to_jiffies(timeout) : MAX_SCHEDULE_TIMEOUT; | 54 | expire = timeout ? msecs_to_jiffies(timeout) : MAX_SCHEDULE_TIMEOUT; |
| 48 | if (!wait_for_completion_timeout(&done, expire)) { | 55 | if (!wait_for_completion_timeout(&ctx.done, expire)) { |
| 56 | usb_kill_urb(urb); | ||
| 57 | retval = (ctx.status == -ENOENT ? -ETIMEDOUT : ctx.status); | ||
| 49 | 58 | ||
| 50 | dev_dbg(&urb->dev->dev, | 59 | dev_dbg(&urb->dev->dev, |
| 51 | "%s timed out on ep%d%s len=%d/%d\n", | 60 | "%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 | usb_pipein(urb->pipe) ? "in" : "out", | 63 | usb_pipein(urb->pipe) ? "in" : "out", |
| 55 | urb->actual_length, | 64 | urb->actual_length, |
| 56 | urb->transfer_buffer_length); | 65 | urb->transfer_buffer_length); |
| 57 | |||
| 58 | usb_kill_urb(urb); | ||
| 59 | retval = status == -ENOENT ? -ETIMEDOUT : status; | ||
| 60 | } else | 66 | } else |
| 61 | retval = status; | 67 | retval = ctx.status; |
| 62 | out: | 68 | out: |
| 63 | if (actual_length) | 69 | if (actual_length) |
| 64 | *actual_length = urb->actual_length; | 70 | *actual_length = urb->actual_length; |
| @@ -411,15 +417,22 @@ int usb_sg_init ( | |||
| 411 | * Some systems need to revert to PIO when DMA is temporarily | 417 | * Some systems need to revert to PIO when DMA is temporarily |
| 412 | * unavailable. For their sakes, both transfer_buffer and | 418 | * unavailable. For their sakes, both transfer_buffer and |
| 413 | * transfer_dma are set when possible. However this can only | 419 | * transfer_dma are set when possible. However this can only |
| 414 | * work on systems without HIGHMEM, since DMA buffers located | 420 | * work on systems without: |
| 415 | * in high memory are not directly addressable by the CPU for | 421 | * |
| 416 | * PIO ... so when HIGHMEM is in use, transfer_buffer is NULL | 422 | * - HIGHMEM, since DMA buffers located in high memory are |
| 423 | * not directly addressable by the CPU for PIO; | ||
| 424 | * | ||
| 425 | * - IOMMU, since dma_map_sg() is allowed to use an IOMMU to | ||
| 426 | * make virtually discontiguous buffers be "dma-contiguous" | ||
| 427 | * so that PIO and DMA need diferent numbers of URBs. | ||
| 428 | * | ||
| 429 | * So when HIGHMEM or IOMMU are in use, transfer_buffer is NULL | ||
| 417 | * to prevent stale pointers and to help spot bugs. | 430 | * to prevent stale pointers and to help spot bugs. |
| 418 | */ | 431 | */ |
| 419 | if (dma) { | 432 | if (dma) { |
| 420 | io->urbs [i]->transfer_dma = sg_dma_address (sg + i); | 433 | io->urbs [i]->transfer_dma = sg_dma_address (sg + i); |
| 421 | len = sg_dma_len (sg + i); | 434 | len = sg_dma_len (sg + i); |
| 422 | #ifdef CONFIG_HIGHMEM | 435 | #if defined(CONFIG_HIGHMEM) || defined(CONFIG_IOMMU) |
| 423 | io->urbs[i]->transfer_buffer = NULL; | 436 | io->urbs[i]->transfer_buffer = NULL; |
| 424 | #else | 437 | #else |
| 425 | io->urbs[i]->transfer_buffer = | 438 | io->urbs[i]->transfer_buffer = |
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index aa21b38a31ce..b7917c5a3c6f 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
| @@ -30,18 +30,40 @@ | |||
| 30 | static const struct usb_device_id usb_quirk_list[] = { | 30 | static const struct usb_device_id usb_quirk_list[] = { |
| 31 | /* HP 5300/5370C scanner */ | 31 | /* HP 5300/5370C scanner */ |
| 32 | { USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 }, | 32 | { USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 }, |
| 33 | /* Acer Peripherals Inc. (now BenQ Corp.) Prisa 640BU */ | ||
| 34 | { USB_DEVICE(0x04a5, 0x207e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | ||
| 33 | /* Benq S2W 3300U */ | 35 | /* Benq S2W 3300U */ |
| 34 | { USB_DEVICE(0x04a5, 0x20b0), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | 36 | { USB_DEVICE(0x04a5, 0x20b0), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, |
| 37 | /* Canon, Inc. CanoScan N1240U/LiDE30 */ | ||
| 38 | { USB_DEVICE(0x04a9, 0x220e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | ||
| 39 | /* Canon, Inc. CanoScan N650U/N656U */ | ||
| 40 | { USB_DEVICE(0x04a9, 0x2206), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | ||
| 41 | /* Canon, Inc. CanoScan 1220U */ | ||
| 42 | { USB_DEVICE(0x04a9, 0x2207), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | ||
| 43 | /* Canon, Inc. CanoScan N670U/N676U/LiDE 20 */ | ||
| 44 | { USB_DEVICE(0x04a9, 0x220d), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | ||
| 45 | /* old Cannon scanner */ | ||
| 46 | { USB_DEVICE(0x04a9, 0x2220), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | ||
| 35 | /* Seiko Epson Corp. Perfection 1200 */ | 47 | /* Seiko Epson Corp. Perfection 1200 */ |
| 36 | { USB_DEVICE(0x04b8, 0x0104), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | 48 | { USB_DEVICE(0x04b8, 0x0104), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, |
| 49 | /* Seiko Epson Corp. Perfection 660 */ | ||
| 50 | { USB_DEVICE(0x04b8, 0x0114), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | ||
| 51 | /* Epson Perfection 1260 Photo */ | ||
| 52 | { USB_DEVICE(0x04b8, 0x011d), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | ||
| 37 | /* Seiko Epson Corp - Perfection 1670 */ | 53 | /* Seiko Epson Corp - Perfection 1670 */ |
| 38 | { USB_DEVICE(0x04b8, 0x011f), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | 54 | { USB_DEVICE(0x04b8, 0x011f), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, |
| 55 | /* EPSON Perfection 2480 */ | ||
| 56 | { USB_DEVICE(0x04b8, 0x0121), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | ||
| 57 | /* Seiko Epson Corp.*/ | ||
| 58 | { USB_DEVICE(0x04b8, 0x0122), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | ||
| 39 | /* Samsung ML-2510 Series printer */ | 59 | /* Samsung ML-2510 Series printer */ |
| 40 | { USB_DEVICE(0x04e8, 0x327e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | 60 | { USB_DEVICE(0x04e8, 0x327e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, |
| 41 | /* Elsa MicroLink 56k (V.250) */ | 61 | /* Elsa MicroLink 56k (V.250) */ |
| 42 | { USB_DEVICE(0x05cc, 0x2267), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | 62 | { USB_DEVICE(0x05cc, 0x2267), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, |
| 43 | /* Ultima Electronics Corp.*/ | 63 | /* Ultima Electronics Corp.*/ |
| 44 | { USB_DEVICE(0x05d8, 0x4005), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | 64 | { USB_DEVICE(0x05d8, 0x4005), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, |
| 65 | /* Agfa Snapscan1212u */ | ||
| 66 | { USB_DEVICE(0x06bd, 0x2061), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | ||
| 45 | /* Umax [hex] Astra 3400U */ | 67 | /* Umax [hex] Astra 3400U */ |
| 46 | { USB_DEVICE(0x1606, 0x0060), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | 68 | { USB_DEVICE(0x1606, 0x0060), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, |
| 47 | 69 | ||
diff --git a/drivers/usb/gadget/config.c b/drivers/usb/gadget/config.c index d18901b92cda..c6760aee1e5c 100644 --- a/drivers/usb/gadget/config.c +++ b/drivers/usb/gadget/config.c | |||
| @@ -50,7 +50,7 @@ usb_descriptor_fillbuf(void *buf, unsigned buflen, | |||
| 50 | return -EINVAL; | 50 | return -EINVAL; |
| 51 | 51 | ||
| 52 | /* fill buffer from src[] until null descriptor ptr */ | 52 | /* fill buffer from src[] until null descriptor ptr */ |
| 53 | for (; 0 != *src; src++) { | 53 | for (; NULL != *src; src++) { |
| 54 | unsigned len = (*src)->bLength; | 54 | unsigned len = (*src)->bLength; |
| 55 | 55 | ||
| 56 | if (len > buflen) | 56 | if (len > buflen) |
diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index 6042364402b8..3aa46cfa66ba 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c | |||
| @@ -71,7 +71,7 @@ ep_matches ( | |||
| 71 | u16 max; | 71 | u16 max; |
| 72 | 72 | ||
| 73 | /* endpoint already claimed? */ | 73 | /* endpoint already claimed? */ |
| 74 | if (0 != ep->driver_data) | 74 | if (NULL != ep->driver_data) |
| 75 | return 0; | 75 | return 0; |
| 76 | 76 | ||
| 77 | /* only support ep0 for portable CONTROL traffic */ | 77 | /* only support ep0 for portable CONTROL traffic */ |
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index a3376739a81b..593e23507b1a 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c | |||
| @@ -1723,7 +1723,8 @@ rx_submit (struct eth_dev *dev, struct usb_request *req, gfp_t gfp_flags) | |||
| 1723 | size += sizeof (struct rndis_packet_msg_type); | 1723 | size += sizeof (struct rndis_packet_msg_type); |
| 1724 | size -= size % dev->out_ep->maxpacket; | 1724 | size -= size % dev->out_ep->maxpacket; |
| 1725 | 1725 | ||
| 1726 | if ((skb = alloc_skb (size + NET_IP_ALIGN, gfp_flags)) == 0) { | 1726 | skb = alloc_skb(size + NET_IP_ALIGN, gfp_flags); |
| 1727 | if (skb == NULL) { | ||
| 1727 | DEBUG (dev, "no rx skb\n"); | 1728 | DEBUG (dev, "no rx skb\n"); |
| 1728 | goto enomem; | 1729 | goto enomem; |
| 1729 | } | 1730 | } |
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index e60745ffaf8e..173004f60fea 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
| @@ -964,7 +964,7 @@ static int setup_req (struct usb_ep *ep, struct usb_request *req, u16 len) | |||
| 964 | } | 964 | } |
| 965 | if (len > sizeof (dev->rbuf)) | 965 | if (len > sizeof (dev->rbuf)) |
| 966 | req->buf = kmalloc(len, GFP_ATOMIC); | 966 | req->buf = kmalloc(len, GFP_ATOMIC); |
| 967 | if (req->buf == 0) { | 967 | if (req->buf == NULL) { |
| 968 | req->buf = dev->rbuf; | 968 | req->buf = dev->rbuf; |
| 969 | return -ENOMEM; | 969 | return -ENOMEM; |
| 970 | } | 970 | } |
| @@ -1394,7 +1394,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) | |||
| 1394 | dev->setup_abort = 0; | 1394 | dev->setup_abort = 0; |
| 1395 | if (dev->state == STATE_DEV_UNCONNECTED) { | 1395 | if (dev->state == STATE_DEV_UNCONNECTED) { |
| 1396 | #ifdef CONFIG_USB_GADGET_DUALSPEED | 1396 | #ifdef CONFIG_USB_GADGET_DUALSPEED |
| 1397 | if (gadget->speed == USB_SPEED_HIGH && dev->hs_config == 0) { | 1397 | if (gadget->speed == USB_SPEED_HIGH && dev->hs_config == NULL) { |
| 1398 | spin_unlock(&dev->lock); | 1398 | spin_unlock(&dev->lock); |
| 1399 | ERROR (dev, "no high speed config??\n"); | 1399 | ERROR (dev, "no high speed config??\n"); |
| 1400 | return -EINVAL; | 1400 | return -EINVAL; |
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c index 700dda8a9157..4b27d12f049d 100644 --- a/drivers/usb/gadget/m66592-udc.c +++ b/drivers/usb/gadget/m66592-udc.c | |||
| @@ -1299,7 +1299,7 @@ static int m66592_queue(struct usb_ep *_ep, struct usb_request *_req, | |||
| 1299 | req->req.actual = 0; | 1299 | req->req.actual = 0; |
| 1300 | req->req.status = -EINPROGRESS; | 1300 | req->req.status = -EINPROGRESS; |
| 1301 | 1301 | ||
| 1302 | if (ep->desc == 0) /* control */ | 1302 | if (ep->desc == NULL) /* control */ |
| 1303 | start_ep0(ep, req); | 1303 | start_ep0(ep, req); |
| 1304 | else { | 1304 | else { |
| 1305 | if (request && !ep->busy) | 1305 | if (request && !ep->busy) |
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c index 63b9521c1322..72b4ebbf132d 100644 --- a/drivers/usb/gadget/pxa2xx_udc.c +++ b/drivers/usb/gadget/pxa2xx_udc.c | |||
| @@ -93,8 +93,6 @@ static const char driver_name [] = "pxa2xx_udc"; | |||
| 93 | static const char ep0name [] = "ep0"; | 93 | static const char ep0name [] = "ep0"; |
| 94 | 94 | ||
| 95 | 95 | ||
| 96 | // #define DISABLE_TEST_MODE | ||
| 97 | |||
| 98 | #ifdef CONFIG_ARCH_IXP4XX | 96 | #ifdef CONFIG_ARCH_IXP4XX |
| 99 | 97 | ||
| 100 | /* cpu-specific register addresses are compiled in to this code */ | 98 | /* cpu-specific register addresses are compiled in to this code */ |
| @@ -113,17 +111,6 @@ static const char ep0name [] = "ep0"; | |||
| 113 | #define SIZE_STR "" | 111 | #define SIZE_STR "" |
| 114 | #endif | 112 | #endif |
| 115 | 113 | ||
| 116 | #ifdef DISABLE_TEST_MODE | ||
| 117 | /* (mode == 0) == no undocumented chip tweaks | ||
| 118 | * (mode & 1) == double buffer bulk IN | ||
| 119 | * (mode & 2) == double buffer bulk OUT | ||
| 120 | * ... so mode = 3 (or 7, 15, etc) does it for both | ||
| 121 | */ | ||
| 122 | static ushort fifo_mode = 0; | ||
| 123 | module_param(fifo_mode, ushort, 0); | ||
| 124 | MODULE_PARM_DESC (fifo_mode, "pxa2xx udc fifo mode"); | ||
| 125 | #endif | ||
| 126 | |||
| 127 | /* --------------------------------------------------------------------------- | 114 | /* --------------------------------------------------------------------------- |
| 128 | * endpoint related parts of the api to the usb controller hardware, | 115 | * endpoint related parts of the api to the usb controller hardware, |
| 129 | * used by gadget driver; and the inner talker-to-hardware core. | 116 | * used by gadget driver; and the inner talker-to-hardware core. |
| @@ -1252,23 +1239,6 @@ static void udc_enable (struct pxa2xx_udc *dev) | |||
| 1252 | UDC_RES2 = 0x00; | 1239 | UDC_RES2 = 0x00; |
| 1253 | } | 1240 | } |
| 1254 | 1241 | ||
| 1255 | #ifdef DISABLE_TEST_MODE | ||
| 1256 | /* "test mode" seems to have become the default in later chip | ||
| 1257 | * revs, preventing double buffering (and invalidating docs). | ||
| 1258 | * this EXPERIMENT enables it for bulk endpoints by tweaking | ||
| 1259 | * undefined/reserved register bits (that other drivers clear). | ||
| 1260 | * Belcarra code comments noted this usage. | ||
| 1261 | */ | ||
| 1262 | if (fifo_mode & 1) { /* IN endpoints */ | ||
| 1263 | UDC_RES1 |= USIR0_IR1|USIR0_IR6; | ||
| 1264 | UDC_RES2 |= USIR1_IR11; | ||
| 1265 | } | ||
| 1266 | if (fifo_mode & 2) { /* OUT endpoints */ | ||
| 1267 | UDC_RES1 |= USIR0_IR2|USIR0_IR7; | ||
| 1268 | UDC_RES2 |= USIR1_IR12; | ||
| 1269 | } | ||
| 1270 | #endif | ||
| 1271 | |||
| 1272 | /* enable suspend/resume and reset irqs */ | 1242 | /* enable suspend/resume and reset irqs */ |
| 1273 | udc_clear_mask_UDCCR(UDCCR_SRM | UDCCR_REM); | 1243 | udc_clear_mask_UDCCR(UDCCR_SRM | UDCCR_REM); |
| 1274 | 1244 | ||
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c index a2e6e3fc8c8d..fcfe869acb94 100644 --- a/drivers/usb/gadget/zero.c +++ b/drivers/usb/gadget/zero.c | |||
| @@ -653,7 +653,8 @@ set_source_sink_config (struct zero_dev *dev, gfp_t gfp_flags) | |||
| 653 | result = usb_ep_enable (ep, d); | 653 | result = usb_ep_enable (ep, d); |
| 654 | if (result == 0) { | 654 | if (result == 0) { |
| 655 | ep->driver_data = dev; | 655 | ep->driver_data = dev; |
| 656 | if (source_sink_start_ep (ep, gfp_flags) != 0) { | 656 | if (source_sink_start_ep(ep, gfp_flags) |
| 657 | != NULL) { | ||
| 657 | dev->in_ep = ep; | 658 | dev->in_ep = ep; |
| 658 | continue; | 659 | continue; |
| 659 | } | 660 | } |
| @@ -667,7 +668,8 @@ set_source_sink_config (struct zero_dev *dev, gfp_t gfp_flags) | |||
| 667 | result = usb_ep_enable (ep, d); | 668 | result = usb_ep_enable (ep, d); |
| 668 | if (result == 0) { | 669 | if (result == 0) { |
| 669 | ep->driver_data = dev; | 670 | ep->driver_data = dev; |
| 670 | if (source_sink_start_ep (ep, gfp_flags) != 0) { | 671 | if (source_sink_start_ep(ep, gfp_flags) |
| 672 | != NULL) { | ||
| 671 | dev->out_ep = ep; | 673 | dev->out_ep = ep; |
| 672 | continue; | 674 | continue; |
| 673 | } | 675 | } |
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c index e831cb7f64fd..33f6ee50b8d3 100644 --- a/drivers/usb/serial/cp2101.c +++ b/drivers/usb/serial/cp2101.c | |||
| @@ -356,7 +356,7 @@ static void cp2101_get_termios (struct usb_serial_port *port) | |||
| 356 | 356 | ||
| 357 | dbg("%s - port %d", __FUNCTION__, port->number); | 357 | dbg("%s - port %d", __FUNCTION__, port->number); |
| 358 | 358 | ||
| 359 | if ((!port->tty) || (!port->tty->termios)) { | 359 | if (!port->tty || !port->tty->termios) { |
| 360 | dbg("%s - no tty structures", __FUNCTION__); | 360 | dbg("%s - no tty structures", __FUNCTION__); |
| 361 | return; | 361 | return; |
| 362 | } | 362 | } |
| @@ -526,50 +526,35 @@ static void cp2101_set_termios (struct usb_serial_port *port, | |||
| 526 | return; | 526 | return; |
| 527 | } | 527 | } |
| 528 | cflag = port->tty->termios->c_cflag; | 528 | cflag = port->tty->termios->c_cflag; |
| 529 | 529 | old_cflag = old_termios->c_cflag; | |
| 530 | /* Check that they really want us to change something */ | 530 | baud = tty_get_baud_rate(port->tty); |
| 531 | if (old_termios) { | ||
| 532 | if ((cflag == old_termios->c_cflag) && | ||
| 533 | (RELEVANT_IFLAG(port->tty->termios->c_iflag) | ||
| 534 | == RELEVANT_IFLAG(old_termios->c_iflag))) { | ||
| 535 | dbg("%s - nothing to change...", __FUNCTION__); | ||
| 536 | return; | ||
| 537 | } | ||
| 538 | |||
| 539 | old_cflag = old_termios->c_cflag; | ||
| 540 | } | ||
| 541 | 531 | ||
| 542 | /* If the baud rate is to be updated*/ | 532 | /* If the baud rate is to be updated*/ |
| 543 | if ((cflag & CBAUD) != (old_cflag & CBAUD)) { | 533 | if (baud != tty_termios_baud_rate(old_termios)) { |
| 544 | switch (cflag & CBAUD) { | 534 | switch (baud) { |
| 545 | /* | 535 | case 0: |
| 546 | * The baud rates which are commented out below | 536 | case 600: |
| 547 | * appear to be supported by the device | 537 | case 1200: |
| 548 | * but are non-standard | 538 | case 1800: |
| 549 | */ | 539 | case 2400: |
| 550 | case B0: baud = 0; break; | 540 | case 4800: |
| 551 | case B600: baud = 600; break; | 541 | case 7200: |
| 552 | case B1200: baud = 1200; break; | 542 | case 9600: |
| 553 | case B1800: baud = 1800; break; | 543 | case 14400: |
| 554 | case B2400: baud = 2400; break; | 544 | case 19200: |
| 555 | case B4800: baud = 4800; break; | 545 | case 28800: |
| 556 | /*case B7200: baud = 7200; break;*/ | 546 | case 38400: |
| 557 | case B9600: baud = 9600; break; | 547 | case 55854: |
| 558 | /*ase B14400: baud = 14400; break;*/ | 548 | case 57600: |
| 559 | case B19200: baud = 19200; break; | 549 | case 115200: |
| 560 | /*case B28800: baud = 28800; break;*/ | 550 | case 127117: |
| 561 | case B38400: baud = 38400; break; | 551 | case 230400: |
| 562 | /*case B55854: baud = 55054; break;*/ | 552 | case 460800: |
| 563 | case B57600: baud = 57600; break; | 553 | case 921600: |
| 564 | case B115200: baud = 115200; break; | 554 | case 3686400: |
| 565 | /*case B127117: baud = 127117; break;*/ | 555 | break; |
| 566 | case B230400: baud = 230400; break; | ||
| 567 | case B460800: baud = 460800; break; | ||
| 568 | case B921600: baud = 921600; break; | ||
| 569 | /*case B3686400: baud = 3686400; break;*/ | ||
| 570 | default: | 556 | default: |
| 571 | dev_err(&port->dev, "cp2101 driver does not " | 557 | baud = 9600; |
| 572 | "support the baudrate requested\n"); | ||
| 573 | break; | 558 | break; |
| 574 | } | 559 | } |
| 575 | 560 | ||
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index 976f54ec26e6..dab2e66d111d 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c | |||
| @@ -433,38 +433,38 @@ struct digi_port { | |||
| 433 | 433 | ||
| 434 | /* Local Function Declarations */ | 434 | /* Local Function Declarations */ |
| 435 | 435 | ||
| 436 | static void digi_wakeup_write( struct usb_serial_port *port ); | 436 | static void digi_wakeup_write(struct usb_serial_port *port); |
| 437 | static void digi_wakeup_write_lock(struct work_struct *work); | 437 | static void digi_wakeup_write_lock(struct work_struct *work); |
| 438 | static int digi_write_oob_command( struct usb_serial_port *port, | 438 | static int digi_write_oob_command(struct usb_serial_port *port, |
| 439 | unsigned char *buf, int count, int interruptible ); | 439 | unsigned char *buf, int count, int interruptible); |
| 440 | static int digi_write_inb_command( struct usb_serial_port *port, | 440 | static int digi_write_inb_command(struct usb_serial_port *port, |
| 441 | unsigned char *buf, int count, unsigned long timeout ); | 441 | unsigned char *buf, int count, unsigned long timeout); |
| 442 | static int digi_set_modem_signals( struct usb_serial_port *port, | 442 | static int digi_set_modem_signals(struct usb_serial_port *port, |
| 443 | unsigned int modem_signals, int interruptible ); | 443 | unsigned int modem_signals, int interruptible); |
| 444 | static int digi_transmit_idle( struct usb_serial_port *port, | 444 | static int digi_transmit_idle(struct usb_serial_port *port, |
| 445 | unsigned long timeout ); | 445 | unsigned long timeout); |
| 446 | static void digi_rx_throttle (struct usb_serial_port *port); | 446 | static void digi_rx_throttle (struct usb_serial_port *port); |
| 447 | static void digi_rx_unthrottle (struct usb_serial_port *port); | 447 | static void digi_rx_unthrottle (struct usb_serial_port *port); |
| 448 | static void digi_set_termios( struct usb_serial_port *port, | 448 | static void digi_set_termios(struct usb_serial_port *port, |
| 449 | struct ktermios *old_termios ); | 449 | struct ktermios *old_termios); |
| 450 | static void digi_break_ctl( struct usb_serial_port *port, int break_state ); | 450 | static void digi_break_ctl(struct usb_serial_port *port, int break_state); |
| 451 | static int digi_ioctl( struct usb_serial_port *port, struct file *file, | 451 | static int digi_ioctl(struct usb_serial_port *port, struct file *file, |
| 452 | unsigned int cmd, unsigned long arg ); | 452 | unsigned int cmd, unsigned long arg); |
| 453 | static int digi_tiocmget( struct usb_serial_port *port, struct file *file ); | 453 | static int digi_tiocmget(struct usb_serial_port *port, struct file *file); |
| 454 | static int digi_tiocmset( struct usb_serial_port *port, struct file *file, | 454 | static int digi_tiocmset(struct usb_serial_port *port, struct file *file, |
| 455 | unsigned int set, unsigned int clear ); | 455 | unsigned int set, unsigned int clear); |
| 456 | static int digi_write( struct usb_serial_port *port, const unsigned char *buf, int count ); | 456 | static int digi_write(struct usb_serial_port *port, const unsigned char *buf, int count); |
| 457 | static void digi_write_bulk_callback( struct urb *urb ); | 457 | static void digi_write_bulk_callback(struct urb *urb); |
| 458 | static int digi_write_room( struct usb_serial_port *port ); | 458 | static int digi_write_room(struct usb_serial_port *port); |
| 459 | static int digi_chars_in_buffer( struct usb_serial_port *port ); | 459 | static int digi_chars_in_buffer(struct usb_serial_port *port); |
| 460 | static int digi_open( struct usb_serial_port *port, struct file *filp ); | 460 | static int digi_open(struct usb_serial_port *port, struct file *filp); |
| 461 | static void digi_close( struct usb_serial_port *port, struct file *filp ); | 461 | static void digi_close(struct usb_serial_port *port, struct file *filp); |
| 462 | static int digi_startup_device( struct usb_serial *serial ); | 462 | static int digi_startup_device(struct usb_serial *serial); |
| 463 | static int digi_startup( struct usb_serial *serial ); | 463 | static int digi_startup(struct usb_serial *serial); |
| 464 | static void digi_shutdown( struct usb_serial *serial ); | 464 | static void digi_shutdown(struct usb_serial *serial); |
| 465 | static void digi_read_bulk_callback( struct urb *urb ); | 465 | static void digi_read_bulk_callback(struct urb *urb); |
| 466 | static int digi_read_inb_callback( struct urb *urb ); | 466 | static int digi_read_inb_callback(struct urb *urb); |
| 467 | static int digi_read_oob_callback( struct urb *urb ); | 467 | static int digi_read_oob_callback(struct urb *urb); |
| 468 | 468 | ||
| 469 | 469 | ||
| 470 | /* Statics */ | 470 | /* Statics */ |
| @@ -576,9 +576,9 @@ static struct usb_serial_driver digi_acceleport_4_device = { | |||
| 576 | * with the equivalent code. | 576 | * with the equivalent code. |
| 577 | */ | 577 | */ |
| 578 | 578 | ||
| 579 | static inline long cond_wait_interruptible_timeout_irqrestore( | 579 | static long cond_wait_interruptible_timeout_irqrestore( |
| 580 | wait_queue_head_t *q, long timeout, | 580 | wait_queue_head_t *q, long timeout, |
| 581 | spinlock_t *lock, unsigned long flags ) | 581 | spinlock_t *lock, unsigned long flags) |
| 582 | { | 582 | { |
| 583 | DEFINE_WAIT(wait); | 583 | DEFINE_WAIT(wait); |
| 584 | 584 | ||
| @@ -600,18 +600,16 @@ static inline long cond_wait_interruptible_timeout_irqrestore( | |||
| 600 | 600 | ||
| 601 | static void digi_wakeup_write_lock(struct work_struct *work) | 601 | static void digi_wakeup_write_lock(struct work_struct *work) |
| 602 | { | 602 | { |
| 603 | struct digi_port *priv = | 603 | struct digi_port *priv = container_of(work, struct digi_port, dp_wakeup_work); |
| 604 | container_of(work, struct digi_port, dp_wakeup_work); | ||
| 605 | struct usb_serial_port *port = priv->dp_port; | 604 | struct usb_serial_port *port = priv->dp_port; |
| 606 | unsigned long flags; | 605 | unsigned long flags; |
| 607 | 606 | ||
| 608 | 607 | spin_lock_irqsave(&priv->dp_port_lock, flags); | |
| 609 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 608 | digi_wakeup_write(port); |
| 610 | digi_wakeup_write( port ); | 609 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
| 611 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | ||
| 612 | } | 610 | } |
| 613 | 611 | ||
| 614 | static void digi_wakeup_write( struct usb_serial_port *port ) | 612 | static void digi_wakeup_write(struct usb_serial_port *port) |
| 615 | { | 613 | { |
| 616 | tty_wakeup(port->tty); | 614 | tty_wakeup(port->tty); |
| 617 | } | 615 | } |
| @@ -628,8 +626,8 @@ static void digi_wakeup_write( struct usb_serial_port *port ) | |||
| 628 | * returned by usb_submit_urb. | 626 | * returned by usb_submit_urb. |
| 629 | */ | 627 | */ |
| 630 | 628 | ||
| 631 | static int digi_write_oob_command( struct usb_serial_port *port, | 629 | static int digi_write_oob_command(struct usb_serial_port *port, |
| 632 | unsigned char *buf, int count, int interruptible ) | 630 | unsigned char *buf, int count, int interruptible) |
| 633 | { | 631 | { |
| 634 | 632 | ||
| 635 | int ret = 0; | 633 | int ret = 0; |
| @@ -638,49 +636,37 @@ static int digi_write_oob_command( struct usb_serial_port *port, | |||
| 638 | struct digi_port *oob_priv = usb_get_serial_port_data(oob_port); | 636 | struct digi_port *oob_priv = usb_get_serial_port_data(oob_port); |
| 639 | unsigned long flags = 0; | 637 | unsigned long flags = 0; |
| 640 | 638 | ||
| 639 | dbg("digi_write_oob_command: TOP: port=%d, count=%d", oob_priv->dp_port_num, count); | ||
| 641 | 640 | ||
| 642 | dbg( "digi_write_oob_command: TOP: port=%d, count=%d", oob_priv->dp_port_num, count ); | 641 | spin_lock_irqsave(&oob_priv->dp_port_lock, flags); |
| 643 | 642 | while(count > 0) { | |
| 644 | spin_lock_irqsave( &oob_priv->dp_port_lock, flags ); | 643 | while(oob_port->write_urb->status == -EINPROGRESS |
| 645 | 644 | || oob_priv->dp_write_urb_in_use) { | |
| 646 | while( count > 0 ) { | ||
| 647 | |||
| 648 | while( oob_port->write_urb->status == -EINPROGRESS | ||
| 649 | || oob_priv->dp_write_urb_in_use ) { | ||
| 650 | cond_wait_interruptible_timeout_irqrestore( | 645 | cond_wait_interruptible_timeout_irqrestore( |
| 651 | &oob_port->write_wait, DIGI_RETRY_TIMEOUT, | 646 | &oob_port->write_wait, DIGI_RETRY_TIMEOUT, |
| 652 | &oob_priv->dp_port_lock, flags ); | 647 | &oob_priv->dp_port_lock, flags); |
| 653 | if( interruptible && signal_pending(current) ) { | 648 | if (interruptible && signal_pending(current)) |
| 654 | return( -EINTR ); | 649 | return -EINTR; |
| 655 | } | 650 | spin_lock_irqsave(&oob_priv->dp_port_lock, flags); |
| 656 | spin_lock_irqsave( &oob_priv->dp_port_lock, flags ); | ||
| 657 | } | 651 | } |
| 658 | 652 | ||
| 659 | /* len must be a multiple of 4, so commands are not split */ | 653 | /* len must be a multiple of 4, so commands are not split */ |
| 660 | len = min(count, oob_port->bulk_out_size ); | 654 | len = min(count, oob_port->bulk_out_size); |
| 661 | if( len > 4 ) | 655 | if (len > 4) |
| 662 | len &= ~3; | 656 | len &= ~3; |
| 663 | 657 | memcpy(oob_port->write_urb->transfer_buffer, buf, len); | |
| 664 | memcpy( oob_port->write_urb->transfer_buffer, buf, len ); | ||
| 665 | oob_port->write_urb->transfer_buffer_length = len; | 658 | oob_port->write_urb->transfer_buffer_length = len; |
| 666 | oob_port->write_urb->dev = port->serial->dev; | 659 | oob_port->write_urb->dev = port->serial->dev; |
| 667 | 660 | if ((ret = usb_submit_urb(oob_port->write_urb, GFP_ATOMIC)) == 0) { | |
| 668 | if( (ret=usb_submit_urb(oob_port->write_urb, GFP_ATOMIC)) == 0 ) { | ||
| 669 | oob_priv->dp_write_urb_in_use = 1; | 661 | oob_priv->dp_write_urb_in_use = 1; |
| 670 | count -= len; | 662 | count -= len; |
| 671 | buf += len; | 663 | buf += len; |
| 672 | } | 664 | } |
| 673 | |||
| 674 | } | ||
| 675 | |||
| 676 | spin_unlock_irqrestore( &oob_priv->dp_port_lock, flags ); | ||
| 677 | |||
| 678 | if( ret ) { | ||
| 679 | err("%s: usb_submit_urb failed, ret=%d", __FUNCTION__, | ||
| 680 | ret ); | ||
| 681 | } | 665 | } |
| 682 | 666 | spin_unlock_irqrestore(&oob_priv->dp_port_lock, flags); | |
| 683 | return( ret ); | 667 | if (ret) |
| 668 | err("%s: usb_submit_urb failed, ret=%d", __FUNCTION__, ret); | ||
| 669 | return ret; | ||
| 684 | 670 | ||
| 685 | } | 671 | } |
| 686 | 672 | ||
| @@ -697,63 +683,58 @@ dbg( "digi_write_oob_command: TOP: port=%d, count=%d", oob_priv->dp_port_num, co | |||
| 697 | * error returned by digi_write. | 683 | * error returned by digi_write. |
| 698 | */ | 684 | */ |
| 699 | 685 | ||
| 700 | static int digi_write_inb_command( struct usb_serial_port *port, | 686 | static int digi_write_inb_command(struct usb_serial_port *port, |
| 701 | unsigned char *buf, int count, unsigned long timeout ) | 687 | unsigned char *buf, int count, unsigned long timeout) |
| 702 | { | 688 | { |
| 703 | |||
| 704 | int ret = 0; | 689 | int ret = 0; |
| 705 | int len; | 690 | int len; |
| 706 | struct digi_port *priv = usb_get_serial_port_data(port); | 691 | struct digi_port *priv = usb_get_serial_port_data(port); |
| 707 | unsigned char *data = port->write_urb->transfer_buffer; | 692 | unsigned char *data = port->write_urb->transfer_buffer; |
| 708 | unsigned long flags = 0; | 693 | unsigned long flags = 0; |
| 709 | 694 | ||
| 695 | dbg("digi_write_inb_command: TOP: port=%d, count=%d", | ||
| 696 | priv->dp_port_num, count); | ||
| 710 | 697 | ||
| 711 | dbg( "digi_write_inb_command: TOP: port=%d, count=%d", priv->dp_port_num, | 698 | if (timeout) |
| 712 | count ); | ||
| 713 | |||
| 714 | if( timeout ) | ||
| 715 | timeout += jiffies; | 699 | timeout += jiffies; |
| 716 | else | 700 | else |
| 717 | timeout = ULONG_MAX; | 701 | timeout = ULONG_MAX; |
| 718 | 702 | ||
| 719 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 703 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
| 720 | 704 | while(count > 0 && ret == 0) { | |
| 721 | while( count > 0 && ret == 0 ) { | 705 | while((port->write_urb->status == -EINPROGRESS |
| 722 | 706 | || priv->dp_write_urb_in_use) && time_before(jiffies, timeout)) { | |
| 723 | while( (port->write_urb->status == -EINPROGRESS | ||
| 724 | || priv->dp_write_urb_in_use) && time_before(jiffies, timeout)) { | ||
| 725 | cond_wait_interruptible_timeout_irqrestore( | 707 | cond_wait_interruptible_timeout_irqrestore( |
| 726 | &port->write_wait, DIGI_RETRY_TIMEOUT, | 708 | &port->write_wait, DIGI_RETRY_TIMEOUT, |
| 727 | &priv->dp_port_lock, flags ); | 709 | &priv->dp_port_lock, flags); |
| 728 | if( signal_pending(current) ) { | 710 | if (signal_pending(current)) |
| 729 | return( -EINTR ); | 711 | return -EINTR; |
| 730 | } | 712 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
| 731 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | ||
| 732 | } | 713 | } |
| 733 | 714 | ||
| 734 | /* len must be a multiple of 4 and small enough to */ | 715 | /* len must be a multiple of 4 and small enough to */ |
| 735 | /* guarantee the write will send buffered data first, */ | 716 | /* guarantee the write will send buffered data first, */ |
| 736 | /* so commands are in order with data and not split */ | 717 | /* so commands are in order with data and not split */ |
| 737 | len = min(count, port->bulk_out_size-2-priv->dp_out_buf_len ); | 718 | len = min(count, port->bulk_out_size-2-priv->dp_out_buf_len); |
| 738 | if( len > 4 ) | 719 | if (len > 4) |
| 739 | len &= ~3; | 720 | len &= ~3; |
| 740 | 721 | ||
| 741 | /* write any buffered data first */ | 722 | /* write any buffered data first */ |
| 742 | if( priv->dp_out_buf_len > 0 ) { | 723 | if (priv->dp_out_buf_len > 0) { |
| 743 | data[0] = DIGI_CMD_SEND_DATA; | 724 | data[0] = DIGI_CMD_SEND_DATA; |
| 744 | data[1] = priv->dp_out_buf_len; | 725 | data[1] = priv->dp_out_buf_len; |
| 745 | memcpy( data+2, priv->dp_out_buf, | 726 | memcpy(data + 2, priv->dp_out_buf, |
| 746 | priv->dp_out_buf_len ); | 727 | priv->dp_out_buf_len); |
| 747 | memcpy( data+2+priv->dp_out_buf_len, buf, len ); | 728 | memcpy(data + 2 + priv->dp_out_buf_len, buf, len); |
| 748 | port->write_urb->transfer_buffer_length | 729 | port->write_urb->transfer_buffer_length |
| 749 | = priv->dp_out_buf_len+2+len; | 730 | = priv->dp_out_buf_len + 2 + len; |
| 750 | } else { | 731 | } else { |
| 751 | memcpy( data, buf, len ); | 732 | memcpy(data, buf, len); |
| 752 | port->write_urb->transfer_buffer_length = len; | 733 | port->write_urb->transfer_buffer_length = len; |
| 753 | } | 734 | } |
| 754 | port->write_urb->dev = port->serial->dev; | 735 | port->write_urb->dev = port->serial->dev; |
| 755 | 736 | ||
| 756 | if( (ret=usb_submit_urb(port->write_urb, GFP_ATOMIC)) == 0 ) { | 737 | if ((ret = usb_submit_urb(port->write_urb, GFP_ATOMIC)) == 0) { |
| 757 | priv->dp_write_urb_in_use = 1; | 738 | priv->dp_write_urb_in_use = 1; |
| 758 | priv->dp_out_buf_len = 0; | 739 | priv->dp_out_buf_len = 0; |
| 759 | count -= len; | 740 | count -= len; |
| @@ -761,16 +742,12 @@ count ); | |||
| 761 | } | 742 | } |
| 762 | 743 | ||
| 763 | } | 744 | } |
| 745 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); | ||
| 764 | 746 | ||
| 765 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 747 | if (ret) |
| 766 | 748 | err("%s: usb_submit_urb failed, ret=%d, port=%d", | |
| 767 | if( ret ) { | 749 | __FUNCTION__, ret, priv->dp_port_num); |
| 768 | err("%s: usb_submit_urb failed, ret=%d, port=%d", __FUNCTION__, | 750 | return ret; |
| 769 | ret, priv->dp_port_num ); | ||
| 770 | } | ||
| 771 | |||
| 772 | return( ret ); | ||
| 773 | |||
| 774 | } | 751 | } |
| 775 | 752 | ||
| 776 | 753 | ||
| @@ -784,8 +761,8 @@ count ); | |||
| 784 | * returned by usb_submit_urb. | 761 | * returned by usb_submit_urb. |
| 785 | */ | 762 | */ |
| 786 | 763 | ||
| 787 | static int digi_set_modem_signals( struct usb_serial_port *port, | 764 | static int digi_set_modem_signals(struct usb_serial_port *port, |
| 788 | unsigned int modem_signals, int interruptible ) | 765 | unsigned int modem_signals, int interruptible) |
| 789 | { | 766 | { |
| 790 | 767 | ||
| 791 | int ret; | 768 | int ret; |
| @@ -796,60 +773,47 @@ static int digi_set_modem_signals( struct usb_serial_port *port, | |||
| 796 | unsigned long flags = 0; | 773 | unsigned long flags = 0; |
| 797 | 774 | ||
| 798 | 775 | ||
| 799 | dbg( "digi_set_modem_signals: TOP: port=%d, modem_signals=0x%x", | 776 | dbg("digi_set_modem_signals: TOP: port=%d, modem_signals=0x%x", |
| 800 | port_priv->dp_port_num, modem_signals ); | 777 | port_priv->dp_port_num, modem_signals); |
| 801 | 778 | ||
| 802 | spin_lock_irqsave( &oob_priv->dp_port_lock, flags ); | 779 | spin_lock_irqsave(&oob_priv->dp_port_lock, flags); |
| 803 | spin_lock( &port_priv->dp_port_lock ); | 780 | spin_lock(&port_priv->dp_port_lock); |
| 804 | 781 | ||
| 805 | while( oob_port->write_urb->status == -EINPROGRESS | 782 | while(oob_port->write_urb->status == -EINPROGRESS || oob_priv->dp_write_urb_in_use) { |
| 806 | || oob_priv->dp_write_urb_in_use ) { | 783 | spin_unlock(&port_priv->dp_port_lock); |
| 807 | spin_unlock( &port_priv->dp_port_lock ); | ||
| 808 | cond_wait_interruptible_timeout_irqrestore( | 784 | cond_wait_interruptible_timeout_irqrestore( |
| 809 | &oob_port->write_wait, DIGI_RETRY_TIMEOUT, | 785 | &oob_port->write_wait, DIGI_RETRY_TIMEOUT, |
| 810 | &oob_priv->dp_port_lock, flags ); | 786 | &oob_priv->dp_port_lock, flags); |
| 811 | if( interruptible && signal_pending(current) ) { | 787 | if (interruptible && signal_pending(current)) |
| 812 | return( -EINTR ); | 788 | return -EINTR; |
| 813 | } | 789 | spin_lock_irqsave(&oob_priv->dp_port_lock, flags); |
| 814 | spin_lock_irqsave( &oob_priv->dp_port_lock, flags ); | 790 | spin_lock(&port_priv->dp_port_lock); |
| 815 | spin_lock( &port_priv->dp_port_lock ); | ||
| 816 | } | 791 | } |
| 817 | |||
| 818 | data[0] = DIGI_CMD_SET_DTR_SIGNAL; | 792 | data[0] = DIGI_CMD_SET_DTR_SIGNAL; |
| 819 | data[1] = port_priv->dp_port_num; | 793 | data[1] = port_priv->dp_port_num; |
| 820 | data[2] = (modem_signals&TIOCM_DTR) ? | 794 | data[2] = (modem_signals&TIOCM_DTR) ? DIGI_DTR_ACTIVE : DIGI_DTR_INACTIVE; |
| 821 | DIGI_DTR_ACTIVE : DIGI_DTR_INACTIVE; | ||
| 822 | data[3] = 0; | 795 | data[3] = 0; |
| 823 | |||
| 824 | data[4] = DIGI_CMD_SET_RTS_SIGNAL; | 796 | data[4] = DIGI_CMD_SET_RTS_SIGNAL; |
| 825 | data[5] = port_priv->dp_port_num; | 797 | data[5] = port_priv->dp_port_num; |
| 826 | data[6] = (modem_signals&TIOCM_RTS) ? | 798 | data[6] = (modem_signals&TIOCM_RTS) ? DIGI_RTS_ACTIVE : DIGI_RTS_INACTIVE; |
| 827 | DIGI_RTS_ACTIVE : DIGI_RTS_INACTIVE; | ||
| 828 | data[7] = 0; | 799 | data[7] = 0; |
| 829 | 800 | ||
| 830 | oob_port->write_urb->transfer_buffer_length = 8; | 801 | oob_port->write_urb->transfer_buffer_length = 8; |
| 831 | oob_port->write_urb->dev = port->serial->dev; | 802 | oob_port->write_urb->dev = port->serial->dev; |
| 832 | 803 | ||
| 833 | if( (ret=usb_submit_urb(oob_port->write_urb, GFP_ATOMIC)) == 0 ) { | 804 | if ((ret = usb_submit_urb(oob_port->write_urb, GFP_ATOMIC)) == 0) { |
| 834 | oob_priv->dp_write_urb_in_use = 1; | 805 | oob_priv->dp_write_urb_in_use = 1; |
| 835 | port_priv->dp_modem_signals = | 806 | port_priv->dp_modem_signals = |
| 836 | (port_priv->dp_modem_signals&~(TIOCM_DTR|TIOCM_RTS)) | 807 | (port_priv->dp_modem_signals&~(TIOCM_DTR|TIOCM_RTS)) |
| 837 | | (modem_signals&(TIOCM_DTR|TIOCM_RTS)); | 808 | | (modem_signals&(TIOCM_DTR|TIOCM_RTS)); |
| 838 | } | 809 | } |
| 839 | 810 | spin_unlock(&port_priv->dp_port_lock); | |
| 840 | spin_unlock( &port_priv->dp_port_lock ); | 811 | spin_unlock_irqrestore(&oob_priv->dp_port_lock, flags); |
| 841 | spin_unlock_irqrestore( &oob_priv->dp_port_lock, flags ); | 812 | if (ret) |
| 842 | 813 | err("%s: usb_submit_urb failed, ret=%d", __FUNCTION__, ret); | |
| 843 | if( ret ) { | 814 | return ret; |
| 844 | err("%s: usb_submit_urb failed, ret=%d", __FUNCTION__, | ||
| 845 | ret ); | ||
| 846 | } | ||
| 847 | |||
| 848 | return( ret ); | ||
| 849 | |||
| 850 | } | 815 | } |
| 851 | 816 | ||
| 852 | |||
| 853 | /* | 817 | /* |
| 854 | * Digi Transmit Idle | 818 | * Digi Transmit Idle |
| 855 | * | 819 | * |
| @@ -862,203 +826,182 @@ port_priv->dp_port_num, modem_signals ); | |||
| 862 | * port at a time, so its ok. | 826 | * port at a time, so its ok. |
| 863 | */ | 827 | */ |
| 864 | 828 | ||
| 865 | static int digi_transmit_idle( struct usb_serial_port *port, | 829 | static int digi_transmit_idle(struct usb_serial_port *port, |
| 866 | unsigned long timeout ) | 830 | unsigned long timeout) |
| 867 | { | 831 | { |
| 868 | |||
| 869 | int ret; | 832 | int ret; |
| 870 | unsigned char buf[2]; | 833 | unsigned char buf[2]; |
| 871 | struct digi_port *priv = usb_get_serial_port_data(port); | 834 | struct digi_port *priv = usb_get_serial_port_data(port); |
| 872 | unsigned long flags = 0; | 835 | unsigned long flags = 0; |
| 873 | 836 | ||
| 874 | 837 | spin_lock_irqsave(&priv->dp_port_lock, flags); | |
| 875 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | ||
| 876 | priv->dp_transmit_idle = 0; | 838 | priv->dp_transmit_idle = 0; |
| 877 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 839 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
| 878 | 840 | ||
| 879 | buf[0] = DIGI_CMD_TRANSMIT_IDLE; | 841 | buf[0] = DIGI_CMD_TRANSMIT_IDLE; |
| 880 | buf[1] = 0; | 842 | buf[1] = 0; |
| 881 | 843 | ||
| 882 | timeout += jiffies; | 844 | timeout += jiffies; |
| 883 | 845 | ||
| 884 | if( (ret=digi_write_inb_command( port, buf, 2, timeout-jiffies )) != 0 ) | 846 | if ((ret = digi_write_inb_command(port, buf, 2, timeout - jiffies)) != 0) |
| 885 | return( ret ); | 847 | return ret; |
| 886 | 848 | ||
| 887 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 849 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
| 888 | 850 | ||
| 889 | while( time_before(jiffies, timeout) && !priv->dp_transmit_idle ) { | 851 | while(time_before(jiffies, timeout) && !priv->dp_transmit_idle) { |
| 890 | cond_wait_interruptible_timeout_irqrestore( | 852 | cond_wait_interruptible_timeout_irqrestore( |
| 891 | &priv->dp_transmit_idle_wait, DIGI_RETRY_TIMEOUT, | 853 | &priv->dp_transmit_idle_wait, DIGI_RETRY_TIMEOUT, |
| 892 | &priv->dp_port_lock, flags ); | 854 | &priv->dp_port_lock, flags); |
| 893 | if( signal_pending(current) ) { | 855 | if (signal_pending(current)) |
| 894 | return( -EINTR ); | 856 | return -EINTR; |
| 895 | } | 857 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
| 896 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | ||
| 897 | } | 858 | } |
| 898 | |||
| 899 | priv->dp_transmit_idle = 0; | 859 | priv->dp_transmit_idle = 0; |
| 900 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 860 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
| 901 | 861 | return 0; | |
| 902 | return( 0 ); | ||
| 903 | 862 | ||
| 904 | } | 863 | } |
| 905 | 864 | ||
| 906 | 865 | ||
| 907 | static void digi_rx_throttle( struct usb_serial_port *port ) | 866 | static void digi_rx_throttle(struct usb_serial_port *port) |
| 908 | { | 867 | { |
| 909 | |||
| 910 | unsigned long flags; | 868 | unsigned long flags; |
| 911 | struct digi_port *priv = usb_get_serial_port_data(port); | 869 | struct digi_port *priv = usb_get_serial_port_data(port); |
| 912 | 870 | ||
| 913 | 871 | ||
| 914 | dbg( "digi_rx_throttle: TOP: port=%d", priv->dp_port_num ); | 872 | dbg("digi_rx_throttle: TOP: port=%d", priv->dp_port_num); |
| 915 | 873 | ||
| 916 | /* stop receiving characters by not resubmitting the read urb */ | 874 | /* stop receiving characters by not resubmitting the read urb */ |
| 917 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 875 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
| 918 | priv->dp_throttled = 1; | 876 | priv->dp_throttled = 1; |
| 919 | priv->dp_throttle_restart = 0; | 877 | priv->dp_throttle_restart = 0; |
| 920 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 878 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
| 921 | |||
| 922 | } | 879 | } |
| 923 | 880 | ||
| 924 | 881 | ||
| 925 | static void digi_rx_unthrottle( struct usb_serial_port *port ) | 882 | static void digi_rx_unthrottle(struct usb_serial_port *port) |
| 926 | { | 883 | { |
| 927 | |||
| 928 | int ret = 0; | 884 | int ret = 0; |
| 929 | unsigned long flags; | 885 | unsigned long flags; |
| 930 | struct digi_port *priv = usb_get_serial_port_data(port); | 886 | struct digi_port *priv = usb_get_serial_port_data(port); |
| 931 | 887 | ||
| 932 | dbg( "digi_rx_unthrottle: TOP: port=%d", priv->dp_port_num ); | 888 | dbg("digi_rx_unthrottle: TOP: port=%d", priv->dp_port_num); |
| 933 | 889 | ||
| 934 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 890 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
| 935 | 891 | ||
| 936 | /* turn throttle off */ | 892 | /* turn throttle off */ |
| 937 | priv->dp_throttled = 0; | 893 | priv->dp_throttled = 0; |
| 938 | priv->dp_throttle_restart = 0; | 894 | priv->dp_throttle_restart = 0; |
| 939 | 895 | ||
| 940 | /* restart read chain */ | 896 | /* restart read chain */ |
| 941 | if( priv->dp_throttle_restart ) { | 897 | if (priv->dp_throttle_restart) { |
| 942 | port->read_urb->dev = port->serial->dev; | 898 | port->read_urb->dev = port->serial->dev; |
| 943 | ret = usb_submit_urb( port->read_urb, GFP_ATOMIC ); | 899 | ret = usb_submit_urb(port->read_urb, GFP_ATOMIC); |
| 944 | } | 900 | } |
| 945 | 901 | ||
| 946 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 902 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
| 947 | |||
| 948 | if( ret ) { | ||
| 949 | err("%s: usb_submit_urb failed, ret=%d, port=%d", __FUNCTION__, | ||
| 950 | ret, priv->dp_port_num ); | ||
| 951 | } | ||
| 952 | 903 | ||
| 904 | if (ret) | ||
| 905 | err("%s: usb_submit_urb failed, ret=%d, port=%d", | ||
| 906 | __FUNCTION__, ret, priv->dp_port_num); | ||
| 953 | } | 907 | } |
| 954 | 908 | ||
| 955 | 909 | ||
| 956 | static void digi_set_termios( struct usb_serial_port *port, | 910 | static void digi_set_termios(struct usb_serial_port *port, |
| 957 | struct ktermios *old_termios ) | 911 | struct ktermios *old_termios) |
| 958 | { | 912 | { |
| 959 | 913 | ||
| 960 | struct digi_port *priv = usb_get_serial_port_data(port); | 914 | struct digi_port *priv = usb_get_serial_port_data(port); |
| 961 | unsigned int iflag = port->tty->termios->c_iflag; | 915 | struct tty_struct *tty = port->tty; |
| 962 | unsigned int cflag = port->tty->termios->c_cflag; | 916 | unsigned int iflag = tty->termios->c_iflag; |
| 917 | unsigned int cflag = tty->termios->c_cflag; | ||
| 963 | unsigned int old_iflag = old_termios->c_iflag; | 918 | unsigned int old_iflag = old_termios->c_iflag; |
| 964 | unsigned int old_cflag = old_termios->c_cflag; | 919 | unsigned int old_cflag = old_termios->c_cflag; |
| 965 | unsigned char buf[32]; | 920 | unsigned char buf[32]; |
| 966 | unsigned int modem_signals; | 921 | unsigned int modem_signals; |
| 967 | int arg,ret; | 922 | int arg,ret; |
| 968 | int i = 0; | 923 | int i = 0; |
| 924 | speed_t baud; | ||
| 969 | 925 | ||
| 970 | 926 | dbg("digi_set_termios: TOP: port=%d, iflag=0x%x, old_iflag=0x%x, cflag=0x%x, old_cflag=0x%x", priv->dp_port_num, iflag, old_iflag, cflag, old_cflag); | |
| 971 | dbg( "digi_set_termios: TOP: port=%d, iflag=0x%x, old_iflag=0x%x, cflag=0x%x, old_cflag=0x%x", priv->dp_port_num, iflag, old_iflag, cflag, old_cflag ); | ||
| 972 | 927 | ||
| 973 | /* set baud rate */ | 928 | /* set baud rate */ |
| 974 | if( (cflag&CBAUD) != (old_cflag&CBAUD) ) { | 929 | if ((baud = tty_get_baud_rate(tty)) != tty_termios_baud_rate(old_termios)) { |
| 975 | |||
| 976 | arg = -1; | 930 | arg = -1; |
| 977 | 931 | ||
| 978 | /* reassert DTR and (maybe) RTS on transition from B0 */ | 932 | /* reassert DTR and (maybe) RTS on transition from B0 */ |
| 979 | if( (old_cflag&CBAUD) == B0 ) { | 933 | if ((old_cflag&CBAUD) == B0) { |
| 980 | /* don't set RTS if using hardware flow control */ | 934 | /* don't set RTS if using hardware flow control */ |
| 981 | /* and throttling input */ | 935 | /* and throttling input */ |
| 982 | modem_signals = TIOCM_DTR; | 936 | modem_signals = TIOCM_DTR; |
| 983 | if( !(port->tty->termios->c_cflag & CRTSCTS) || | 937 | if (!(tty->termios->c_cflag & CRTSCTS) || |
| 984 | !test_bit(TTY_THROTTLED, &port->tty->flags) ) { | 938 | !test_bit(TTY_THROTTLED, &tty->flags)) |
| 985 | modem_signals |= TIOCM_RTS; | 939 | modem_signals |= TIOCM_RTS; |
| 986 | } | 940 | digi_set_modem_signals(port, modem_signals, 1); |
| 987 | digi_set_modem_signals( port, modem_signals, 1 ); | ||
| 988 | } | 941 | } |
| 989 | 942 | switch (baud) { | |
| 990 | switch( (cflag&CBAUD) ) { | ||
| 991 | /* drop DTR and RTS on transition to B0 */ | 943 | /* drop DTR and RTS on transition to B0 */ |
| 992 | case B0: digi_set_modem_signals( port, 0, 1 ); break; | 944 | case 0: digi_set_modem_signals(port, 0, 1); break; |
| 993 | case B50: arg = DIGI_BAUD_50; break; | 945 | case 50: arg = DIGI_BAUD_50; break; |
| 994 | case B75: arg = DIGI_BAUD_75; break; | 946 | case 75: arg = DIGI_BAUD_75; break; |
| 995 | case B110: arg = DIGI_BAUD_110; break; | 947 | case 110: arg = DIGI_BAUD_110; break; |
| 996 | case B150: arg = DIGI_BAUD_150; break; | 948 | case 150: arg = DIGI_BAUD_150; break; |
| 997 | case B200: arg = DIGI_BAUD_200; break; | 949 | case 200: arg = DIGI_BAUD_200; break; |
| 998 | case B300: arg = DIGI_BAUD_300; break; | 950 | case 300: arg = DIGI_BAUD_300; break; |
| 999 | case B600: arg = DIGI_BAUD_600; break; | 951 | case 600: arg = DIGI_BAUD_600; break; |
| 1000 | case B1200: arg = DIGI_BAUD_1200; break; | 952 | case 1200: arg = DIGI_BAUD_1200; break; |
| 1001 | case B1800: arg = DIGI_BAUD_1800; break; | 953 | case 1800: arg = DIGI_BAUD_1800; break; |
| 1002 | case B2400: arg = DIGI_BAUD_2400; break; | 954 | case 2400: arg = DIGI_BAUD_2400; break; |
| 1003 | case B4800: arg = DIGI_BAUD_4800; break; | 955 | case 4800: arg = DIGI_BAUD_4800; break; |
| 1004 | case B9600: arg = DIGI_BAUD_9600; break; | 956 | case 9600: arg = DIGI_BAUD_9600; break; |
| 1005 | case B19200: arg = DIGI_BAUD_19200; break; | 957 | case 19200: arg = DIGI_BAUD_19200; break; |
| 1006 | case B38400: arg = DIGI_BAUD_38400; break; | 958 | case 38400: arg = DIGI_BAUD_38400; break; |
| 1007 | case B57600: arg = DIGI_BAUD_57600; break; | 959 | case 57600: arg = DIGI_BAUD_57600; break; |
| 1008 | case B115200: arg = DIGI_BAUD_115200; break; | 960 | case 115200: arg = DIGI_BAUD_115200; break; |
| 1009 | case B230400: arg = DIGI_BAUD_230400; break; | 961 | case 230400: arg = DIGI_BAUD_230400; break; |
| 1010 | case B460800: arg = DIGI_BAUD_460800; break; | 962 | case 460800: arg = DIGI_BAUD_460800; break; |
| 1011 | default: | 963 | default: |
| 1012 | dbg( "digi_set_termios: can't handle baud rate 0x%x", | 964 | arg = DIGI_BAUD_9600; |
| 1013 | (cflag&CBAUD) ); | 965 | baud = 9600; |
| 1014 | break; | 966 | break; |
| 1015 | } | 967 | } |
| 1016 | 968 | if (arg != -1) { | |
| 1017 | if( arg != -1 ) { | ||
| 1018 | buf[i++] = DIGI_CMD_SET_BAUD_RATE; | 969 | buf[i++] = DIGI_CMD_SET_BAUD_RATE; |
| 1019 | buf[i++] = priv->dp_port_num; | 970 | buf[i++] = priv->dp_port_num; |
| 1020 | buf[i++] = arg; | 971 | buf[i++] = arg; |
| 1021 | buf[i++] = 0; | 972 | buf[i++] = 0; |
| 1022 | } | 973 | } |
| 1023 | |||
| 1024 | } | 974 | } |
| 1025 | |||
| 1026 | /* set parity */ | 975 | /* set parity */ |
| 1027 | if( (cflag&(PARENB|PARODD)) != (old_cflag&(PARENB|PARODD)) ) { | 976 | if ((cflag&(PARENB|PARODD)) != (old_cflag&(PARENB|PARODD))) { |
| 1028 | 977 | if (cflag&PARENB) { | |
| 1029 | if( (cflag&PARENB) ) { | 978 | if (cflag&PARODD) |
| 1030 | if( (cflag&PARODD) ) | ||
| 1031 | arg = DIGI_PARITY_ODD; | 979 | arg = DIGI_PARITY_ODD; |
| 1032 | else | 980 | else |
| 1033 | arg = DIGI_PARITY_EVEN; | 981 | arg = DIGI_PARITY_EVEN; |
| 1034 | } else { | 982 | } else { |
| 1035 | arg = DIGI_PARITY_NONE; | 983 | arg = DIGI_PARITY_NONE; |
| 1036 | } | 984 | } |
| 1037 | |||
| 1038 | buf[i++] = DIGI_CMD_SET_PARITY; | 985 | buf[i++] = DIGI_CMD_SET_PARITY; |
| 1039 | buf[i++] = priv->dp_port_num; | 986 | buf[i++] = priv->dp_port_num; |
| 1040 | buf[i++] = arg; | 987 | buf[i++] = arg; |
| 1041 | buf[i++] = 0; | 988 | buf[i++] = 0; |
| 1042 | |||
| 1043 | } | 989 | } |
| 1044 | |||
| 1045 | /* set word size */ | 990 | /* set word size */ |
| 1046 | if( (cflag&CSIZE) != (old_cflag&CSIZE) ) { | 991 | if ((cflag&CSIZE) != (old_cflag&CSIZE)) { |
| 1047 | |||
| 1048 | arg = -1; | 992 | arg = -1; |
| 1049 | 993 | switch (cflag&CSIZE) { | |
| 1050 | switch( (cflag&CSIZE) ) { | ||
| 1051 | case CS5: arg = DIGI_WORD_SIZE_5; break; | 994 | case CS5: arg = DIGI_WORD_SIZE_5; break; |
| 1052 | case CS6: arg = DIGI_WORD_SIZE_6; break; | 995 | case CS6: arg = DIGI_WORD_SIZE_6; break; |
| 1053 | case CS7: arg = DIGI_WORD_SIZE_7; break; | 996 | case CS7: arg = DIGI_WORD_SIZE_7; break; |
| 1054 | case CS8: arg = DIGI_WORD_SIZE_8; break; | 997 | case CS8: arg = DIGI_WORD_SIZE_8; break; |
| 1055 | default: | 998 | default: |
| 1056 | dbg( "digi_set_termios: can't handle word size %d", | 999 | dbg("digi_set_termios: can't handle word size %d", |
| 1057 | (cflag&CSIZE) ); | 1000 | (cflag&CSIZE)); |
| 1058 | break; | 1001 | break; |
| 1059 | } | 1002 | } |
| 1060 | 1003 | ||
| 1061 | if( arg != -1 ) { | 1004 | if (arg != -1) { |
| 1062 | buf[i++] = DIGI_CMD_SET_WORD_SIZE; | 1005 | buf[i++] = DIGI_CMD_SET_WORD_SIZE; |
| 1063 | buf[i++] = priv->dp_port_num; | 1006 | buf[i++] = priv->dp_port_num; |
| 1064 | buf[i++] = arg; | 1007 | buf[i++] = arg; |
| @@ -1068,9 +1011,9 @@ dbg( "digi_set_termios: TOP: port=%d, iflag=0x%x, old_iflag=0x%x, cflag=0x%x, ol | |||
| 1068 | } | 1011 | } |
| 1069 | 1012 | ||
| 1070 | /* set stop bits */ | 1013 | /* set stop bits */ |
| 1071 | if( (cflag&CSTOPB) != (old_cflag&CSTOPB) ) { | 1014 | if ((cflag&CSTOPB) != (old_cflag&CSTOPB)) { |
| 1072 | 1015 | ||
| 1073 | if( (cflag&CSTOPB) ) | 1016 | if ((cflag&CSTOPB)) |
| 1074 | arg = DIGI_STOP_BITS_2; | 1017 | arg = DIGI_STOP_BITS_2; |
| 1075 | else | 1018 | else |
| 1076 | arg = DIGI_STOP_BITS_1; | 1019 | arg = DIGI_STOP_BITS_1; |
| @@ -1083,18 +1026,15 @@ dbg( "digi_set_termios: TOP: port=%d, iflag=0x%x, old_iflag=0x%x, cflag=0x%x, ol | |||
| 1083 | } | 1026 | } |
| 1084 | 1027 | ||
| 1085 | /* set input flow control */ | 1028 | /* set input flow control */ |
| 1086 | if( (iflag&IXOFF) != (old_iflag&IXOFF) | 1029 | if ((iflag&IXOFF) != (old_iflag&IXOFF) |
| 1087 | || (cflag&CRTSCTS) != (old_cflag&CRTSCTS) ) { | 1030 | || (cflag&CRTSCTS) != (old_cflag&CRTSCTS)) { |
| 1088 | |||
| 1089 | arg = 0; | 1031 | arg = 0; |
| 1090 | 1032 | if (iflag&IXOFF) | |
| 1091 | if( (iflag&IXOFF) ) | ||
| 1092 | arg |= DIGI_INPUT_FLOW_CONTROL_XON_XOFF; | 1033 | arg |= DIGI_INPUT_FLOW_CONTROL_XON_XOFF; |
| 1093 | else | 1034 | else |
| 1094 | arg &= ~DIGI_INPUT_FLOW_CONTROL_XON_XOFF; | 1035 | arg &= ~DIGI_INPUT_FLOW_CONTROL_XON_XOFF; |
| 1095 | 1036 | ||
| 1096 | if( (cflag&CRTSCTS) ) { | 1037 | if (cflag&CRTSCTS) { |
| 1097 | |||
| 1098 | arg |= DIGI_INPUT_FLOW_CONTROL_RTS; | 1038 | arg |= DIGI_INPUT_FLOW_CONTROL_RTS; |
| 1099 | 1039 | ||
| 1100 | /* On USB-4 it is necessary to assert RTS prior */ | 1040 | /* On USB-4 it is necessary to assert RTS prior */ |
| @@ -1107,43 +1047,37 @@ dbg( "digi_set_termios: TOP: port=%d, iflag=0x%x, old_iflag=0x%x, cflag=0x%x, ol | |||
| 1107 | } else { | 1047 | } else { |
| 1108 | arg &= ~DIGI_INPUT_FLOW_CONTROL_RTS; | 1048 | arg &= ~DIGI_INPUT_FLOW_CONTROL_RTS; |
| 1109 | } | 1049 | } |
| 1110 | |||
| 1111 | buf[i++] = DIGI_CMD_SET_INPUT_FLOW_CONTROL; | 1050 | buf[i++] = DIGI_CMD_SET_INPUT_FLOW_CONTROL; |
| 1112 | buf[i++] = priv->dp_port_num; | 1051 | buf[i++] = priv->dp_port_num; |
| 1113 | buf[i++] = arg; | 1052 | buf[i++] = arg; |
| 1114 | buf[i++] = 0; | 1053 | buf[i++] = 0; |
| 1115 | |||
| 1116 | } | 1054 | } |
| 1117 | 1055 | ||
| 1118 | /* set output flow control */ | 1056 | /* set output flow control */ |
| 1119 | if( (iflag&IXON) != (old_iflag&IXON) | 1057 | if ((iflag&IXON) != (old_iflag&IXON) |
| 1120 | || (cflag&CRTSCTS) != (old_cflag&CRTSCTS) ) { | 1058 | || (cflag&CRTSCTS) != (old_cflag&CRTSCTS)) { |
| 1121 | |||
| 1122 | arg = 0; | 1059 | arg = 0; |
| 1123 | 1060 | if (iflag&IXON) | |
| 1124 | if( (iflag&IXON) ) | ||
| 1125 | arg |= DIGI_OUTPUT_FLOW_CONTROL_XON_XOFF; | 1061 | arg |= DIGI_OUTPUT_FLOW_CONTROL_XON_XOFF; |
| 1126 | else | 1062 | else |
| 1127 | arg &= ~DIGI_OUTPUT_FLOW_CONTROL_XON_XOFF; | 1063 | arg &= ~DIGI_OUTPUT_FLOW_CONTROL_XON_XOFF; |
| 1128 | 1064 | ||
| 1129 | if( (cflag&CRTSCTS) ) { | 1065 | if (cflag&CRTSCTS) { |
| 1130 | arg |= DIGI_OUTPUT_FLOW_CONTROL_CTS; | 1066 | arg |= DIGI_OUTPUT_FLOW_CONTROL_CTS; |
| 1131 | } else { | 1067 | } else { |
| 1132 | arg &= ~DIGI_OUTPUT_FLOW_CONTROL_CTS; | 1068 | arg &= ~DIGI_OUTPUT_FLOW_CONTROL_CTS; |
| 1133 | port->tty->hw_stopped = 0; | 1069 | tty->hw_stopped = 0; |
| 1134 | } | 1070 | } |
| 1135 | 1071 | ||
| 1136 | buf[i++] = DIGI_CMD_SET_OUTPUT_FLOW_CONTROL; | 1072 | buf[i++] = DIGI_CMD_SET_OUTPUT_FLOW_CONTROL; |
| 1137 | buf[i++] = priv->dp_port_num; | 1073 | buf[i++] = priv->dp_port_num; |
| 1138 | buf[i++] = arg; | 1074 | buf[i++] = arg; |
| 1139 | buf[i++] = 0; | 1075 | buf[i++] = 0; |
| 1140 | |||
| 1141 | } | 1076 | } |
| 1142 | 1077 | ||
| 1143 | /* set receive enable/disable */ | 1078 | /* set receive enable/disable */ |
| 1144 | if( (cflag&CREAD) != (old_cflag&CREAD) ) { | 1079 | if ((cflag&CREAD) != (old_cflag&CREAD)) { |
| 1145 | 1080 | if (cflag&CREAD) | |
| 1146 | if( (cflag&CREAD) ) | ||
| 1147 | arg = DIGI_ENABLE; | 1081 | arg = DIGI_ENABLE; |
| 1148 | else | 1082 | else |
| 1149 | arg = DIGI_DISABLE; | 1083 | arg = DIGI_DISABLE; |
| @@ -1152,32 +1086,26 @@ dbg( "digi_set_termios: TOP: port=%d, iflag=0x%x, old_iflag=0x%x, cflag=0x%x, ol | |||
| 1152 | buf[i++] = priv->dp_port_num; | 1086 | buf[i++] = priv->dp_port_num; |
| 1153 | buf[i++] = arg; | 1087 | buf[i++] = arg; |
| 1154 | buf[i++] = 0; | 1088 | buf[i++] = 0; |
| 1155 | |||
| 1156 | } | 1089 | } |
| 1157 | 1090 | if ((ret = digi_write_oob_command(port, buf, i, 1)) != 0) | |
| 1158 | if( (ret=digi_write_oob_command( port, buf, i, 1 )) != 0 ) | 1091 | dbg("digi_set_termios: write oob failed, ret=%d", ret); |
| 1159 | dbg( "digi_set_termios: write oob failed, ret=%d", ret ); | ||
| 1160 | 1092 | ||
| 1161 | } | 1093 | } |
| 1162 | 1094 | ||
| 1163 | 1095 | ||
| 1164 | static void digi_break_ctl( struct usb_serial_port *port, int break_state ) | 1096 | static void digi_break_ctl(struct usb_serial_port *port, int break_state) |
| 1165 | { | 1097 | { |
| 1166 | |||
| 1167 | unsigned char buf[4]; | 1098 | unsigned char buf[4]; |
| 1168 | 1099 | ||
| 1169 | |||
| 1170 | buf[0] = DIGI_CMD_BREAK_CONTROL; | 1100 | buf[0] = DIGI_CMD_BREAK_CONTROL; |
| 1171 | buf[1] = 2; /* length */ | 1101 | buf[1] = 2; /* length */ |
| 1172 | buf[2] = break_state ? 1 : 0; | 1102 | buf[2] = break_state ? 1 : 0; |
| 1173 | buf[3] = 0; /* pad */ | 1103 | buf[3] = 0; /* pad */ |
| 1174 | 1104 | digi_write_inb_command(port, buf, 4, 0); | |
| 1175 | digi_write_inb_command( port, buf, 4, 0 ); | ||
| 1176 | |||
| 1177 | } | 1105 | } |
| 1178 | 1106 | ||
| 1179 | 1107 | ||
| 1180 | static int digi_tiocmget( struct usb_serial_port *port, struct file *file ) | 1108 | static int digi_tiocmget(struct usb_serial_port *port, struct file *file) |
| 1181 | { | 1109 | { |
| 1182 | struct digi_port *priv = usb_get_serial_port_data(port); | 1110 | struct digi_port *priv = usb_get_serial_port_data(port); |
| 1183 | unsigned int val; | 1111 | unsigned int val; |
| @@ -1185,15 +1113,15 @@ static int digi_tiocmget( struct usb_serial_port *port, struct file *file ) | |||
| 1185 | 1113 | ||
| 1186 | dbg("%s: TOP: port=%d", __FUNCTION__, priv->dp_port_num); | 1114 | dbg("%s: TOP: port=%d", __FUNCTION__, priv->dp_port_num); |
| 1187 | 1115 | ||
| 1188 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 1116 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
| 1189 | val = priv->dp_modem_signals; | 1117 | val = priv->dp_modem_signals; |
| 1190 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 1118 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
| 1191 | return val; | 1119 | return val; |
| 1192 | } | 1120 | } |
| 1193 | 1121 | ||
| 1194 | 1122 | ||
| 1195 | static int digi_tiocmset( struct usb_serial_port *port, struct file *file, | 1123 | static int digi_tiocmset(struct usb_serial_port *port, struct file *file, |
| 1196 | unsigned int set, unsigned int clear ) | 1124 | unsigned int set, unsigned int clear) |
| 1197 | { | 1125 | { |
| 1198 | struct digi_port *priv = usb_get_serial_port_data(port); | 1126 | struct digi_port *priv = usb_get_serial_port_data(port); |
| 1199 | unsigned int val; | 1127 | unsigned int val; |
| @@ -1201,41 +1129,34 @@ static int digi_tiocmset( struct usb_serial_port *port, struct file *file, | |||
| 1201 | 1129 | ||
| 1202 | dbg("%s: TOP: port=%d", __FUNCTION__, priv->dp_port_num); | 1130 | dbg("%s: TOP: port=%d", __FUNCTION__, priv->dp_port_num); |
| 1203 | 1131 | ||
| 1204 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 1132 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
| 1205 | val = (priv->dp_modem_signals & ~clear) | set; | 1133 | val = (priv->dp_modem_signals & ~clear) | set; |
| 1206 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 1134 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
| 1207 | return digi_set_modem_signals( port, val, 1 ); | 1135 | return digi_set_modem_signals(port, val, 1); |
| 1208 | } | 1136 | } |
| 1209 | 1137 | ||
| 1210 | 1138 | ||
| 1211 | static int digi_ioctl( struct usb_serial_port *port, struct file *file, | 1139 | static int digi_ioctl(struct usb_serial_port *port, struct file *file, |
| 1212 | unsigned int cmd, unsigned long arg ) | 1140 | unsigned int cmd, unsigned long arg) |
| 1213 | { | 1141 | { |
| 1214 | |||
| 1215 | struct digi_port *priv = usb_get_serial_port_data(port); | 1142 | struct digi_port *priv = usb_get_serial_port_data(port); |
| 1216 | 1143 | dbg("digi_ioctl: TOP: port=%d, cmd=0x%x", priv->dp_port_num, cmd); | |
| 1217 | dbg( "digi_ioctl: TOP: port=%d, cmd=0x%x", priv->dp_port_num, cmd ); | ||
| 1218 | 1144 | ||
| 1219 | switch (cmd) { | 1145 | switch (cmd) { |
| 1220 | |||
| 1221 | case TIOCMIWAIT: | 1146 | case TIOCMIWAIT: |
| 1222 | /* wait for any of the 4 modem inputs (DCD,RI,DSR,CTS)*/ | 1147 | /* wait for any of the 4 modem inputs (DCD,RI,DSR,CTS)*/ |
| 1223 | /* TODO */ | 1148 | /* TODO */ |
| 1224 | return( 0 ); | 1149 | return 0; |
| 1225 | |||
| 1226 | case TIOCGICOUNT: | 1150 | case TIOCGICOUNT: |
| 1227 | /* return count of modemline transitions */ | 1151 | /* return count of modemline transitions */ |
| 1228 | /* TODO */ | 1152 | /* TODO */ |
| 1229 | return 0; | 1153 | return 0; |
| 1230 | |||
| 1231 | } | 1154 | } |
| 1232 | 1155 | return -ENOIOCTLCMD; | |
| 1233 | return( -ENOIOCTLCMD ); | ||
| 1234 | 1156 | ||
| 1235 | } | 1157 | } |
| 1236 | 1158 | ||
| 1237 | 1159 | static int digi_write(struct usb_serial_port *port, const unsigned char *buf, int count) | |
| 1238 | static int digi_write( struct usb_serial_port *port, const unsigned char *buf, int count ) | ||
| 1239 | { | 1160 | { |
| 1240 | 1161 | ||
| 1241 | int ret,data_len,new_len; | 1162 | int ret,data_len,new_len; |
| @@ -1243,35 +1164,29 @@ static int digi_write( struct usb_serial_port *port, const unsigned char *buf, i | |||
| 1243 | unsigned char *data = port->write_urb->transfer_buffer; | 1164 | unsigned char *data = port->write_urb->transfer_buffer; |
| 1244 | unsigned long flags = 0; | 1165 | unsigned long flags = 0; |
| 1245 | 1166 | ||
| 1246 | 1167 | dbg("digi_write: TOP: port=%d, count=%d, in_interrupt=%ld", | |
| 1247 | dbg( "digi_write: TOP: port=%d, count=%d, in_interrupt=%ld", | 1168 | priv->dp_port_num, count, in_interrupt()); |
| 1248 | priv->dp_port_num, count, in_interrupt() ); | ||
| 1249 | 1169 | ||
| 1250 | /* copy user data (which can sleep) before getting spin lock */ | 1170 | /* copy user data (which can sleep) before getting spin lock */ |
| 1251 | count = min( count, port->bulk_out_size-2 ); | 1171 | count = min(count, port->bulk_out_size-2); |
| 1252 | count = min( 64, count); | 1172 | count = min(64, count); |
| 1253 | 1173 | ||
| 1254 | /* be sure only one write proceeds at a time */ | 1174 | /* be sure only one write proceeds at a time */ |
| 1255 | /* there are races on the port private buffer */ | 1175 | /* there are races on the port private buffer */ |
| 1256 | /* and races to check write_urb->status */ | 1176 | /* and races to check write_urb->status */ |
| 1257 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 1177 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
| 1258 | 1178 | ||
| 1259 | /* wait for urb status clear to submit another urb */ | 1179 | /* wait for urb status clear to submit another urb */ |
| 1260 | if( port->write_urb->status == -EINPROGRESS | 1180 | if (port->write_urb->status == -EINPROGRESS || priv->dp_write_urb_in_use) { |
| 1261 | || priv->dp_write_urb_in_use ) { | ||
| 1262 | |||
| 1263 | /* buffer data if count is 1 (probably put_char) if possible */ | 1181 | /* buffer data if count is 1 (probably put_char) if possible */ |
| 1264 | if( count == 1 && priv->dp_out_buf_len < DIGI_OUT_BUF_SIZE ) { | 1182 | if (count == 1 && priv->dp_out_buf_len < DIGI_OUT_BUF_SIZE) { |
| 1265 | priv->dp_out_buf[priv->dp_out_buf_len++] = *buf; | 1183 | priv->dp_out_buf[priv->dp_out_buf_len++] = *buf; |
| 1266 | new_len = 1; | 1184 | new_len = 1; |
| 1267 | } else { | 1185 | } else { |
| 1268 | new_len = 0; | 1186 | new_len = 0; |
| 1269 | } | 1187 | } |
| 1270 | 1188 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); | |
| 1271 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 1189 | return new_len; |
| 1272 | |||
| 1273 | return( new_len ); | ||
| 1274 | |||
| 1275 | } | 1190 | } |
| 1276 | 1191 | ||
| 1277 | /* allow space for any buffered data and for new data, up to */ | 1192 | /* allow space for any buffered data and for new data, up to */ |
| @@ -1279,9 +1194,9 @@ priv->dp_port_num, count, in_interrupt() ); | |||
| 1279 | new_len = min(count, port->bulk_out_size-2-priv->dp_out_buf_len); | 1194 | new_len = min(count, port->bulk_out_size-2-priv->dp_out_buf_len); |
| 1280 | data_len = new_len + priv->dp_out_buf_len; | 1195 | data_len = new_len + priv->dp_out_buf_len; |
| 1281 | 1196 | ||
| 1282 | if( data_len == 0 ) { | 1197 | if (data_len == 0) { |
| 1283 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 1198 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
| 1284 | return( 0 ); | 1199 | return 0; |
| 1285 | } | 1200 | } |
| 1286 | 1201 | ||
| 1287 | port->write_urb->transfer_buffer_length = data_len+2; | 1202 | port->write_urb->transfer_buffer_length = data_len+2; |
| @@ -1291,32 +1206,29 @@ priv->dp_port_num, count, in_interrupt() ); | |||
| 1291 | *data++ = data_len; | 1206 | *data++ = data_len; |
| 1292 | 1207 | ||
| 1293 | /* copy in buffered data first */ | 1208 | /* copy in buffered data first */ |
| 1294 | memcpy( data, priv->dp_out_buf, priv->dp_out_buf_len ); | 1209 | memcpy(data, priv->dp_out_buf, priv->dp_out_buf_len); |
| 1295 | data += priv->dp_out_buf_len; | 1210 | data += priv->dp_out_buf_len; |
| 1296 | 1211 | ||
| 1297 | /* copy in new data */ | 1212 | /* copy in new data */ |
| 1298 | memcpy( data, buf, new_len ); | 1213 | memcpy(data, buf, new_len); |
| 1299 | 1214 | ||
| 1300 | if( (ret=usb_submit_urb(port->write_urb, GFP_ATOMIC)) == 0 ) { | 1215 | if ((ret = usb_submit_urb(port->write_urb, GFP_ATOMIC)) == 0) { |
| 1301 | priv->dp_write_urb_in_use = 1; | 1216 | priv->dp_write_urb_in_use = 1; |
| 1302 | ret = new_len; | 1217 | ret = new_len; |
| 1303 | priv->dp_out_buf_len = 0; | 1218 | priv->dp_out_buf_len = 0; |
| 1304 | } | 1219 | } |
| 1305 | 1220 | ||
| 1306 | /* return length of new data written, or error */ | 1221 | /* return length of new data written, or error */ |
| 1307 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 1222 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
| 1308 | if( ret < 0 ) { | 1223 | if (ret < 0) |
| 1309 | err("%s: usb_submit_urb failed, ret=%d, port=%d", __FUNCTION__, | 1224 | err("%s: usb_submit_urb failed, ret=%d, port=%d", |
| 1310 | ret, priv->dp_port_num ); | 1225 | __FUNCTION__, ret, priv->dp_port_num); |
| 1311 | } | 1226 | dbg("digi_write: returning %d", ret); |
| 1312 | 1227 | return ret; | |
| 1313 | dbg( "digi_write: returning %d", ret ); | ||
| 1314 | return( ret ); | ||
| 1315 | 1228 | ||
| 1316 | } | 1229 | } |
| 1317 | 1230 | ||
| 1318 | 1231 | static void digi_write_bulk_callback(struct urb *urb) | |
| 1319 | static void digi_write_bulk_callback( struct urb *urb ) | ||
| 1320 | { | 1232 | { |
| 1321 | 1233 | ||
| 1322 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; | 1234 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; |
| @@ -1326,153 +1238,136 @@ static void digi_write_bulk_callback( struct urb *urb ) | |||
| 1326 | int ret = 0; | 1238 | int ret = 0; |
| 1327 | int status = urb->status; | 1239 | int status = urb->status; |
| 1328 | 1240 | ||
| 1329 | 1241 | dbg("digi_write_bulk_callback: TOP, urb->status=%d", status); | |
| 1330 | dbg("digi_write_bulk_callback: TOP, urb status=%d", status); | ||
| 1331 | 1242 | ||
| 1332 | /* port and serial sanity check */ | 1243 | /* port and serial sanity check */ |
| 1333 | if( port == NULL || (priv=usb_get_serial_port_data(port)) == NULL ) { | 1244 | if (port == NULL || (priv=usb_get_serial_port_data(port)) == NULL) { |
| 1334 | err("%s: port or port->private is NULL, status=%d", | 1245 | err("%s: port or port->private is NULL, status=%d", |
| 1335 | __FUNCTION__, status); | 1246 | __FUNCTION__, status); |
| 1336 | return; | 1247 | return; |
| 1337 | } | 1248 | } |
| 1338 | serial = port->serial; | 1249 | serial = port->serial; |
| 1339 | if( serial == NULL || (serial_priv=usb_get_serial_data(serial)) == NULL ) { | 1250 | if (serial == NULL || (serial_priv=usb_get_serial_data(serial)) == NULL) { |
| 1340 | err("%s: serial or serial->private is NULL, status=%d", | 1251 | err("%s: serial or serial->private is NULL, status=%d", |
| 1341 | __FUNCTION__, status); | 1252 | __FUNCTION__, status); |
| 1342 | return; | 1253 | return; |
| 1343 | } | 1254 | } |
| 1344 | 1255 | ||
| 1345 | /* handle oob callback */ | 1256 | /* handle oob callback */ |
| 1346 | if( priv->dp_port_num == serial_priv->ds_oob_port_num ) { | 1257 | if (priv->dp_port_num == serial_priv->ds_oob_port_num) { |
| 1347 | dbg( "digi_write_bulk_callback: oob callback" ); | 1258 | dbg("digi_write_bulk_callback: oob callback"); |
| 1348 | spin_lock( &priv->dp_port_lock ); | 1259 | spin_lock(&priv->dp_port_lock); |
| 1349 | priv->dp_write_urb_in_use = 0; | 1260 | priv->dp_write_urb_in_use = 0; |
| 1350 | wake_up_interruptible( &port->write_wait ); | 1261 | wake_up_interruptible(&port->write_wait); |
| 1351 | spin_unlock( &priv->dp_port_lock ); | 1262 | spin_unlock(&priv->dp_port_lock); |
| 1352 | return; | 1263 | return; |
| 1353 | } | 1264 | } |
| 1354 | 1265 | ||
| 1355 | /* try to send any buffered data on this port, if it is open */ | 1266 | /* try to send any buffered data on this port, if it is open */ |
| 1356 | spin_lock( &priv->dp_port_lock ); | 1267 | spin_lock(&priv->dp_port_lock); |
| 1357 | priv->dp_write_urb_in_use = 0; | 1268 | priv->dp_write_urb_in_use = 0; |
| 1358 | if( port->open_count && port->write_urb->status != -EINPROGRESS | 1269 | if (port->open_count && port->write_urb->status != -EINPROGRESS |
| 1359 | && priv->dp_out_buf_len > 0 ) { | 1270 | && priv->dp_out_buf_len > 0) { |
| 1360 | |||
| 1361 | *((unsigned char *)(port->write_urb->transfer_buffer)) | 1271 | *((unsigned char *)(port->write_urb->transfer_buffer)) |
| 1362 | = (unsigned char)DIGI_CMD_SEND_DATA; | 1272 | = (unsigned char)DIGI_CMD_SEND_DATA; |
| 1363 | *((unsigned char *)(port->write_urb->transfer_buffer)+1) | 1273 | *((unsigned char *)(port->write_urb->transfer_buffer)+1) |
| 1364 | = (unsigned char)priv->dp_out_buf_len; | 1274 | = (unsigned char)priv->dp_out_buf_len; |
| 1365 | 1275 | port->write_urb->transfer_buffer_length = priv->dp_out_buf_len+2; | |
| 1366 | port->write_urb->transfer_buffer_length | ||
| 1367 | = priv->dp_out_buf_len+2; | ||
| 1368 | port->write_urb->dev = serial->dev; | 1276 | port->write_urb->dev = serial->dev; |
| 1369 | 1277 | memcpy(port->write_urb->transfer_buffer+2, priv->dp_out_buf, | |
| 1370 | memcpy( port->write_urb->transfer_buffer+2, priv->dp_out_buf, | 1278 | priv->dp_out_buf_len); |
| 1371 | priv->dp_out_buf_len ); | 1279 | if ((ret = usb_submit_urb(port->write_urb, GFP_ATOMIC)) == 0) { |
| 1372 | |||
| 1373 | if( (ret=usb_submit_urb(port->write_urb, GFP_ATOMIC)) == 0 ) { | ||
| 1374 | priv->dp_write_urb_in_use = 1; | 1280 | priv->dp_write_urb_in_use = 1; |
| 1375 | priv->dp_out_buf_len = 0; | 1281 | priv->dp_out_buf_len = 0; |
| 1376 | } | 1282 | } |
| 1377 | |||
| 1378 | } | 1283 | } |
| 1379 | |||
| 1380 | /* wake up processes sleeping on writes immediately */ | 1284 | /* wake up processes sleeping on writes immediately */ |
| 1381 | digi_wakeup_write( port ); | 1285 | digi_wakeup_write(port); |
| 1382 | |||
| 1383 | /* also queue up a wakeup at scheduler time, in case we */ | 1286 | /* also queue up a wakeup at scheduler time, in case we */ |
| 1384 | /* lost the race in write_chan(). */ | 1287 | /* lost the race in write_chan(). */ |
| 1385 | schedule_work(&priv->dp_wakeup_work); | 1288 | schedule_work(&priv->dp_wakeup_work); |
| 1386 | 1289 | ||
| 1387 | spin_unlock( &priv->dp_port_lock ); | 1290 | spin_unlock(&priv->dp_port_lock); |
| 1388 | 1291 | if (ret) | |
| 1389 | if( ret ) { | 1292 | err("%s: usb_submit_urb failed, ret=%d, port=%d", |
| 1390 | err("%s: usb_submit_urb failed, ret=%d, port=%d", __FUNCTION__, | 1293 | __FUNCTION__, ret, priv->dp_port_num); |
| 1391 | ret, priv->dp_port_num ); | ||
| 1392 | } | ||
| 1393 | |||
| 1394 | } | 1294 | } |
| 1395 | 1295 | ||
| 1396 | 1296 | static int digi_write_room(struct usb_serial_port *port) | |
| 1397 | static int digi_write_room( struct usb_serial_port *port ) | ||
| 1398 | { | 1297 | { |
| 1399 | 1298 | ||
| 1400 | int room; | 1299 | int room; |
| 1401 | struct digi_port *priv = usb_get_serial_port_data(port); | 1300 | struct digi_port *priv = usb_get_serial_port_data(port); |
| 1402 | unsigned long flags = 0; | 1301 | unsigned long flags = 0; |
| 1403 | 1302 | ||
| 1303 | spin_lock_irqsave(&priv->dp_port_lock, flags); | ||
| 1404 | 1304 | ||
| 1405 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 1305 | if (port->write_urb->status == -EINPROGRESS || priv->dp_write_urb_in_use) |
| 1406 | |||
| 1407 | if( port->write_urb->status == -EINPROGRESS | ||
| 1408 | || priv->dp_write_urb_in_use ) | ||
| 1409 | room = 0; | 1306 | room = 0; |
| 1410 | else | 1307 | else |
| 1411 | room = port->bulk_out_size - 2 - priv->dp_out_buf_len; | 1308 | room = port->bulk_out_size - 2 - priv->dp_out_buf_len; |
| 1412 | 1309 | ||
| 1413 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 1310 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
| 1414 | 1311 | dbg("digi_write_room: port=%d, room=%d", priv->dp_port_num, room); | |
| 1415 | dbg( "digi_write_room: port=%d, room=%d", priv->dp_port_num, room ); | 1312 | return room; |
| 1416 | return( room ); | ||
| 1417 | 1313 | ||
| 1418 | } | 1314 | } |
| 1419 | 1315 | ||
| 1420 | 1316 | static int digi_chars_in_buffer(struct usb_serial_port *port) | |
| 1421 | static int digi_chars_in_buffer( struct usb_serial_port *port ) | ||
| 1422 | { | 1317 | { |
| 1423 | 1318 | ||
| 1424 | struct digi_port *priv = usb_get_serial_port_data(port); | 1319 | struct digi_port *priv = usb_get_serial_port_data(port); |
| 1425 | 1320 | ||
| 1426 | 1321 | ||
| 1427 | if( port->write_urb->status == -EINPROGRESS | 1322 | if (port->write_urb->status == -EINPROGRESS |
| 1428 | || priv->dp_write_urb_in_use ) { | 1323 | || priv->dp_write_urb_in_use) { |
| 1429 | dbg( "digi_chars_in_buffer: port=%d, chars=%d", priv->dp_port_num, port->bulk_out_size - 2 ); | 1324 | dbg("digi_chars_in_buffer: port=%d, chars=%d", |
| 1430 | /* return( port->bulk_out_size - 2 ); */ | 1325 | priv->dp_port_num, port->bulk_out_size - 2); |
| 1431 | return( 256 ); | 1326 | /* return(port->bulk_out_size - 2); */ |
| 1327 | return 256; | ||
| 1432 | } else { | 1328 | } else { |
| 1433 | dbg( "digi_chars_in_buffer: port=%d, chars=%d", priv->dp_port_num, priv->dp_out_buf_len ); | 1329 | dbg("digi_chars_in_buffer: port=%d, chars=%d", |
| 1434 | return( priv->dp_out_buf_len ); | 1330 | priv->dp_port_num, priv->dp_out_buf_len); |
| 1331 | return priv->dp_out_buf_len; | ||
| 1435 | } | 1332 | } |
| 1436 | 1333 | ||
| 1437 | } | 1334 | } |
| 1438 | 1335 | ||
| 1439 | 1336 | ||
| 1440 | static int digi_open( struct usb_serial_port *port, struct file *filp ) | 1337 | static int digi_open(struct usb_serial_port *port, struct file *filp) |
| 1441 | { | 1338 | { |
| 1442 | |||
| 1443 | int ret; | 1339 | int ret; |
| 1444 | unsigned char buf[32]; | 1340 | unsigned char buf[32]; |
| 1445 | struct digi_port *priv = usb_get_serial_port_data(port); | 1341 | struct digi_port *priv = usb_get_serial_port_data(port); |
| 1446 | struct ktermios not_termios; | 1342 | struct ktermios not_termios; |
| 1447 | unsigned long flags = 0; | 1343 | unsigned long flags = 0; |
| 1448 | 1344 | ||
| 1449 | 1345 | dbg("digi_open: TOP: port=%d, open_count=%d", | |
| 1450 | dbg( "digi_open: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_count ); | 1346 | priv->dp_port_num, port->open_count); |
| 1451 | 1347 | ||
| 1452 | /* be sure the device is started up */ | 1348 | /* be sure the device is started up */ |
| 1453 | if( digi_startup_device( port->serial ) != 0 ) | 1349 | if (digi_startup_device(port->serial) != 0) |
| 1454 | return( -ENXIO ); | 1350 | return -ENXIO; |
| 1455 | 1351 | ||
| 1456 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 1352 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
| 1457 | 1353 | ||
| 1458 | /* don't wait on a close in progress for non-blocking opens */ | 1354 | /* don't wait on a close in progress for non-blocking opens */ |
| 1459 | if( priv->dp_in_close && (filp->f_flags&(O_NDELAY|O_NONBLOCK)) == 0 ) { | 1355 | if (priv->dp_in_close && (filp->f_flags&(O_NDELAY|O_NONBLOCK)) == 0) { |
| 1460 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 1356 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
| 1461 | return( -EAGAIN ); | 1357 | return -EAGAIN; |
| 1462 | } | 1358 | } |
| 1463 | 1359 | ||
| 1464 | /* wait for a close in progress to finish */ | 1360 | /* wait for a close in progress to finish */ |
| 1465 | while( priv->dp_in_close ) { | 1361 | while(priv->dp_in_close) { |
| 1466 | cond_wait_interruptible_timeout_irqrestore( | 1362 | cond_wait_interruptible_timeout_irqrestore( |
| 1467 | &priv->dp_close_wait, DIGI_RETRY_TIMEOUT, | 1363 | &priv->dp_close_wait, DIGI_RETRY_TIMEOUT, |
| 1468 | &priv->dp_port_lock, flags ); | 1364 | &priv->dp_port_lock, flags); |
| 1469 | if( signal_pending(current) ) { | 1365 | if (signal_pending(current)) |
| 1470 | return( -EINTR ); | 1366 | return -EINTR; |
| 1471 | } | 1367 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
| 1472 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | ||
| 1473 | } | 1368 | } |
| 1474 | 1369 | ||
| 1475 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 1370 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
| 1476 | 1371 | ||
| 1477 | /* read modem signals automatically whenever they change */ | 1372 | /* read modem signals automatically whenever they change */ |
| 1478 | buf[0] = DIGI_CMD_READ_INPUT_SIGNALS; | 1373 | buf[0] = DIGI_CMD_READ_INPUT_SIGNALS; |
| @@ -1486,23 +1381,22 @@ dbg( "digi_open: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_cou | |||
| 1486 | buf[6] = DIGI_FLUSH_TX | DIGI_FLUSH_RX; | 1381 | buf[6] = DIGI_FLUSH_TX | DIGI_FLUSH_RX; |
| 1487 | buf[7] = 0; | 1382 | buf[7] = 0; |
| 1488 | 1383 | ||
| 1489 | if( (ret=digi_write_oob_command( port, buf, 8, 1 )) != 0 ) | 1384 | if ((ret = digi_write_oob_command(port, buf, 8, 1)) != 0) |
| 1490 | dbg( "digi_open: write oob failed, ret=%d", ret ); | 1385 | dbg("digi_open: write oob failed, ret=%d", ret); |
| 1491 | 1386 | ||
| 1492 | /* set termios settings */ | 1387 | /* set termios settings */ |
| 1493 | not_termios.c_cflag = ~port->tty->termios->c_cflag; | 1388 | not_termios.c_cflag = ~port->tty->termios->c_cflag; |
| 1494 | not_termios.c_iflag = ~port->tty->termios->c_iflag; | 1389 | not_termios.c_iflag = ~port->tty->termios->c_iflag; |
| 1495 | digi_set_termios( port, ¬_termios ); | 1390 | digi_set_termios(port, ¬_termios); |
| 1496 | 1391 | ||
| 1497 | /* set DTR and RTS */ | 1392 | /* set DTR and RTS */ |
| 1498 | digi_set_modem_signals( port, TIOCM_DTR|TIOCM_RTS, 1 ); | 1393 | digi_set_modem_signals(port, TIOCM_DTR|TIOCM_RTS, 1); |
| 1499 | |||
| 1500 | return( 0 ); | ||
| 1501 | 1394 | ||
| 1395 | return 0; | ||
| 1502 | } | 1396 | } |
| 1503 | 1397 | ||
| 1504 | 1398 | ||
| 1505 | static void digi_close( struct usb_serial_port *port, struct file *filp ) | 1399 | static void digi_close(struct usb_serial_port *port, struct file *filp) |
| 1506 | { | 1400 | { |
| 1507 | DEFINE_WAIT(wait); | 1401 | DEFINE_WAIT(wait); |
| 1508 | int ret; | 1402 | int ret; |
| @@ -1511,40 +1405,37 @@ static void digi_close( struct usb_serial_port *port, struct file *filp ) | |||
| 1511 | struct digi_port *priv = usb_get_serial_port_data(port); | 1405 | struct digi_port *priv = usb_get_serial_port_data(port); |
| 1512 | unsigned long flags = 0; | 1406 | unsigned long flags = 0; |
| 1513 | 1407 | ||
| 1514 | 1408 | dbg("digi_close: TOP: port=%d, open_count=%d", | |
| 1515 | dbg( "digi_close: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_count ); | 1409 | priv->dp_port_num, port->open_count); |
| 1516 | |||
| 1517 | 1410 | ||
| 1518 | /* if disconnected, just clear flags */ | 1411 | /* if disconnected, just clear flags */ |
| 1519 | if (!usb_get_intfdata(port->serial->interface)) | 1412 | if (!usb_get_intfdata(port->serial->interface)) |
| 1520 | goto exit; | 1413 | goto exit; |
| 1521 | 1414 | ||
| 1522 | /* do cleanup only after final close on this port */ | 1415 | /* do cleanup only after final close on this port */ |
| 1523 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 1416 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
| 1524 | priv->dp_in_close = 1; | 1417 | priv->dp_in_close = 1; |
| 1525 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 1418 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
| 1526 | 1419 | ||
| 1527 | /* tell line discipline to process only XON/XOFF */ | 1420 | /* tell line discipline to process only XON/XOFF */ |
| 1528 | tty->closing = 1; | 1421 | tty->closing = 1; |
| 1529 | 1422 | ||
| 1530 | /* wait for output to drain */ | 1423 | /* wait for output to drain */ |
| 1531 | if( (filp->f_flags&(O_NDELAY|O_NONBLOCK)) == 0 ) { | 1424 | if ((filp->f_flags&(O_NDELAY|O_NONBLOCK)) == 0) |
| 1532 | tty_wait_until_sent( tty, DIGI_CLOSE_TIMEOUT ); | 1425 | tty_wait_until_sent(tty, DIGI_CLOSE_TIMEOUT); |
| 1533 | } | ||
| 1534 | 1426 | ||
| 1535 | /* flush driver and line discipline buffers */ | 1427 | /* flush driver and line discipline buffers */ |
| 1536 | if( tty->driver->flush_buffer ) | 1428 | if (tty->driver->flush_buffer) |
| 1537 | tty->driver->flush_buffer( tty ); | 1429 | tty->driver->flush_buffer(tty); |
| 1538 | tty_ldisc_flush(tty); | 1430 | tty_ldisc_flush(tty); |
| 1539 | 1431 | ||
| 1540 | if (port->serial->dev) { | 1432 | if (port->serial->dev) { |
| 1541 | /* wait for transmit idle */ | 1433 | /* wait for transmit idle */ |
| 1542 | if( (filp->f_flags&(O_NDELAY|O_NONBLOCK)) == 0 ) { | 1434 | if ((filp->f_flags&(O_NDELAY|O_NONBLOCK)) == 0) { |
| 1543 | digi_transmit_idle( port, DIGI_CLOSE_TIMEOUT ); | 1435 | digi_transmit_idle(port, DIGI_CLOSE_TIMEOUT); |
| 1544 | } | 1436 | } |
| 1545 | |||
| 1546 | /* drop DTR and RTS */ | 1437 | /* drop DTR and RTS */ |
| 1547 | digi_set_modem_signals( port, 0, 0 ); | 1438 | digi_set_modem_signals(port, 0, 0); |
| 1548 | 1439 | ||
| 1549 | /* disable input flow control */ | 1440 | /* disable input flow control */ |
| 1550 | buf[0] = DIGI_CMD_SET_INPUT_FLOW_CONTROL; | 1441 | buf[0] = DIGI_CMD_SET_INPUT_FLOW_CONTROL; |
| @@ -1576,8 +1467,8 @@ dbg( "digi_close: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_co | |||
| 1576 | buf[18] = DIGI_FLUSH_TX | DIGI_FLUSH_RX; | 1467 | buf[18] = DIGI_FLUSH_TX | DIGI_FLUSH_RX; |
| 1577 | buf[19] = 0; | 1468 | buf[19] = 0; |
| 1578 | 1469 | ||
| 1579 | if( (ret=digi_write_oob_command( port, buf, 20, 0 )) != 0 ) | 1470 | if ((ret = digi_write_oob_command(port, buf, 20, 0)) != 0) |
| 1580 | dbg( "digi_close: write oob failed, ret=%d", ret ); | 1471 | dbg("digi_close: write oob failed, ret=%d", ret); |
| 1581 | 1472 | ||
| 1582 | /* wait for final commands on oob port to complete */ | 1473 | /* wait for final commands on oob port to complete */ |
| 1583 | prepare_to_wait(&priv->dp_flush_wait, &wait, TASK_INTERRUPTIBLE); | 1474 | prepare_to_wait(&priv->dp_flush_wait, &wait, TASK_INTERRUPTIBLE); |
| @@ -1587,17 +1478,14 @@ dbg( "digi_close: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_co | |||
| 1587 | /* shutdown any outstanding bulk writes */ | 1478 | /* shutdown any outstanding bulk writes */ |
| 1588 | usb_kill_urb(port->write_urb); | 1479 | usb_kill_urb(port->write_urb); |
| 1589 | } | 1480 | } |
| 1590 | |||
| 1591 | tty->closing = 0; | 1481 | tty->closing = 0; |
| 1592 | |||
| 1593 | exit: | 1482 | exit: |
| 1594 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 1483 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
| 1595 | priv->dp_write_urb_in_use = 0; | 1484 | priv->dp_write_urb_in_use = 0; |
| 1596 | priv->dp_in_close = 0; | 1485 | priv->dp_in_close = 0; |
| 1597 | wake_up_interruptible( &priv->dp_close_wait ); | 1486 | wake_up_interruptible(&priv->dp_close_wait); |
| 1598 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 1487 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
| 1599 | 1488 | dbg("digi_close: done"); | |
| 1600 | dbg( "digi_close: done" ); | ||
| 1601 | } | 1489 | } |
| 1602 | 1490 | ||
| 1603 | 1491 | ||
| @@ -1608,155 +1496,136 @@ dbg( "digi_close: done" ); | |||
| 1608 | * urbs initialized. Returns 0 if successful, non-zero error otherwise. | 1496 | * urbs initialized. Returns 0 if successful, non-zero error otherwise. |
| 1609 | */ | 1497 | */ |
| 1610 | 1498 | ||
| 1611 | static int digi_startup_device( struct usb_serial *serial ) | 1499 | static int digi_startup_device(struct usb_serial *serial) |
| 1612 | { | 1500 | { |
| 1613 | |||
| 1614 | int i,ret = 0; | 1501 | int i,ret = 0; |
| 1615 | struct digi_serial *serial_priv = usb_get_serial_data(serial); | 1502 | struct digi_serial *serial_priv = usb_get_serial_data(serial); |
| 1616 | struct usb_serial_port *port; | 1503 | struct usb_serial_port *port; |
| 1617 | 1504 | ||
| 1618 | |||
| 1619 | /* be sure this happens exactly once */ | 1505 | /* be sure this happens exactly once */ |
| 1620 | spin_lock( &serial_priv->ds_serial_lock ); | 1506 | spin_lock(&serial_priv->ds_serial_lock); |
| 1621 | if( serial_priv->ds_device_started ) { | 1507 | if (serial_priv->ds_device_started) { |
| 1622 | spin_unlock( &serial_priv->ds_serial_lock ); | 1508 | spin_unlock(&serial_priv->ds_serial_lock); |
| 1623 | return( 0 ); | 1509 | return 0; |
| 1624 | } | 1510 | } |
| 1625 | serial_priv->ds_device_started = 1; | 1511 | serial_priv->ds_device_started = 1; |
| 1626 | spin_unlock( &serial_priv->ds_serial_lock ); | 1512 | spin_unlock(&serial_priv->ds_serial_lock); |
| 1627 | 1513 | ||
| 1628 | /* start reading from each bulk in endpoint for the device */ | 1514 | /* start reading from each bulk in endpoint for the device */ |
| 1629 | /* set USB_DISABLE_SPD flag for write bulk urbs */ | 1515 | /* set USB_DISABLE_SPD flag for write bulk urbs */ |
| 1630 | for( i=0; i<serial->type->num_ports+1; i++ ) { | 1516 | for (i = 0; i < serial->type->num_ports + 1; i++) { |
| 1631 | |||
| 1632 | port = serial->port[i]; | 1517 | port = serial->port[i]; |
| 1633 | |||
| 1634 | port->write_urb->dev = port->serial->dev; | 1518 | port->write_urb->dev = port->serial->dev; |
| 1635 | 1519 | if ((ret = usb_submit_urb(port->read_urb, GFP_KERNEL)) != 0) { | |
| 1636 | if( (ret=usb_submit_urb(port->read_urb, GFP_KERNEL)) != 0 ) { | 1520 | err("%s: usb_submit_urb failed, ret=%d, port=%d", |
| 1637 | err("%s: usb_submit_urb failed, ret=%d, port=%d", __FUNCTION__, | 1521 | __FUNCTION__, ret, i); |
| 1638 | ret, i ); | ||
| 1639 | break; | 1522 | break; |
| 1640 | } | 1523 | } |
| 1641 | |||
| 1642 | } | 1524 | } |
| 1643 | 1525 | return ret; | |
| 1644 | return( ret ); | ||
| 1645 | |||
| 1646 | } | 1526 | } |
| 1647 | 1527 | ||
| 1648 | 1528 | ||
| 1649 | static int digi_startup( struct usb_serial *serial ) | 1529 | static int digi_startup(struct usb_serial *serial) |
| 1650 | { | 1530 | { |
| 1651 | 1531 | ||
| 1652 | int i; | 1532 | int i; |
| 1653 | struct digi_port *priv; | 1533 | struct digi_port *priv; |
| 1654 | struct digi_serial *serial_priv; | 1534 | struct digi_serial *serial_priv; |
| 1655 | 1535 | ||
| 1656 | 1536 | dbg("digi_startup: TOP"); | |
| 1657 | dbg( "digi_startup: TOP" ); | ||
| 1658 | 1537 | ||
| 1659 | /* allocate the private data structures for all ports */ | 1538 | /* allocate the private data structures for all ports */ |
| 1660 | /* number of regular ports + 1 for the out-of-band port */ | 1539 | /* number of regular ports + 1 for the out-of-band port */ |
| 1661 | for( i=0; i<serial->type->num_ports+1; i++ ) { | 1540 | for(i = 0; i < serial->type->num_ports + 1; i++) { |
| 1662 | |||
| 1663 | /* allocate port private structure */ | 1541 | /* allocate port private structure */ |
| 1664 | priv = kmalloc( sizeof(struct digi_port), | 1542 | priv = kmalloc(sizeof(struct digi_port), GFP_KERNEL); |
| 1665 | GFP_KERNEL ); | 1543 | if (priv == NULL) { |
| 1666 | if( priv == (struct digi_port *)0 ) { | 1544 | while (--i >= 0) |
| 1667 | while( --i >= 0 ) | 1545 | kfree(usb_get_serial_port_data(serial->port[i])); |
| 1668 | kfree( usb_get_serial_port_data(serial->port[i]) ); | 1546 | return 1; /* error */ |
| 1669 | return( 1 ); /* error */ | ||
| 1670 | } | 1547 | } |
| 1671 | 1548 | ||
| 1672 | /* initialize port private structure */ | 1549 | /* initialize port private structure */ |
| 1673 | spin_lock_init( &priv->dp_port_lock ); | 1550 | spin_lock_init(&priv->dp_port_lock); |
| 1674 | priv->dp_port_num = i; | 1551 | priv->dp_port_num = i; |
| 1675 | priv->dp_out_buf_len = 0; | 1552 | priv->dp_out_buf_len = 0; |
| 1676 | priv->dp_write_urb_in_use = 0; | 1553 | priv->dp_write_urb_in_use = 0; |
| 1677 | priv->dp_modem_signals = 0; | 1554 | priv->dp_modem_signals = 0; |
| 1678 | init_waitqueue_head( &priv->dp_modem_change_wait ); | 1555 | init_waitqueue_head(&priv->dp_modem_change_wait); |
| 1679 | priv->dp_transmit_idle = 0; | 1556 | priv->dp_transmit_idle = 0; |
| 1680 | init_waitqueue_head( &priv->dp_transmit_idle_wait ); | 1557 | init_waitqueue_head(&priv->dp_transmit_idle_wait); |
| 1681 | priv->dp_throttled = 0; | 1558 | priv->dp_throttled = 0; |
| 1682 | priv->dp_throttle_restart = 0; | 1559 | priv->dp_throttle_restart = 0; |
| 1683 | init_waitqueue_head( &priv->dp_flush_wait ); | 1560 | init_waitqueue_head(&priv->dp_flush_wait); |
| 1684 | priv->dp_in_close = 0; | 1561 | priv->dp_in_close = 0; |
| 1685 | init_waitqueue_head( &priv->dp_close_wait ); | 1562 | init_waitqueue_head(&priv->dp_close_wait); |
| 1686 | INIT_WORK(&priv->dp_wakeup_work, digi_wakeup_write_lock); | 1563 | INIT_WORK(&priv->dp_wakeup_work, digi_wakeup_write_lock); |
| 1687 | priv->dp_port = serial->port[i]; | 1564 | priv->dp_port = serial->port[i]; |
| 1688 | |||
| 1689 | /* initialize write wait queue for this port */ | 1565 | /* initialize write wait queue for this port */ |
| 1690 | init_waitqueue_head( &serial->port[i]->write_wait ); | 1566 | init_waitqueue_head(&serial->port[i]->write_wait); |
| 1691 | 1567 | ||
| 1692 | usb_set_serial_port_data(serial->port[i], priv); | 1568 | usb_set_serial_port_data(serial->port[i], priv); |
| 1693 | } | 1569 | } |
| 1694 | 1570 | ||
| 1695 | /* allocate serial private structure */ | 1571 | /* allocate serial private structure */ |
| 1696 | serial_priv = kmalloc( sizeof(struct digi_serial), | 1572 | serial_priv = kmalloc(sizeof(struct digi_serial), GFP_KERNEL); |
| 1697 | GFP_KERNEL ); | 1573 | if (serial_priv == NULL) { |
| 1698 | if( serial_priv == (struct digi_serial *)0 ) { | 1574 | for (i = 0; i < serial->type->num_ports + 1; i++) |
| 1699 | for( i=0; i<serial->type->num_ports+1; i++ ) | 1575 | kfree(usb_get_serial_port_data(serial->port[i])); |
| 1700 | kfree( usb_get_serial_port_data(serial->port[i]) ); | 1576 | return 1; /* error */ |
| 1701 | return( 1 ); /* error */ | ||
| 1702 | } | 1577 | } |
| 1703 | 1578 | ||
| 1704 | /* initialize serial private structure */ | 1579 | /* initialize serial private structure */ |
| 1705 | spin_lock_init( &serial_priv->ds_serial_lock ); | 1580 | spin_lock_init(&serial_priv->ds_serial_lock); |
| 1706 | serial_priv->ds_oob_port_num = serial->type->num_ports; | 1581 | serial_priv->ds_oob_port_num = serial->type->num_ports; |
| 1707 | serial_priv->ds_oob_port = serial->port[serial_priv->ds_oob_port_num]; | 1582 | serial_priv->ds_oob_port = serial->port[serial_priv->ds_oob_port_num]; |
| 1708 | serial_priv->ds_device_started = 0; | 1583 | serial_priv->ds_device_started = 0; |
| 1709 | usb_set_serial_data(serial, serial_priv); | 1584 | usb_set_serial_data(serial, serial_priv); |
| 1710 | 1585 | ||
| 1711 | return( 0 ); | 1586 | return 0; |
| 1712 | |||
| 1713 | } | 1587 | } |
| 1714 | 1588 | ||
| 1715 | 1589 | ||
| 1716 | static void digi_shutdown( struct usb_serial *serial ) | 1590 | static void digi_shutdown(struct usb_serial *serial) |
| 1717 | { | 1591 | { |
| 1718 | |||
| 1719 | int i; | 1592 | int i; |
| 1720 | 1593 | dbg("digi_shutdown: TOP, in_interrupt()=%ld", in_interrupt()); | |
| 1721 | |||
| 1722 | dbg( "digi_shutdown: TOP, in_interrupt()=%ld", in_interrupt() ); | ||
| 1723 | 1594 | ||
| 1724 | /* stop reads and writes on all ports */ | 1595 | /* stop reads and writes on all ports */ |
| 1725 | for( i=0; i<serial->type->num_ports+1; i++ ) { | 1596 | for (i = 0; i < serial->type->num_ports + 1; i++) { |
| 1726 | usb_kill_urb(serial->port[i]->read_urb); | 1597 | usb_kill_urb(serial->port[i]->read_urb); |
| 1727 | usb_kill_urb(serial->port[i]->write_urb); | 1598 | usb_kill_urb(serial->port[i]->write_urb); |
| 1728 | } | 1599 | } |
| 1729 | 1600 | ||
| 1730 | /* free the private data structures for all ports */ | 1601 | /* free the private data structures for all ports */ |
| 1731 | /* number of regular ports + 1 for the out-of-band port */ | 1602 | /* number of regular ports + 1 for the out-of-band port */ |
| 1732 | for( i=0; i<serial->type->num_ports+1; i++ ) | 1603 | for(i = 0; i < serial->type->num_ports + 1; i++) |
| 1733 | kfree( usb_get_serial_port_data(serial->port[i]) ); | 1604 | kfree(usb_get_serial_port_data(serial->port[i])); |
| 1734 | kfree( usb_get_serial_data(serial) ); | 1605 | kfree(usb_get_serial_data(serial)); |
| 1735 | } | 1606 | } |
| 1736 | 1607 | ||
| 1737 | 1608 | ||
| 1738 | static void digi_read_bulk_callback( struct urb *urb ) | 1609 | static void digi_read_bulk_callback(struct urb *urb) |
| 1739 | { | 1610 | { |
| 1740 | |||
| 1741 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; | 1611 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; |
| 1742 | struct digi_port *priv; | 1612 | struct digi_port *priv; |
| 1743 | struct digi_serial *serial_priv; | 1613 | struct digi_serial *serial_priv; |
| 1744 | int ret; | 1614 | int ret; |
| 1745 | int status = urb->status; | 1615 | int status = urb->status; |
| 1746 | 1616 | ||
| 1747 | 1617 | dbg("digi_read_bulk_callback: TOP"); | |
| 1748 | dbg( "digi_read_bulk_callback: TOP" ); | ||
| 1749 | 1618 | ||
| 1750 | /* port sanity check, do not resubmit if port is not valid */ | 1619 | /* port sanity check, do not resubmit if port is not valid */ |
| 1751 | if( port == NULL || (priv=usb_get_serial_port_data(port)) == NULL ) { | 1620 | if (port == NULL || (priv = usb_get_serial_port_data(port)) == NULL) { |
| 1752 | err("%s: port or port->private is NULL, status=%d", | 1621 | err("%s: port or port->private is NULL, status=%d", |
| 1753 | __FUNCTION__, status); | 1622 | __FUNCTION__, status); |
| 1754 | return; | 1623 | return; |
| 1755 | } | 1624 | } |
| 1756 | if( port->serial == NULL | 1625 | if (port->serial == NULL || |
| 1757 | || (serial_priv=usb_get_serial_data(port->serial)) == NULL ) { | 1626 | (serial_priv=usb_get_serial_data(port->serial)) == NULL) { |
| 1758 | err("%s: serial is bad or serial->private is NULL, status=%d", | 1627 | err("%s: serial is bad or serial->private is NULL, status=%d", |
| 1759 | __FUNCTION__, status); | 1628 | __FUNCTION__, status); |
| 1760 | return; | 1629 | return; |
| 1761 | } | 1630 | } |
| 1762 | 1631 | ||
| @@ -1768,24 +1637,23 @@ dbg( "digi_read_bulk_callback: TOP" ); | |||
| 1768 | } | 1637 | } |
| 1769 | 1638 | ||
| 1770 | /* handle oob or inb callback, do not resubmit if error */ | 1639 | /* handle oob or inb callback, do not resubmit if error */ |
| 1771 | if( priv->dp_port_num == serial_priv->ds_oob_port_num ) { | 1640 | if (priv->dp_port_num == serial_priv->ds_oob_port_num) { |
| 1772 | if( digi_read_oob_callback( urb ) != 0 ) | 1641 | if (digi_read_oob_callback(urb) != 0) |
| 1773 | return; | 1642 | return; |
| 1774 | } else { | 1643 | } else { |
| 1775 | if( digi_read_inb_callback( urb ) != 0 ) | 1644 | if (digi_read_inb_callback(urb) != 0) |
| 1776 | return; | 1645 | return; |
| 1777 | } | 1646 | } |
| 1778 | 1647 | ||
| 1779 | /* continue read */ | 1648 | /* continue read */ |
| 1780 | urb->dev = port->serial->dev; | 1649 | urb->dev = port->serial->dev; |
| 1781 | if( (ret=usb_submit_urb(urb, GFP_ATOMIC)) != 0 ) { | 1650 | if ((ret = usb_submit_urb(urb, GFP_ATOMIC)) != 0) { |
| 1782 | err("%s: failed resubmitting urb, ret=%d, port=%d", __FUNCTION__, | 1651 | err("%s: failed resubmitting urb, ret=%d, port=%d", |
| 1783 | ret, priv->dp_port_num ); | 1652 | __FUNCTION__, ret, priv->dp_port_num); |
| 1784 | } | 1653 | } |
| 1785 | 1654 | ||
| 1786 | } | 1655 | } |
| 1787 | 1656 | ||
| 1788 | |||
| 1789 | /* | 1657 | /* |
| 1790 | * Digi Read INB Callback | 1658 | * Digi Read INB Callback |
| 1791 | * | 1659 | * |
| @@ -1796,7 +1664,7 @@ dbg( "digi_read_bulk_callback: TOP" ); | |||
| 1796 | * throttled, and -1 if the sanity checks failed. | 1664 | * throttled, and -1 if the sanity checks failed. |
| 1797 | */ | 1665 | */ |
| 1798 | 1666 | ||
| 1799 | static int digi_read_inb_callback( struct urb *urb ) | 1667 | static int digi_read_inb_callback(struct urb *urb) |
| 1800 | { | 1668 | { |
| 1801 | 1669 | ||
| 1802 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; | 1670 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; |
| @@ -1812,72 +1680,67 @@ static int digi_read_inb_callback( struct urb *urb ) | |||
| 1812 | 1680 | ||
| 1813 | /* do not process callbacks on closed ports */ | 1681 | /* do not process callbacks on closed ports */ |
| 1814 | /* but do continue the read chain */ | 1682 | /* but do continue the read chain */ |
| 1815 | if( port->open_count == 0 ) | 1683 | if (port->open_count == 0) |
| 1816 | return( 0 ); | 1684 | return 0; |
| 1817 | 1685 | ||
| 1818 | /* short/multiple packet check */ | 1686 | /* short/multiple packet check */ |
| 1819 | if( urb->actual_length != len + 2 ) { | 1687 | if (urb->actual_length != len + 2) { |
| 1820 | err("%s: INCOMPLETE OR MULTIPLE PACKET, urb status=%d, " | 1688 | err("%s: INCOMPLETE OR MULTIPLE PACKET, urb->status=%d, " |
| 1821 | "port=%d, opcode=%d, len=%d, actual_length=%d, " | 1689 | "port=%d, opcode=%d, len=%d, actual_length=%d, " |
| 1822 | "port_status=%d", __FUNCTION__, status, priv->dp_port_num, | 1690 | "status=%d", __FUNCTION__, status, priv->dp_port_num, |
| 1823 | opcode, len, urb->actual_length, port_status); | 1691 | opcode, len, urb->actual_length, port_status); |
| 1824 | return( -1 ); | 1692 | return -1; |
| 1825 | } | 1693 | } |
| 1826 | 1694 | ||
| 1827 | spin_lock( &priv->dp_port_lock ); | 1695 | spin_lock(&priv->dp_port_lock); |
| 1828 | 1696 | ||
| 1829 | /* check for throttle; if set, do not resubmit read urb */ | 1697 | /* check for throttle; if set, do not resubmit read urb */ |
| 1830 | /* indicate the read chain needs to be restarted on unthrottle */ | 1698 | /* indicate the read chain needs to be restarted on unthrottle */ |
| 1831 | throttled = priv->dp_throttled; | 1699 | throttled = priv->dp_throttled; |
| 1832 | if( throttled ) | 1700 | if (throttled) |
| 1833 | priv->dp_throttle_restart = 1; | 1701 | priv->dp_throttle_restart = 1; |
| 1834 | 1702 | ||
| 1835 | /* receive data */ | 1703 | /* receive data */ |
| 1836 | if( opcode == DIGI_CMD_RECEIVE_DATA ) { | 1704 | if (opcode == DIGI_CMD_RECEIVE_DATA) { |
| 1837 | |||
| 1838 | /* get flag from port_status */ | 1705 | /* get flag from port_status */ |
| 1839 | flag = 0; | 1706 | flag = 0; |
| 1840 | 1707 | ||
| 1841 | /* overrun is special, not associated with a char */ | 1708 | /* overrun is special, not associated with a char */ |
| 1842 | if (port_status & DIGI_OVERRUN_ERROR) { | 1709 | if (port_status & DIGI_OVERRUN_ERROR) |
| 1843 | tty_insert_flip_char( tty, 0, TTY_OVERRUN ); | 1710 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); |
| 1844 | } | ||
| 1845 | 1711 | ||
| 1846 | /* break takes precedence over parity, */ | 1712 | /* break takes precedence over parity, */ |
| 1847 | /* which takes precedence over framing errors */ | 1713 | /* which takes precedence over framing errors */ |
| 1848 | if (port_status & DIGI_BREAK_ERROR) { | 1714 | if (port_status & DIGI_BREAK_ERROR) |
| 1849 | flag = TTY_BREAK; | 1715 | flag = TTY_BREAK; |
| 1850 | } else if (port_status & DIGI_PARITY_ERROR) { | 1716 | else if (port_status & DIGI_PARITY_ERROR) |
| 1851 | flag = TTY_PARITY; | 1717 | flag = TTY_PARITY; |
| 1852 | } else if (port_status & DIGI_FRAMING_ERROR) { | 1718 | else if (port_status & DIGI_FRAMING_ERROR) |
| 1853 | flag = TTY_FRAME; | 1719 | flag = TTY_FRAME; |
| 1854 | } | ||
| 1855 | 1720 | ||
| 1856 | /* data length is len-1 (one byte of len is port_status) */ | 1721 | /* data length is len-1 (one byte of len is port_status) */ |
| 1857 | --len; | 1722 | --len; |
| 1858 | 1723 | ||
| 1859 | len = tty_buffer_request_room(tty, len); | 1724 | len = tty_buffer_request_room(tty, len); |
| 1860 | if( len > 0 ) { | 1725 | if (len > 0) { |
| 1861 | /* Hot path */ | 1726 | /* Hot path */ |
| 1862 | if(flag == TTY_NORMAL) | 1727 | if (flag == TTY_NORMAL) |
| 1863 | tty_insert_flip_string(tty, data, len); | 1728 | tty_insert_flip_string(tty, data, len); |
| 1864 | else { | 1729 | else { |
| 1865 | for(i = 0; i < len; i++) | 1730 | for(i = 0; i < len; i++) |
| 1866 | tty_insert_flip_char(tty, data[i], flag); | 1731 | tty_insert_flip_char(tty, data[i], flag); |
| 1867 | } | 1732 | } |
| 1868 | tty_flip_buffer_push( tty ); | 1733 | tty_flip_buffer_push(tty); |
| 1869 | } | 1734 | } |
| 1870 | } | 1735 | } |
| 1736 | spin_unlock(&priv->dp_port_lock); | ||
| 1871 | 1737 | ||
| 1872 | spin_unlock( &priv->dp_port_lock ); | 1738 | if (opcode == DIGI_CMD_RECEIVE_DISABLE) |
| 1873 | 1739 | dbg("%s: got RECEIVE_DISABLE", __FUNCTION__); | |
| 1874 | if( opcode == DIGI_CMD_RECEIVE_DISABLE ) { | 1740 | else if (opcode != DIGI_CMD_RECEIVE_DATA) |
| 1875 | dbg("%s: got RECEIVE_DISABLE", __FUNCTION__ ); | 1741 | dbg("%s: unknown opcode: %d", __FUNCTION__, opcode); |
| 1876 | } else if( opcode != DIGI_CMD_RECEIVE_DATA ) { | ||
| 1877 | dbg("%s: unknown opcode: %d", __FUNCTION__, opcode ); | ||
| 1878 | } | ||
| 1879 | 1742 | ||
| 1880 | return( throttled ? 1 : 0 ); | 1743 | return(throttled ? 1 : 0); |
| 1881 | 1744 | ||
| 1882 | } | 1745 | } |
| 1883 | 1746 | ||
| @@ -1891,7 +1754,7 @@ static int digi_read_inb_callback( struct urb *urb ) | |||
| 1891 | * -1 if the sanity checks failed. | 1754 | * -1 if the sanity checks failed. |
| 1892 | */ | 1755 | */ |
| 1893 | 1756 | ||
| 1894 | static int digi_read_oob_callback( struct urb *urb ) | 1757 | static int digi_read_oob_callback(struct urb *urb) |
| 1895 | { | 1758 | { |
| 1896 | 1759 | ||
| 1897 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; | 1760 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; |
| @@ -1900,87 +1763,75 @@ static int digi_read_oob_callback( struct urb *urb ) | |||
| 1900 | int opcode, line, status, val; | 1763 | int opcode, line, status, val; |
| 1901 | int i; | 1764 | int i; |
| 1902 | 1765 | ||
| 1903 | 1766 | dbg("digi_read_oob_callback: port=%d, len=%d", | |
| 1904 | dbg( "digi_read_oob_callback: port=%d, len=%d", priv->dp_port_num, | 1767 | priv->dp_port_num, urb->actual_length); |
| 1905 | urb->actual_length ); | ||
| 1906 | 1768 | ||
| 1907 | /* handle each oob command */ | 1769 | /* handle each oob command */ |
| 1908 | for( i=0; i<urb->actual_length-3; ) { | 1770 | for(i = 0; i < urb->actual_length - 3;) { |
| 1909 | |||
| 1910 | opcode = ((unsigned char *)urb->transfer_buffer)[i++]; | 1771 | opcode = ((unsigned char *)urb->transfer_buffer)[i++]; |
| 1911 | line = ((unsigned char *)urb->transfer_buffer)[i++]; | 1772 | line = ((unsigned char *)urb->transfer_buffer)[i++]; |
| 1912 | status = ((unsigned char *)urb->transfer_buffer)[i++]; | 1773 | status = ((unsigned char *)urb->transfer_buffer)[i++]; |
| 1913 | val = ((unsigned char *)urb->transfer_buffer)[i++]; | 1774 | val = ((unsigned char *)urb->transfer_buffer)[i++]; |
| 1914 | 1775 | ||
| 1915 | dbg( "digi_read_oob_callback: opcode=%d, line=%d, status=%d, val=%d", | 1776 | dbg("digi_read_oob_callback: opcode=%d, line=%d, status=%d, val=%d", |
| 1916 | opcode, line, status, val ); | 1777 | opcode, line, status, val); |
| 1917 | 1778 | ||
| 1918 | if( status != 0 || line >= serial->type->num_ports ) | 1779 | if (status != 0 || line >= serial->type->num_ports) |
| 1919 | continue; | 1780 | continue; |
| 1920 | 1781 | ||
| 1921 | port = serial->port[line]; | 1782 | port = serial->port[line]; |
| 1922 | 1783 | ||
| 1923 | if ((priv=usb_get_serial_port_data(port)) == NULL ) | 1784 | if ((priv=usb_get_serial_port_data(port)) == NULL) |
| 1924 | return -1; | 1785 | return -1; |
| 1925 | 1786 | ||
| 1926 | if( opcode == DIGI_CMD_READ_INPUT_SIGNALS ) { | 1787 | if (opcode == DIGI_CMD_READ_INPUT_SIGNALS) { |
| 1927 | 1788 | spin_lock(&priv->dp_port_lock); | |
| 1928 | spin_lock( &priv->dp_port_lock ); | ||
| 1929 | |||
| 1930 | /* convert from digi flags to termiox flags */ | 1789 | /* convert from digi flags to termiox flags */ |
| 1931 | if( val & DIGI_READ_INPUT_SIGNALS_CTS ) { | 1790 | if (val & DIGI_READ_INPUT_SIGNALS_CTS) { |
| 1932 | priv->dp_modem_signals |= TIOCM_CTS; | 1791 | priv->dp_modem_signals |= TIOCM_CTS; |
| 1933 | /* port must be open to use tty struct */ | 1792 | /* port must be open to use tty struct */ |
| 1934 | if( port->open_count | 1793 | if (port->open_count |
| 1935 | && port->tty->termios->c_cflag & CRTSCTS ) { | 1794 | && port->tty->termios->c_cflag & CRTSCTS) { |
| 1936 | port->tty->hw_stopped = 0; | 1795 | port->tty->hw_stopped = 0; |
| 1937 | digi_wakeup_write( port ); | 1796 | digi_wakeup_write(port); |
| 1938 | } | 1797 | } |
| 1939 | } else { | 1798 | } else { |
| 1940 | priv->dp_modem_signals &= ~TIOCM_CTS; | 1799 | priv->dp_modem_signals &= ~TIOCM_CTS; |
| 1941 | /* port must be open to use tty struct */ | 1800 | /* port must be open to use tty struct */ |
| 1942 | if( port->open_count | 1801 | if (port->open_count |
| 1943 | && port->tty->termios->c_cflag & CRTSCTS ) { | 1802 | && port->tty->termios->c_cflag & CRTSCTS) { |
| 1944 | port->tty->hw_stopped = 1; | 1803 | port->tty->hw_stopped = 1; |
| 1945 | } | 1804 | } |
| 1946 | } | 1805 | } |
| 1947 | if( val & DIGI_READ_INPUT_SIGNALS_DSR ) | 1806 | if (val & DIGI_READ_INPUT_SIGNALS_DSR) |
| 1948 | priv->dp_modem_signals |= TIOCM_DSR; | 1807 | priv->dp_modem_signals |= TIOCM_DSR; |
| 1949 | else | 1808 | else |
| 1950 | priv->dp_modem_signals &= ~TIOCM_DSR; | 1809 | priv->dp_modem_signals &= ~TIOCM_DSR; |
| 1951 | if( val & DIGI_READ_INPUT_SIGNALS_RI ) | 1810 | if (val & DIGI_READ_INPUT_SIGNALS_RI) |
| 1952 | priv->dp_modem_signals |= TIOCM_RI; | 1811 | priv->dp_modem_signals |= TIOCM_RI; |
| 1953 | else | 1812 | else |
| 1954 | priv->dp_modem_signals &= ~TIOCM_RI; | 1813 | priv->dp_modem_signals &= ~TIOCM_RI; |
| 1955 | if( val & DIGI_READ_INPUT_SIGNALS_DCD ) | 1814 | if (val & DIGI_READ_INPUT_SIGNALS_DCD) |
| 1956 | priv->dp_modem_signals |= TIOCM_CD; | 1815 | priv->dp_modem_signals |= TIOCM_CD; |
| 1957 | else | 1816 | else |
| 1958 | priv->dp_modem_signals &= ~TIOCM_CD; | 1817 | priv->dp_modem_signals &= ~TIOCM_CD; |
| 1959 | 1818 | ||
| 1960 | wake_up_interruptible( &priv->dp_modem_change_wait ); | 1819 | wake_up_interruptible(&priv->dp_modem_change_wait); |
| 1961 | spin_unlock( &priv->dp_port_lock ); | 1820 | spin_unlock(&priv->dp_port_lock); |
| 1962 | 1821 | } else if (opcode == DIGI_CMD_TRANSMIT_IDLE) { | |
| 1963 | } else if( opcode == DIGI_CMD_TRANSMIT_IDLE ) { | 1822 | spin_lock(&priv->dp_port_lock); |
| 1964 | |||
| 1965 | spin_lock( &priv->dp_port_lock ); | ||
| 1966 | priv->dp_transmit_idle = 1; | 1823 | priv->dp_transmit_idle = 1; |
| 1967 | wake_up_interruptible( &priv->dp_transmit_idle_wait ); | 1824 | wake_up_interruptible(&priv->dp_transmit_idle_wait); |
| 1968 | spin_unlock( &priv->dp_port_lock ); | 1825 | spin_unlock(&priv->dp_port_lock); |
| 1969 | 1826 | } else if (opcode == DIGI_CMD_IFLUSH_FIFO) { | |
| 1970 | } else if( opcode == DIGI_CMD_IFLUSH_FIFO ) { | 1827 | wake_up_interruptible(&priv->dp_flush_wait); |
| 1971 | |||
| 1972 | wake_up_interruptible( &priv->dp_flush_wait ); | ||
| 1973 | |||
| 1974 | } | 1828 | } |
| 1975 | |||
| 1976 | } | 1829 | } |
| 1977 | 1830 | return 0; | |
| 1978 | return( 0 ); | ||
| 1979 | 1831 | ||
| 1980 | } | 1832 | } |
| 1981 | 1833 | ||
| 1982 | 1834 | static int __init digi_init(void) | |
| 1983 | static int __init digi_init (void) | ||
| 1984 | { | 1835 | { |
| 1985 | int retval; | 1836 | int retval; |
| 1986 | retval = usb_serial_register(&digi_acceleport_2_device); | 1837 | retval = usb_serial_register(&digi_acceleport_2_device); |
| @@ -2002,12 +1853,11 @@ failed_acceleport_2_device: | |||
| 2002 | return retval; | 1853 | return retval; |
| 2003 | } | 1854 | } |
| 2004 | 1855 | ||
| 2005 | |||
| 2006 | static void __exit digi_exit (void) | 1856 | static void __exit digi_exit (void) |
| 2007 | { | 1857 | { |
| 2008 | usb_deregister (&digi_driver); | 1858 | usb_deregister(&digi_driver); |
| 2009 | usb_serial_deregister (&digi_acceleport_2_device); | 1859 | usb_serial_deregister(&digi_acceleport_2_device); |
| 2010 | usb_serial_deregister (&digi_acceleport_4_device); | 1860 | usb_serial_deregister(&digi_acceleport_4_device); |
| 2011 | } | 1861 | } |
| 2012 | 1862 | ||
| 2013 | 1863 | ||
| @@ -2015,8 +1865,8 @@ module_init(digi_init); | |||
| 2015 | module_exit(digi_exit); | 1865 | module_exit(digi_exit); |
| 2016 | 1866 | ||
| 2017 | 1867 | ||
| 2018 | MODULE_AUTHOR( DRIVER_AUTHOR ); | 1868 | MODULE_AUTHOR(DRIVER_AUTHOR); |
| 2019 | MODULE_DESCRIPTION( DRIVER_DESC ); | 1869 | MODULE_DESCRIPTION(DRIVER_DESC); |
| 2020 | MODULE_LICENSE("GPL"); | 1870 | MODULE_LICENSE("GPL"); |
| 2021 | 1871 | ||
| 2022 | module_param(debug, bool, S_IRUGO | S_IWUSR); | 1872 | module_param(debug, bool, S_IRUGO | S_IWUSR); |
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index dd42f57089ff..2ecb1d2a034d 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
| @@ -2366,9 +2366,8 @@ static int send_cmd_write_baud_rate (struct edgeport_port *edge_port, int baudRa | |||
| 2366 | int status; | 2366 | int status; |
| 2367 | unsigned char number = edge_port->port->number - edge_port->port->serial->minor; | 2367 | unsigned char number = edge_port->port->number - edge_port->port->serial->minor; |
| 2368 | 2368 | ||
| 2369 | if ((!edge_serial->is_epic) || | 2369 | if (edge_serial->is_epic && |
| 2370 | ((edge_serial->is_epic) && | 2370 | !edge_serial->epic_descriptor.Supports.IOSPSetBaudRate) { |
| 2371 | (!edge_serial->epic_descriptor.Supports.IOSPSetBaudRate))) { | ||
| 2372 | dbg("SendCmdWriteBaudRate - NOT Setting baud rate for port = %d, baud = %d", | 2371 | dbg("SendCmdWriteBaudRate - NOT Setting baud rate for port = %d, baud = %d", |
| 2373 | edge_port->port->number, baudRate); | 2372 | edge_port->port->number, baudRate); |
| 2374 | return 0; | 2373 | return 0; |
| @@ -2461,18 +2460,16 @@ static int send_cmd_write_uart_register (struct edgeport_port *edge_port, __u8 r | |||
| 2461 | 2460 | ||
| 2462 | dbg("%s - write to %s register 0x%02x", (regNum == MCR) ? "MCR" : "LCR", __FUNCTION__, regValue); | 2461 | dbg("%s - write to %s register 0x%02x", (regNum == MCR) ? "MCR" : "LCR", __FUNCTION__, regValue); |
| 2463 | 2462 | ||
| 2464 | if ((!edge_serial->is_epic) || | 2463 | if (edge_serial->is_epic && |
| 2465 | ((edge_serial->is_epic) && | 2464 | !edge_serial->epic_descriptor.Supports.IOSPWriteMCR && |
| 2466 | (!edge_serial->epic_descriptor.Supports.IOSPWriteMCR) && | 2465 | regNum == MCR) { |
| 2467 | (regNum == MCR))) { | ||
| 2468 | dbg("SendCmdWriteUartReg - Not writing to MCR Register"); | 2466 | dbg("SendCmdWriteUartReg - Not writing to MCR Register"); |
| 2469 | return 0; | 2467 | return 0; |
| 2470 | } | 2468 | } |
| 2471 | 2469 | ||
| 2472 | if ((!edge_serial->is_epic) || | 2470 | if (edge_serial->is_epic && |
| 2473 | ((edge_serial->is_epic) && | 2471 | !edge_serial->epic_descriptor.Supports.IOSPWriteLCR && |
| 2474 | (!edge_serial->epic_descriptor.Supports.IOSPWriteLCR) && | 2472 | regNum == LCR) { |
| 2475 | (regNum == LCR))) { | ||
| 2476 | dbg ("SendCmdWriteUartReg - Not writing to LCR Register"); | 2473 | dbg ("SendCmdWriteUartReg - Not writing to LCR Register"); |
| 2477 | return 0; | 2474 | return 0; |
| 2478 | } | 2475 | } |
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index 2a3fabcf5186..e08c9bb403d8 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c | |||
| @@ -184,21 +184,21 @@ struct mct_u232_private { | |||
| 184 | * we do not know how to support. We ignore them for the moment. | 184 | * we do not know how to support. We ignore them for the moment. |
| 185 | * XXX Rate-limit the error message, it's user triggerable. | 185 | * XXX Rate-limit the error message, it's user triggerable. |
| 186 | */ | 186 | */ |
| 187 | static int mct_u232_calculate_baud_rate(struct usb_serial *serial, int value) | 187 | static int mct_u232_calculate_baud_rate(struct usb_serial *serial, speed_t value) |
| 188 | { | 188 | { |
| 189 | if (le16_to_cpu(serial->dev->descriptor.idProduct) == MCT_U232_SITECOM_PID | 189 | if (le16_to_cpu(serial->dev->descriptor.idProduct) == MCT_U232_SITECOM_PID |
| 190 | || le16_to_cpu(serial->dev->descriptor.idProduct) == MCT_U232_BELKIN_F5U109_PID) { | 190 | || le16_to_cpu(serial->dev->descriptor.idProduct) == MCT_U232_BELKIN_F5U109_PID) { |
| 191 | switch (value) { | 191 | switch (value) { |
| 192 | case B300: return 0x01; | 192 | case 300: return 0x01; |
| 193 | case B600: return 0x02; /* this one not tested */ | 193 | case 600: return 0x02; /* this one not tested */ |
| 194 | case B1200: return 0x03; | 194 | case 1200: return 0x03; |
| 195 | case B2400: return 0x04; | 195 | case 2400: return 0x04; |
| 196 | case B4800: return 0x06; | 196 | case 4800: return 0x06; |
| 197 | case B9600: return 0x08; | 197 | case 9600: return 0x08; |
| 198 | case B19200: return 0x09; | 198 | case 19200: return 0x09; |
| 199 | case B38400: return 0x0a; | 199 | case 38400: return 0x0a; |
| 200 | case B57600: return 0x0b; | 200 | case 57600: return 0x0b; |
| 201 | case B115200: return 0x0c; | 201 | case 115200: return 0x0c; |
| 202 | default: | 202 | default: |
| 203 | err("MCT USB-RS232: unsupported baudrate request 0x%x," | 203 | err("MCT USB-RS232: unsupported baudrate request 0x%x," |
| 204 | " using default of B9600", value); | 204 | " using default of B9600", value); |
| @@ -206,27 +206,27 @@ static int mct_u232_calculate_baud_rate(struct usb_serial *serial, int value) | |||
| 206 | } | 206 | } |
| 207 | } else { | 207 | } else { |
| 208 | switch (value) { | 208 | switch (value) { |
| 209 | case B300: value = 300; break; | 209 | case 300: break; |
| 210 | case B600: value = 600; break; | 210 | case 600: break; |
| 211 | case B1200: value = 1200; break; | 211 | case 1200: break; |
| 212 | case B2400: value = 2400; break; | 212 | case 2400: break; |
| 213 | case B4800: value = 4800; break; | 213 | case 4800: break; |
| 214 | case B9600: value = 9600; break; | 214 | case 9600: break; |
| 215 | case B19200: value = 19200; break; | 215 | case 19200: break; |
| 216 | case B38400: value = 38400; break; | 216 | case 38400: break; |
| 217 | case B57600: value = 57600; break; | 217 | case 57600: break; |
| 218 | case B115200: value = 115200; break; | 218 | case 115200: break; |
| 219 | default: | 219 | default: |
| 220 | err("MCT USB-RS232: unsupported baudrate request 0x%x," | 220 | err("MCT USB-RS232: unsupported baudrate request 0x%x," |
| 221 | " using default of B9600", value); | 221 | " using default of B9600", value); |
| 222 | value = 9600; | 222 | value = 9600; |
| 223 | } | 223 | } |
| 224 | return 115200/value; | 224 | return 115200/value; |
| 225 | } | 225 | } |
| 226 | } | 226 | } |
| 227 | 227 | ||
| 228 | static int mct_u232_set_baud_rate(struct usb_serial *serial, struct usb_serial_port *port, | 228 | static int mct_u232_set_baud_rate(struct usb_serial *serial, struct usb_serial_port *port, |
| 229 | int value) | 229 | speed_t value) |
| 230 | { | 230 | { |
| 231 | __le32 divisor; | 231 | __le32 divisor; |
| 232 | int rc; | 232 | int rc; |
| @@ -634,7 +634,7 @@ static void mct_u232_set_termios (struct usb_serial_port *port, | |||
| 634 | mct_u232_set_modem_ctrl(serial, control_state); | 634 | mct_u232_set_modem_ctrl(serial, control_state); |
| 635 | } | 635 | } |
| 636 | 636 | ||
| 637 | mct_u232_set_baud_rate(serial, port, cflag & CBAUD); | 637 | mct_u232_set_baud_rate(serial, port, tty_get_baud_rate(port->tty)); |
| 638 | 638 | ||
| 639 | if ((cflag & CBAUD) == B0 ) { | 639 | if ((cflag & CBAUD) == B0 ) { |
| 640 | dbg("%s: baud is B0", __FUNCTION__); | 640 | dbg("%s: baud is B0", __FUNCTION__); |
diff --git a/drivers/usb/serial/mct_u232.h b/drivers/usb/serial/mct_u232.h index a61bac8f224a..aae10c8174d6 100644 --- a/drivers/usb/serial/mct_u232.h +++ b/drivers/usb/serial/mct_u232.h | |||
| @@ -79,7 +79,7 @@ | |||
| 79 | * and "Intel solution". They are the regular MCT and "Sitecom" for us. | 79 | * and "Intel solution". They are the regular MCT and "Sitecom" for us. |
| 80 | * This is pointless to document in the header, see the code for the bits. | 80 | * This is pointless to document in the header, see the code for the bits. |
| 81 | */ | 81 | */ |
| 82 | static int mct_u232_calculate_baud_rate(struct usb_serial *serial, int value); | 82 | static int mct_u232_calculate_baud_rate(struct usb_serial *serial, speed_t value); |
| 83 | 83 | ||
| 84 | /* | 84 | /* |
| 85 | * Line Control Register (LCR) | 85 | * Line Control Register (LCR) |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 0794ccdebfd4..0bb8de4cc524 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
| @@ -45,7 +45,7 @@ enum devicetype { | |||
| 45 | DEVICE_INSTALLER = 2, | 45 | DEVICE_INSTALLER = 2, |
| 46 | }; | 46 | }; |
| 47 | 47 | ||
| 48 | int sierra_set_power_state(struct usb_device *udev, __u16 swiState) | 48 | static int sierra_set_power_state(struct usb_device *udev, __u16 swiState) |
| 49 | { | 49 | { |
| 50 | int result; | 50 | int result; |
| 51 | dev_dbg(&udev->dev, "%s", "SET POWER STATE"); | 51 | dev_dbg(&udev->dev, "%s", "SET POWER STATE"); |
| @@ -60,7 +60,7 @@ int sierra_set_power_state(struct usb_device *udev, __u16 swiState) | |||
| 60 | return result; | 60 | return result; |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | int sierra_set_ms_mode(struct usb_device *udev, __u16 eSocMode) | 63 | static int sierra_set_ms_mode(struct usb_device *udev, __u16 eSocMode) |
| 64 | { | 64 | { |
| 65 | int result; | 65 | int result; |
| 66 | dev_dbg(&udev->dev, "%s", "DEVICE MODE SWITCH"); | 66 | dev_dbg(&udev->dev, "%s", "DEVICE MODE SWITCH"); |
| @@ -75,7 +75,8 @@ int sierra_set_ms_mode(struct usb_device *udev, __u16 eSocMode) | |||
| 75 | return result; | 75 | return result; |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | int sierra_probe(struct usb_interface *iface, const struct usb_device_id *id) | 78 | static int sierra_probe(struct usb_interface *iface, |
| 79 | const struct usb_device_id *id) | ||
| 79 | { | 80 | { |
| 80 | int result; | 81 | int result; |
| 81 | struct usb_device *udev; | 82 | struct usb_device *udev; |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index a3665659d13b..9bf01a5efc84 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
| @@ -60,19 +60,19 @@ static struct usb_driver usb_serial_driver = { | |||
| 60 | 60 | ||
| 61 | static int debug; | 61 | static int debug; |
| 62 | static struct usb_serial *serial_table[SERIAL_TTY_MINORS]; /* initially all NULL */ | 62 | static struct usb_serial *serial_table[SERIAL_TTY_MINORS]; /* initially all NULL */ |
| 63 | static spinlock_t table_lock; | 63 | static DEFINE_MUTEX(table_lock); |
| 64 | static LIST_HEAD(usb_serial_driver_list); | 64 | static LIST_HEAD(usb_serial_driver_list); |
| 65 | 65 | ||
| 66 | struct usb_serial *usb_serial_get_by_index(unsigned index) | 66 | struct usb_serial *usb_serial_get_by_index(unsigned index) |
| 67 | { | 67 | { |
| 68 | struct usb_serial *serial; | 68 | struct usb_serial *serial; |
| 69 | 69 | ||
| 70 | spin_lock(&table_lock); | 70 | mutex_lock(&table_lock); |
| 71 | serial = serial_table[index]; | 71 | serial = serial_table[index]; |
| 72 | 72 | ||
| 73 | if (serial) | 73 | if (serial) |
| 74 | kref_get(&serial->kref); | 74 | kref_get(&serial->kref); |
| 75 | spin_unlock(&table_lock); | 75 | mutex_unlock(&table_lock); |
| 76 | return serial; | 76 | return serial; |
| 77 | } | 77 | } |
| 78 | 78 | ||
| @@ -84,7 +84,7 @@ static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_po | |||
| 84 | dbg("%s %d", __FUNCTION__, num_ports); | 84 | dbg("%s %d", __FUNCTION__, num_ports); |
| 85 | 85 | ||
| 86 | *minor = 0; | 86 | *minor = 0; |
| 87 | spin_lock(&table_lock); | 87 | mutex_lock(&table_lock); |
| 88 | for (i = 0; i < SERIAL_TTY_MINORS; ++i) { | 88 | for (i = 0; i < SERIAL_TTY_MINORS; ++i) { |
| 89 | if (serial_table[i]) | 89 | if (serial_table[i]) |
| 90 | continue; | 90 | continue; |
| @@ -106,10 +106,10 @@ static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_po | |||
| 106 | serial_table[i] = serial; | 106 | serial_table[i] = serial; |
| 107 | serial->port[j++]->number = i; | 107 | serial->port[j++]->number = i; |
| 108 | } | 108 | } |
| 109 | spin_unlock(&table_lock); | 109 | mutex_unlock(&table_lock); |
| 110 | return serial; | 110 | return serial; |
| 111 | } | 111 | } |
| 112 | spin_unlock(&table_lock); | 112 | mutex_unlock(&table_lock); |
| 113 | return NULL; | 113 | return NULL; |
| 114 | } | 114 | } |
| 115 | 115 | ||
| @@ -172,9 +172,9 @@ static void destroy_serial(struct kref *kref) | |||
| 172 | 172 | ||
| 173 | void usb_serial_put(struct usb_serial *serial) | 173 | void usb_serial_put(struct usb_serial *serial) |
| 174 | { | 174 | { |
| 175 | spin_lock(&table_lock); | 175 | mutex_lock(&table_lock); |
| 176 | kref_put(&serial->kref, destroy_serial); | 176 | kref_put(&serial->kref, destroy_serial); |
| 177 | spin_unlock(&table_lock); | 177 | mutex_unlock(&table_lock); |
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | /***************************************************************************** | 180 | /***************************************************************************** |
| @@ -1077,16 +1077,17 @@ int usb_serial_suspend(struct usb_interface *intf, pm_message_t message) | |||
| 1077 | struct usb_serial_port *port; | 1077 | struct usb_serial_port *port; |
| 1078 | int i, r = 0; | 1078 | int i, r = 0; |
| 1079 | 1079 | ||
| 1080 | if (serial) { | 1080 | if (!serial) /* device has been disconnected */ |
| 1081 | for (i = 0; i < serial->num_ports; ++i) { | 1081 | return 0; |
| 1082 | port = serial->port[i]; | 1082 | |
| 1083 | if (port) | 1083 | for (i = 0; i < serial->num_ports; ++i) { |
| 1084 | kill_traffic(port); | 1084 | port = serial->port[i]; |
| 1085 | } | 1085 | if (port) |
| 1086 | kill_traffic(port); | ||
| 1086 | } | 1087 | } |
| 1087 | 1088 | ||
| 1088 | if (serial->type->suspend) | 1089 | if (serial->type->suspend) |
| 1089 | serial->type->suspend(serial, message); | 1090 | r = serial->type->suspend(serial, message); |
| 1090 | 1091 | ||
| 1091 | return r; | 1092 | return r; |
| 1092 | } | 1093 | } |
| @@ -1128,7 +1129,6 @@ static int __init usb_serial_init(void) | |||
| 1128 | return -ENOMEM; | 1129 | return -ENOMEM; |
| 1129 | 1130 | ||
| 1130 | /* Initialize our global data */ | 1131 | /* Initialize our global data */ |
| 1131 | spin_lock_init(&table_lock); | ||
| 1132 | for (i = 0; i < SERIAL_TTY_MINORS; ++i) { | 1132 | for (i = 0; i < SERIAL_TTY_MINORS; ++i) { |
| 1133 | serial_table[i] = NULL; | 1133 | serial_table[i] = NULL; |
| 1134 | } | 1134 | } |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index a624e72f81dc..d8d008d42946 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
| @@ -320,6 +320,13 @@ UNUSUAL_DEV( 0x04b0, 0x0401, 0x0200, 0x0200, | |||
| 320 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 320 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
| 321 | US_FL_FIX_CAPACITY), | 321 | US_FL_FIX_CAPACITY), |
| 322 | 322 | ||
| 323 | /* Reported by Milinevsky Dmitry <niam.niam@gmail.com> */ | ||
| 324 | UNUSUAL_DEV( 0x04b0, 0x0409, 0x0100, 0x0100, | ||
| 325 | "NIKON", | ||
| 326 | "NIKON DSC D50", | ||
| 327 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
| 328 | US_FL_FIX_CAPACITY), | ||
| 329 | |||
| 323 | /* Reported by Andreas Bockhold <andreas@bockionline.de> */ | 330 | /* Reported by Andreas Bockhold <andreas@bockionline.de> */ |
| 324 | UNUSUAL_DEV( 0x04b0, 0x0405, 0x0100, 0x0100, | 331 | UNUSUAL_DEV( 0x04b0, 0x0405, 0x0100, 0x0100, |
| 325 | "NIKON", | 332 | "NIKON", |
| @@ -1357,6 +1364,20 @@ UNUSUAL_DEV( 0x0f19, 0x0105, 0x0100, 0x0100, | |||
| 1357 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1364 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
| 1358 | US_FL_IGNORE_RESIDUE ), | 1365 | US_FL_IGNORE_RESIDUE ), |
| 1359 | 1366 | ||
| 1367 | /* Jeremy Katz <katzj@redhat.com>: | ||
| 1368 | * The Blackberry Pearl can run in two modes; a usb-storage only mode | ||
| 1369 | * and a mode that allows access via mass storage and to its database. | ||
| 1370 | * The berry_charge module will set the device to dual mode and thus we | ||
| 1371 | * should ignore its native mode if that module is built | ||
| 1372 | */ | ||
| 1373 | #ifdef CONFIG_USB_BERRY_CHARGE | ||
| 1374 | UNUSUAL_DEV( 0x0fca, 0x0006, 0x0001, 0x0001, | ||
| 1375 | "RIM", | ||
| 1376 | "Blackberry Pearl", | ||
| 1377 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
| 1378 | US_FL_IGNORE_DEVICE ), | ||
| 1379 | #endif | ||
| 1380 | |||
| 1360 | /* Reported by Michael Stattmann <michael@stattmann.com> */ | 1381 | /* Reported by Michael Stattmann <michael@stattmann.com> */ |
| 1361 | UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000, | 1382 | UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000, |
| 1362 | "Sony Ericsson", | 1383 | "Sony Ericsson", |
diff --git a/include/linux/usb.h b/include/linux/usb.h index 7a60946df3b6..4f33a58fa9d1 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
| @@ -94,6 +94,7 @@ enum usb_interface_condition { | |||
| 94 | * endpoint configurations. They will be in no particular order. | 94 | * endpoint configurations. They will be in no particular order. |
| 95 | * @num_altsetting: number of altsettings defined. | 95 | * @num_altsetting: number of altsettings defined. |
| 96 | * @cur_altsetting: the current altsetting. | 96 | * @cur_altsetting: the current altsetting. |
| 97 | * @intf_assoc: interface association descriptor | ||
| 97 | * @driver: the USB driver that is bound to this interface. | 98 | * @driver: the USB driver that is bound to this interface. |
| 98 | * @minor: the minor number assigned to this interface, if this | 99 | * @minor: the minor number assigned to this interface, if this |
| 99 | * interface is bound to a driver that uses the USB major number. | 100 | * interface is bound to a driver that uses the USB major number. |
| @@ -213,6 +214,7 @@ struct usb_interface_cache { | |||
| 213 | * @desc: the device's configuration descriptor. | 214 | * @desc: the device's configuration descriptor. |
| 214 | * @string: pointer to the cached version of the iConfiguration string, if | 215 | * @string: pointer to the cached version of the iConfiguration string, if |
| 215 | * present for this configuration. | 216 | * present for this configuration. |
| 217 | * @intf_assoc: list of any interface association descriptors in this config | ||
| 216 | * @interface: array of pointers to usb_interface structures, one for each | 218 | * @interface: array of pointers to usb_interface structures, one for each |
| 217 | * interface in the configuration. The number of interfaces is stored | 219 | * interface in the configuration. The number of interfaces is stored |
| 218 | * in desc.bNumInterfaces. These pointers are valid only while the | 220 | * in desc.bNumInterfaces. These pointers are valid only while the |
