Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (32 commits)
USB: serial: no unnecessary GFP_ATOMIC in oti6858
USB: serial: fix race between unthrottle and completion handler in visor
USB: serial: fix assumption that throttle/unthrottle cannot sleep
USB: serial: fix race between unthrottle and completion handler in symbolserial
USB: serial: fix race between unthrottle and completion handler in opticon
USB: ehci: Fix isoc scheduling boundary checking.
USB: storage: When a device returns no sense data, call it a Hardware Error
USB: small fix in error case of suspend in generic usbserial code
USB: visor: fix trivial accounting bug in visor driver
USB: Fix throttling in generic usbserial driver
USB: cp210x: Add support for the DW700 UART
USB: ipaq: fix oops when device is plugged in
USB: isp1362: fix build warnings on 64-bit systems
USB: gadget: imx_udc: Use resource size
USB: storage: iRiver P7 UNUSUAL_DEV patch
USB: musb: make HAVE_CLK support optional
USB: xhci: Fix dropping endpoints from the xHC schedule.
USB: xhci: Don't wait for a disable slot cmd when HC dies.
USB: xhci: Handle canceled URBs when HC dies.
USB: xhci: Stop debugging polling loop when HC dies.
...

+330 -426
+1 -1
drivers/usb/class/usbtmc.c
··· 39 39 #define USBTMC_SIZE_IOBUFFER 2048 40 40 41 41 /* Default USB timeout (in milliseconds) */ 42 - #define USBTMC_TIMEOUT 10 42 + #define USBTMC_TIMEOUT 5000 43 43 44 44 /* 45 45 * Maximum number of read cycles to empty bulk in endpoint during CLEAR and
+4 -4
drivers/usb/gadget/imx_udc.c
··· 1402 1402 struct clk *clk; 1403 1403 void __iomem *base; 1404 1404 int ret = 0; 1405 - int i, res_size; 1405 + int i; 1406 + resource_size_t res_size; 1406 1407 1407 1408 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1408 1409 if (!res) { ··· 1417 1416 return -ENODEV; 1418 1417 } 1419 1418 1420 - res_size = res->end - res->start + 1; 1419 + res_size = resource_size(res); 1421 1420 if (!request_mem_region(res->start, res_size, res->name)) { 1422 1421 dev_err(&pdev->dev, "can't allocate %d bytes at %d address\n", 1423 1422 res_size, res->start); ··· 1528 1527 clk_disable(imx_usb->clk); 1529 1528 iounmap(imx_usb->base); 1530 1529 1531 - release_mem_region(imx_usb->res->start, 1532 - imx_usb->res->end - imx_usb->res->start + 1); 1530 + release_mem_region(imx_usb->res->start, resource_size(imx_usb->res)); 1533 1531 1534 1532 if (pdata->exit) 1535 1533 pdata->exit(&pdev->dev);
+1
drivers/usb/host/ehci-sched.c
··· 1425 1425 status = -EFBIG; 1426 1426 goto fail; 1427 1427 } 1428 + stream->next_uframe = start; 1428 1429 goto ready; 1429 1430 } 1430 1431
+9 -9
drivers/usb/host/isp1362-hcd.c
··· 2284 2284 dev_info(hcd->self.controller, "ISP1362 Memory usage:\n"); 2285 2285 dev_info(hcd->self.controller, " ISTL: 2 * %4d: %4d @ $%04x:$%04x\n", 2286 2286 istl_size / 2, istl_size, 0, istl_size / 2); 2287 - dev_info(hcd->self.controller, " INTL: %4d * (%3u+8): %4d @ $%04x\n", 2287 + dev_info(hcd->self.controller, " INTL: %4d * (%3lu+8): %4d @ $%04x\n", 2288 2288 ISP1362_INTL_BUFFERS, intl_blksize - PTD_HEADER_SIZE, 2289 2289 intl_size, istl_size); 2290 - dev_info(hcd->self.controller, " ATL : %4d * (%3u+8): %4d @ $%04x\n", 2290 + dev_info(hcd->self.controller, " ATL : %4d * (%3lu+8): %4d @ $%04x\n", 2291 2291 atl_buffers, atl_blksize - PTD_HEADER_SIZE, 2292 2292 atl_size, istl_size + intl_size); 2293 2293 dev_info(hcd->self.controller, " USED/FREE: %4d %4d\n", total, ··· 2677 2677 DBG(0, "%s: Removing HCD\n", __func__); 2678 2678 usb_remove_hcd(hcd); 2679 2679 2680 - DBG(0, "%s: Unmapping data_reg @ %08x\n", __func__, 2681 - (u32)isp1362_hcd->data_reg); 2680 + DBG(0, "%s: Unmapping data_reg @ %p\n", __func__, 2681 + isp1362_hcd->data_reg); 2682 2682 iounmap(isp1362_hcd->data_reg); 2683 2683 2684 - DBG(0, "%s: Unmapping addr_reg @ %08x\n", __func__, 2685 - (u32)isp1362_hcd->addr_reg); 2684 + DBG(0, "%s: Unmapping addr_reg @ %p\n", __func__, 2685 + isp1362_hcd->addr_reg); 2686 2686 iounmap(isp1362_hcd->addr_reg); 2687 2687 2688 2688 res = platform_get_resource(pdev, IORESOURCE_MEM, 1); ··· 2810 2810 return 0; 2811 2811 2812 2812 err6: 2813 - DBG(0, "%s: Freeing dev %08x\n", __func__, (u32)isp1362_hcd); 2813 + DBG(0, "%s: Freeing dev %p\n", __func__, isp1362_hcd); 2814 2814 usb_put_hcd(hcd); 2815 2815 err5: 2816 - DBG(0, "%s: Unmapping data_reg @ %08x\n", __func__, (u32)data_reg); 2816 + DBG(0, "%s: Unmapping data_reg @ %p\n", __func__, data_reg); 2817 2817 iounmap(data_reg); 2818 2818 err4: 2819 2819 DBG(0, "%s: Releasing mem region %08lx\n", __func__, (long unsigned int)data->start); 2820 2820 release_mem_region(data->start, resource_len(data)); 2821 2821 err3: 2822 - DBG(0, "%s: Unmapping addr_reg @ %08x\n", __func__, (u32)addr_reg); 2822 + DBG(0, "%s: Unmapping addr_reg @ %p\n", __func__, addr_reg); 2823 2823 iounmap(addr_reg); 2824 2824 err2: 2825 2825 DBG(0, "%s: Releasing mem region %08lx\n", __func__, (long unsigned int)addr->start);
+6 -6
drivers/usb/host/isp1362.h
··· 580 580 581 581 static inline void ALIGNSTAT(struct isp1362_hcd *isp1362_hcd, void *ptr) 582 582 { 583 - unsigned p = (unsigned)ptr; 583 + unsigned long p = (unsigned long)ptr; 584 584 if (!(p & 0xf)) 585 585 isp1362_hcd->stat16++; 586 586 else if (!(p & 0x7)) ··· 770 770 if (!len) 771 771 return; 772 772 773 - if ((unsigned)dp & 0x1) { 773 + if ((unsigned long)dp & 0x1) { 774 774 /* not aligned */ 775 775 for (; len > 1; len -= 2) { 776 776 data = *dp++; ··· 962 962 963 963 isp1362_write_diraddr(isp1362_hcd, offset, len); 964 964 965 - DBG(3, "%s: Reading %d byte from buffer @%04x to memory @ %08x\n", __func__, 966 - len, offset, (u32)buf); 965 + DBG(3, "%s: Reading %d byte from buffer @%04x to memory @ %p\n", 966 + __func__, len, offset, buf); 967 967 968 968 isp1362_write_reg16(isp1362_hcd, HCuPINT, HCuPINT_EOT); 969 969 _WARN_ON((isp1362_read_reg16(isp1362_hcd, HCuPINT) & HCuPINT_EOT)); ··· 982 982 983 983 isp1362_write_diraddr(isp1362_hcd, offset, len); 984 984 985 - DBG(3, "%s: Writing %d byte to buffer @%04x from memory @ %08x\n", __func__, 986 - len, offset, (u32)buf); 985 + DBG(3, "%s: Writing %d byte to buffer @%04x from memory @ %p\n", 986 + __func__, len, offset, buf); 987 987 988 988 isp1362_write_reg16(isp1362_hcd, HCuPINT, HCuPINT_EOT); 989 989 _WARN_ON((isp1362_read_reg16(isp1362_hcd, HCuPINT) & HCuPINT_EOT));
+28 -1
drivers/usb/host/xhci-hcd.c
··· 335 335 spin_lock_irqsave(&xhci->lock, flags); 336 336 temp = xhci_readl(xhci, &xhci->op_regs->status); 337 337 xhci_dbg(xhci, "op reg status = 0x%x\n", temp); 338 + if (temp == 0xffffffff) { 339 + xhci_dbg(xhci, "HW died, polling stopped.\n"); 340 + spin_unlock_irqrestore(&xhci->lock, flags); 341 + return; 342 + } 343 + 338 344 temp = xhci_readl(xhci, &xhci->ir_set->irq_pending); 339 345 xhci_dbg(xhci, "ir_set 0 pending = 0x%x\n", temp); 340 346 xhci_dbg(xhci, "No-op commands handled = %d\n", xhci->noops_handled); ··· 782 776 { 783 777 unsigned long flags; 784 778 int ret; 779 + u32 temp; 785 780 struct xhci_hcd *xhci; 786 781 struct xhci_td *td; 787 782 unsigned int ep_index; ··· 795 788 ret = usb_hcd_check_unlink_urb(hcd, urb, status); 796 789 if (ret || !urb->hcpriv) 797 790 goto done; 791 + temp = xhci_readl(xhci, &xhci->op_regs->status); 792 + if (temp == 0xffffffff) { 793 + xhci_dbg(xhci, "HW died, freeing TD.\n"); 794 + td = (struct xhci_td *) urb->hcpriv; 795 + 796 + usb_hcd_unlink_urb_from_ep(hcd, urb); 797 + spin_unlock_irqrestore(&xhci->lock, flags); 798 + usb_hcd_giveback_urb(xhci_to_hcd(xhci), urb, -ESHUTDOWN); 799 + kfree(td); 800 + return ret; 801 + } 798 802 799 803 xhci_dbg(xhci, "Cancel URB %p\n", urb); 800 804 xhci_dbg(xhci, "Event ring:\n"); ··· 895 877 ctrl_ctx->drop_flags |= drop_flag; 896 878 new_drop_flags = ctrl_ctx->drop_flags; 897 879 898 - ctrl_ctx->add_flags = ~drop_flag; 880 + ctrl_ctx->add_flags &= ~drop_flag; 899 881 new_add_flags = ctrl_ctx->add_flags; 900 882 901 883 last_ctx = xhci_last_valid_endpoint(ctrl_ctx->add_flags); ··· 1428 1410 { 1429 1411 struct xhci_hcd *xhci = hcd_to_xhci(hcd); 1430 1412 unsigned long flags; 1413 + u32 state; 1431 1414 1432 1415 if (udev->slot_id == 0) 1433 1416 return; 1434 1417 1435 1418 spin_lock_irqsave(&xhci->lock, flags); 1419 + /* Don't disable the slot if the host controller is dead. */ 1420 + state = xhci_readl(xhci, &xhci->op_regs->status); 1421 + if (state == 0xffffffff) { 1422 + xhci_free_virt_device(xhci, udev->slot_id); 1423 + spin_unlock_irqrestore(&xhci->lock, flags); 1424 + return; 1425 + } 1426 + 1436 1427 if (xhci_queue_slot_control(xhci, TRB_DISABLE_SLOT, udev->slot_id)) { 1437 1428 spin_unlock_irqrestore(&xhci->lock, flags); 1438 1429 xhci_dbg(xhci, "FIXME: allocate a command ring segment\n");
+2 -1
drivers/usb/misc/usblcd.c
··· 313 313 314 314 if (le16_to_cpu(dev->udev->descriptor.idProduct) != 0x0001) { 315 315 dev_warn(&interface->dev, "USBLCD model not supported.\n"); 316 - return -ENODEV; 316 + retval = -ENODEV; 317 + goto error; 317 318 } 318 319 319 320 /* set up the endpoint information */
+1 -1
drivers/usb/musb/Kconfig
··· 8 8 9 9 # (M)HDRC = (Multipoint) Highspeed Dual-Role Controller 10 10 config USB_MUSB_HDRC 11 - depends on (USB || USB_GADGET) && HAVE_CLK 11 + depends on (USB || USB_GADGET) 12 12 depends on !SUPERH 13 13 select NOP_USB_XCEIV if ARCH_DAVINCI 14 14 select TWL4030_USB if MACH_OMAP_3430SDP
-1
drivers/usb/musb/blackfin.c
··· 14 14 #include <linux/slab.h> 15 15 #include <linux/init.h> 16 16 #include <linux/list.h> 17 - #include <linux/clk.h> 18 17 #include <linux/gpio.h> 19 18 #include <linux/io.h> 20 19
+7
drivers/usb/musb/musb_core.h
··· 95 95 #endif 96 96 #endif /* need MUSB gadget selection */ 97 97 98 + #ifndef CONFIG_HAVE_CLK 99 + /* Dummy stub for clk framework */ 100 + #define clk_get(dev, id) NULL 101 + #define clk_put(clock) do {} while (0) 102 + #define clk_enable(clock) do {} while (0) 103 + #define clk_disable(clock) do {} while (0) 104 + #endif 98 105 99 106 #ifdef CONFIG_PROC_FS 100 107 #include <linux/fs.h>
-9
drivers/usb/musb/musb_regs.h
··· 439 439 /* Not implemented - HW has seperate Tx/Rx FIFO */ 440 440 #define MUSB_TXCSR_MODE 0x0000 441 441 442 - /* 443 - * Dummy stub for clk framework, it will be removed 444 - * until Blackfin supports clk framework 445 - */ 446 - #define clk_get(dev, id) NULL 447 - #define clk_put(clock) do {} while (0) 448 - #define clk_enable(clock) do {} while (0) 449 - #define clk_disable(clock) do {} while (0) 450 - 451 442 static inline void musb_write_txfifosz(void __iomem *mbase, u8 c_size) 452 443 { 453 444 }
+4 -6
drivers/usb/serial/aircable.c
··· 554 554 { 555 555 struct usb_serial_port *port = tty->driver_data; 556 556 struct aircable_private *priv = usb_get_serial_port_data(port); 557 - unsigned long flags; 558 557 559 558 dbg("%s - port %d", __func__, port->number); 560 559 561 - spin_lock_irqsave(&priv->rx_lock, flags); 560 + spin_lock_irq(&priv->rx_lock); 562 561 priv->rx_flags |= THROTTLED; 563 - spin_unlock_irqrestore(&priv->rx_lock, flags); 562 + spin_unlock_irq(&priv->rx_lock); 564 563 } 565 564 566 565 /* Based on ftdi_sio.c unthrottle */ ··· 568 569 struct usb_serial_port *port = tty->driver_data; 569 570 struct aircable_private *priv = usb_get_serial_port_data(port); 570 571 int actually_throttled; 571 - unsigned long flags; 572 572 573 573 dbg("%s - port %d", __func__, port->number); 574 574 575 - spin_lock_irqsave(&priv->rx_lock, flags); 575 + spin_lock_irq(&priv->rx_lock); 576 576 actually_throttled = priv->rx_flags & ACTUALLY_THROTTLED; 577 577 priv->rx_flags &= ~(THROTTLED | ACTUALLY_THROTTLED); 578 - spin_unlock_irqrestore(&priv->rx_lock, flags); 578 + spin_unlock_irq(&priv->rx_lock); 579 579 580 580 if (actually_throttled) 581 581 schedule_work(&priv->rx_work);
+1
drivers/usb/serial/cp210x.c
··· 113 113 { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */ 114 114 { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ 115 115 { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ 116 + { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */ 116 117 { } /* Terminating Entry */ 117 118 }; 118 119
+5 -7
drivers/usb/serial/cypress_m8.c
··· 1155 1155 { 1156 1156 struct usb_serial_port *port = tty->driver_data; 1157 1157 struct cypress_private *priv = usb_get_serial_port_data(port); 1158 - unsigned long flags; 1159 1158 1160 1159 dbg("%s - port %d", __func__, port->number); 1161 1160 1162 - spin_lock_irqsave(&priv->lock, flags); 1161 + spin_lock_irq(&priv->lock); 1163 1162 priv->rx_flags = THROTTLED; 1164 - spin_unlock_irqrestore(&priv->lock, flags); 1163 + spin_unlock_irq(&priv->lock); 1165 1164 } 1166 1165 1167 1166 ··· 1169 1170 struct usb_serial_port *port = tty->driver_data; 1170 1171 struct cypress_private *priv = usb_get_serial_port_data(port); 1171 1172 int actually_throttled, result; 1172 - unsigned long flags; 1173 1173 1174 1174 dbg("%s - port %d", __func__, port->number); 1175 1175 1176 - spin_lock_irqsave(&priv->lock, flags); 1176 + spin_lock_irq(&priv->lock); 1177 1177 actually_throttled = priv->rx_flags & ACTUALLY_THROTTLED; 1178 1178 priv->rx_flags = 0; 1179 - spin_unlock_irqrestore(&priv->lock, flags); 1179 + spin_unlock_irq(&priv->lock); 1180 1180 1181 1181 if (!priv->comm_is_ok) 1182 1182 return; ··· 1183 1185 if (actually_throttled) { 1184 1186 port->interrupt_in_urb->dev = port->serial->dev; 1185 1187 1186 - result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); 1188 + result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); 1187 1189 if (result) { 1188 1190 dev_err(&port->dev, "%s - failed submitting read urb, " 1189 1191 "error %d\n", __func__, result);
+4 -4
drivers/usb/serial/digi_acceleport.c
··· 898 898 899 899 spin_lock_irqsave(&priv->dp_port_lock, flags); 900 900 901 - /* turn throttle off */ 902 - priv->dp_throttled = 0; 903 - priv->dp_throttle_restart = 0; 904 - 905 901 /* restart read chain */ 906 902 if (priv->dp_throttle_restart) { 907 903 port->read_urb->dev = port->serial->dev; 908 904 ret = usb_submit_urb(port->read_urb, GFP_ATOMIC); 909 905 } 906 + 907 + /* turn throttle off */ 908 + priv->dp_throttled = 0; 909 + priv->dp_throttle_restart = 0; 910 910 911 911 spin_unlock_irqrestore(&priv->dp_port_lock, flags); 912 912
+1 -1
drivers/usb/serial/empeg.c
··· 391 391 dbg("%s - port %d", __func__, port->number); 392 392 393 393 port->read_urb->dev = port->serial->dev; 394 - result = usb_submit_urb(port->read_urb, GFP_ATOMIC); 394 + result = usb_submit_urb(port->read_urb, GFP_KERNEL); 395 395 if (result) 396 396 dev_err(&port->dev, 397 397 "%s - failed submitting read urb, error %d\n",
+143 -307
drivers/usb/serial/ftdi_sio.c
··· 76 76 unsigned long last_dtr_rts; /* saved modem control outputs */ 77 77 wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ 78 78 char prev_status, diff_status; /* Used for TIOCMIWAIT */ 79 - __u8 rx_flags; /* receive state flags (throttling) */ 80 - spinlock_t rx_lock; /* spinlock for receive state */ 81 - struct delayed_work rx_work; 82 79 struct usb_serial_port *port; 83 - int rx_processed; 84 - unsigned long rx_bytes; 85 - 86 80 __u16 interface; /* FT2232C, FT2232H or FT4232H port interface 87 81 (0 for FT232/245) */ 88 82 ··· 731 737 /* Constants for read urb and write urb */ 732 738 #define BUFSZ 512 733 739 734 - /* rx_flags */ 735 - #define THROTTLED 0x01 736 - #define ACTUALLY_THROTTLED 0x02 737 - 738 740 /* Used for TIOCMIWAIT */ 739 741 #define FTDI_STATUS_B0_MASK (FTDI_RS0_CTS | FTDI_RS0_DSR | FTDI_RS0_RI | FTDI_RS0_RLSD) 740 742 #define FTDI_STATUS_B1_MASK (FTDI_RS_BI) ··· 753 763 static int ftdi_chars_in_buffer(struct tty_struct *tty); 754 764 static void ftdi_write_bulk_callback(struct urb *urb); 755 765 static void ftdi_read_bulk_callback(struct urb *urb); 756 - static void ftdi_process_read(struct work_struct *work); 766 + static void ftdi_process_read(struct usb_serial_port *port); 757 767 static void ftdi_set_termios(struct tty_struct *tty, 758 768 struct usb_serial_port *port, struct ktermios *old); 759 769 static int ftdi_tiocmget(struct tty_struct *tty, struct file *file); ··· 1224 1234 (new_serial.flags & ASYNC_FLAGS)); 1225 1235 priv->custom_divisor = new_serial.custom_divisor; 1226 1236 1227 - tty->low_latency = (priv->flags & ASYNC_LOW_LATENCY) ? 1 : 0; 1228 1237 write_latency_timer(port); 1229 1238 1230 1239 check_and_exit: ··· 1516 1527 } 1517 1528 1518 1529 kref_init(&priv->kref); 1519 - spin_lock_init(&priv->rx_lock); 1520 1530 spin_lock_init(&priv->tx_lock); 1521 1531 init_waitqueue_head(&priv->delta_msr_wait); 1522 1532 /* This will push the characters through immediately rather ··· 1537 1549 port->read_urb->transfer_buffer_length = BUFSZ; 1538 1550 } 1539 1551 1540 - INIT_DELAYED_WORK(&priv->rx_work, ftdi_process_read); 1541 1552 priv->port = port; 1542 1553 1543 1554 /* Free port's existing write urb and transfer buffer. */ ··· 1673 1686 return 0; 1674 1687 } 1675 1688 1689 + static int ftdi_submit_read_urb(struct usb_serial_port *port, gfp_t mem_flags) 1690 + { 1691 + struct urb *urb = port->read_urb; 1692 + struct usb_serial *serial = port->serial; 1693 + int result; 1694 + 1695 + usb_fill_bulk_urb(urb, serial->dev, 1696 + usb_rcvbulkpipe(serial->dev, 1697 + port->bulk_in_endpointAddress), 1698 + urb->transfer_buffer, 1699 + urb->transfer_buffer_length, 1700 + ftdi_read_bulk_callback, port); 1701 + result = usb_submit_urb(urb, mem_flags); 1702 + if (result) 1703 + dev_err(&port->dev, 1704 + "%s - failed submitting read urb, error %d\n", 1705 + __func__, result); 1706 + return result; 1707 + } 1708 + 1676 1709 static int ftdi_open(struct tty_struct *tty, struct usb_serial_port *port) 1677 1710 { /* ftdi_open */ 1678 1711 struct usb_device *dev = port->serial->dev; ··· 1707 1700 spin_lock_irqsave(&priv->tx_lock, flags); 1708 1701 priv->tx_bytes = 0; 1709 1702 spin_unlock_irqrestore(&priv->tx_lock, flags); 1710 - spin_lock_irqsave(&priv->rx_lock, flags); 1711 - priv->rx_bytes = 0; 1712 - spin_unlock_irqrestore(&priv->rx_lock, flags); 1713 - 1714 - if (tty) 1715 - tty->low_latency = (priv->flags & ASYNC_LOW_LATENCY) ? 1 : 0; 1716 1703 1717 1704 write_latency_timer(port); 1718 1705 ··· 1726 1725 ftdi_set_termios(tty, port, tty->termios); 1727 1726 1728 1727 /* Not throttled */ 1729 - spin_lock_irqsave(&priv->rx_lock, flags); 1730 - priv->rx_flags &= ~(THROTTLED | ACTUALLY_THROTTLED); 1731 - spin_unlock_irqrestore(&priv->rx_lock, flags); 1728 + spin_lock_irqsave(&port->lock, flags); 1729 + port->throttled = 0; 1730 + port->throttle_req = 0; 1731 + spin_unlock_irqrestore(&port->lock, flags); 1732 1732 1733 1733 /* Start reading from the device */ 1734 - priv->rx_processed = 0; 1735 - usb_fill_bulk_urb(port->read_urb, dev, 1736 - usb_rcvbulkpipe(dev, port->bulk_in_endpointAddress), 1737 - port->read_urb->transfer_buffer, 1738 - port->read_urb->transfer_buffer_length, 1739 - ftdi_read_bulk_callback, port); 1740 - result = usb_submit_urb(port->read_urb, GFP_KERNEL); 1741 - if (result) 1742 - dev_err(&port->dev, 1743 - "%s - failed submitting read urb, error %d\n", 1744 - __func__, result); 1745 - else 1734 + result = ftdi_submit_read_urb(port, GFP_KERNEL); 1735 + if (!result) 1746 1736 kref_get(&priv->kref); 1747 1737 1748 1738 return result; ··· 1778 1786 struct ftdi_private *priv = usb_get_serial_port_data(port); 1779 1787 1780 1788 dbg("%s", __func__); 1781 - 1782 - 1783 - /* cancel any scheduled reading */ 1784 - cancel_delayed_work_sync(&priv->rx_work); 1785 1789 1786 1790 /* shutdown our bulk read */ 1787 1791 usb_kill_urb(port->read_urb); ··· 2001 2013 return buffered; 2002 2014 } 2003 2015 2016 + static int ftdi_process_packet(struct tty_struct *tty, 2017 + struct usb_serial_port *port, struct ftdi_private *priv, 2018 + char *packet, int len) 2019 + { 2020 + int i; 2021 + char status; 2022 + char flag; 2023 + char *ch; 2024 + 2025 + dbg("%s - port %d", __func__, port->number); 2026 + 2027 + if (len < 2) { 2028 + dbg("malformed packet"); 2029 + return 0; 2030 + } 2031 + 2032 + /* Compare new line status to the old one, signal if different/ 2033 + N.B. packet may be processed more than once, but differences 2034 + are only processed once. */ 2035 + status = packet[0] & FTDI_STATUS_B0_MASK; 2036 + if (status != priv->prev_status) { 2037 + priv->diff_status |= status ^ priv->prev_status; 2038 + wake_up_interruptible(&priv->delta_msr_wait); 2039 + priv->prev_status = status; 2040 + } 2041 + 2042 + /* 2043 + * Although the device uses a bitmask and hence can have multiple 2044 + * errors on a packet - the order here sets the priority the error is 2045 + * returned to the tty layer. 2046 + */ 2047 + flag = TTY_NORMAL; 2048 + if (packet[1] & FTDI_RS_OE) { 2049 + flag = TTY_OVERRUN; 2050 + dbg("OVERRRUN error"); 2051 + } 2052 + if (packet[1] & FTDI_RS_BI) { 2053 + flag = TTY_BREAK; 2054 + dbg("BREAK received"); 2055 + usb_serial_handle_break(port); 2056 + } 2057 + if (packet[1] & FTDI_RS_PE) { 2058 + flag = TTY_PARITY; 2059 + dbg("PARITY error"); 2060 + } 2061 + if (packet[1] & FTDI_RS_FE) { 2062 + flag = TTY_FRAME; 2063 + dbg("FRAMING error"); 2064 + } 2065 + 2066 + len -= 2; 2067 + if (!len) 2068 + return 0; /* status only */ 2069 + ch = packet + 2; 2070 + 2071 + if (!(port->console && port->sysrq) && flag == TTY_NORMAL) 2072 + tty_insert_flip_string(tty, ch, len); 2073 + else { 2074 + for (i = 0; i < len; i++, ch++) { 2075 + if (!usb_serial_handle_sysrq_char(tty, port, *ch)) 2076 + tty_insert_flip_char(tty, *ch, flag); 2077 + } 2078 + } 2079 + return len; 2080 + } 2081 + 2082 + static void ftdi_process_read(struct usb_serial_port *port) 2083 + { 2084 + struct urb *urb = port->read_urb; 2085 + struct tty_struct *tty; 2086 + struct ftdi_private *priv = usb_get_serial_port_data(port); 2087 + char *data = (char *)urb->transfer_buffer; 2088 + int i; 2089 + int len; 2090 + int count = 0; 2091 + 2092 + tty = tty_port_tty_get(&port->port); 2093 + if (!tty) 2094 + return; 2095 + 2096 + for (i = 0; i < urb->actual_length; i += priv->max_packet_size) { 2097 + len = min_t(int, urb->actual_length - i, priv->max_packet_size); 2098 + count += ftdi_process_packet(tty, port, priv, &data[i], len); 2099 + } 2100 + 2101 + if (count) 2102 + tty_flip_buffer_push(tty); 2103 + tty_kref_put(tty); 2104 + } 2105 + 2004 2106 static void ftdi_read_bulk_callback(struct urb *urb) 2005 2107 { 2006 2108 struct usb_serial_port *port = urb->context; 2007 - struct tty_struct *tty; 2008 - struct ftdi_private *priv; 2009 - unsigned long countread; 2010 - unsigned long flags; 2011 - int status = urb->status; 2012 - 2013 - if (urb->number_of_packets > 0) { 2014 - dev_err(&port->dev, "%s transfer_buffer_length %d " 2015 - "actual_length %d number of packets %d\n", __func__, 2016 - urb->transfer_buffer_length, 2017 - urb->actual_length, urb->number_of_packets); 2018 - dev_err(&port->dev, "%s transfer_flags %x\n", __func__, 2019 - urb->transfer_flags); 2020 - } 2021 - 2022 - dbg("%s - port %d", __func__, port->number); 2023 - 2024 - if (port->port.count <= 0) 2025 - return; 2026 - 2027 - tty = tty_port_tty_get(&port->port); 2028 - if (!tty) { 2029 - dbg("%s - bad tty pointer - exiting", __func__); 2030 - return; 2031 - } 2032 - 2033 - priv = usb_get_serial_port_data(port); 2034 - if (!priv) { 2035 - dbg("%s - bad port private data pointer - exiting", __func__); 2036 - goto out; 2037 - } 2038 - 2039 - if (urb != port->read_urb) 2040 - dev_err(&port->dev, "%s - Not my urb!\n", __func__); 2041 - 2042 - if (status) { 2043 - /* This will happen at close every time so it is a dbg not an 2044 - err */ 2045 - dbg("(this is ok on close) nonzero read bulk status received: %d", status); 2046 - goto out; 2047 - } 2048 - 2049 - /* count data bytes, but not status bytes */ 2050 - countread = urb->actual_length; 2051 - countread -= 2 * DIV_ROUND_UP(countread, priv->max_packet_size); 2052 - spin_lock_irqsave(&priv->rx_lock, flags); 2053 - priv->rx_bytes += countread; 2054 - spin_unlock_irqrestore(&priv->rx_lock, flags); 2055 - 2056 - ftdi_process_read(&priv->rx_work.work); 2057 - out: 2058 - tty_kref_put(tty); 2059 - } /* ftdi_read_bulk_callback */ 2060 - 2061 - 2062 - static void ftdi_process_read(struct work_struct *work) 2063 - { /* ftdi_process_read */ 2064 - struct ftdi_private *priv = 2065 - container_of(work, struct ftdi_private, rx_work.work); 2066 - struct usb_serial_port *port = priv->port; 2067 - struct urb *urb; 2068 - struct tty_struct *tty; 2069 - char error_flag; 2070 - unsigned char *data; 2071 - 2072 - int i; 2073 - int result; 2074 - int need_flip; 2075 - int packet_offset; 2076 2109 unsigned long flags; 2077 2110 2078 2111 dbg("%s - port %d", __func__, port->number); 2079 2112 2080 - if (port->port.count <= 0) 2081 - return; 2082 - 2083 - tty = tty_port_tty_get(&port->port); 2084 - if (!tty) { 2085 - dbg("%s - bad tty pointer - exiting", __func__); 2113 + if (urb->status) { 2114 + dbg("%s - nonzero read bulk status received: %d", 2115 + __func__, urb->status); 2086 2116 return; 2087 2117 } 2088 2118 2089 - priv = usb_get_serial_port_data(port); 2090 - if (!priv) { 2091 - dbg("%s - bad port private data pointer - exiting", __func__); 2092 - goto out; 2093 - } 2119 + usb_serial_debug_data(debug, &port->dev, __func__, 2120 + urb->actual_length, urb->transfer_buffer); 2121 + ftdi_process_read(port); 2094 2122 2095 - urb = port->read_urb; 2096 - if (!urb) { 2097 - dbg("%s - bad read_urb pointer - exiting", __func__); 2098 - goto out; 2099 - } 2100 - 2101 - data = urb->transfer_buffer; 2102 - 2103 - if (priv->rx_processed) { 2104 - dbg("%s - already processed: %d bytes, %d remain", __func__, 2105 - priv->rx_processed, 2106 - urb->actual_length - priv->rx_processed); 2107 - } else { 2108 - /* The first two bytes of every read packet are status */ 2109 - if (urb->actual_length > 2) 2110 - usb_serial_debug_data(debug, &port->dev, __func__, 2111 - urb->actual_length, data); 2112 - else 2113 - dbg("Status only: %03oo %03oo", data[0], data[1]); 2114 - } 2115 - 2116 - 2117 - /* TO DO -- check for hung up line and handle appropriately: */ 2118 - /* send hangup */ 2119 - /* See acm.c - you do a tty_hangup - eg tty_hangup(tty) */ 2120 - /* if CD is dropped and the line is not CLOCAL then we should hangup */ 2121 - 2122 - need_flip = 0; 2123 - for (packet_offset = priv->rx_processed; 2124 - packet_offset < urb->actual_length; packet_offset += priv->max_packet_size) { 2125 - int length; 2126 - 2127 - /* Compare new line status to the old one, signal if different/ 2128 - N.B. packet may be processed more than once, but differences 2129 - are only processed once. */ 2130 - char new_status = data[packet_offset + 0] & 2131 - FTDI_STATUS_B0_MASK; 2132 - if (new_status != priv->prev_status) { 2133 - priv->diff_status |= 2134 - new_status ^ priv->prev_status; 2135 - wake_up_interruptible(&priv->delta_msr_wait); 2136 - priv->prev_status = new_status; 2137 - } 2138 - 2139 - length = min_t(u32, priv->max_packet_size, urb->actual_length-packet_offset)-2; 2140 - if (length < 0) { 2141 - dev_err(&port->dev, "%s - bad packet length: %d\n", 2142 - __func__, length+2); 2143 - length = 0; 2144 - } 2145 - 2146 - if (priv->rx_flags & THROTTLED) { 2147 - dbg("%s - throttled", __func__); 2148 - break; 2149 - } 2150 - if (tty_buffer_request_room(tty, length) < length) { 2151 - /* break out & wait for throttling/unthrottling to 2152 - happen */ 2153 - dbg("%s - receive room low", __func__); 2154 - break; 2155 - } 2156 - 2157 - /* Handle errors and break */ 2158 - error_flag = TTY_NORMAL; 2159 - /* Although the device uses a bitmask and hence can have 2160 - multiple errors on a packet - the order here sets the 2161 - priority the error is returned to the tty layer */ 2162 - 2163 - if (data[packet_offset+1] & FTDI_RS_OE) { 2164 - error_flag = TTY_OVERRUN; 2165 - dbg("OVERRRUN error"); 2166 - } 2167 - if (data[packet_offset+1] & FTDI_RS_BI) { 2168 - error_flag = TTY_BREAK; 2169 - dbg("BREAK received"); 2170 - usb_serial_handle_break(port); 2171 - } 2172 - if (data[packet_offset+1] & FTDI_RS_PE) { 2173 - error_flag = TTY_PARITY; 2174 - dbg("PARITY error"); 2175 - } 2176 - if (data[packet_offset+1] & FTDI_RS_FE) { 2177 - error_flag = TTY_FRAME; 2178 - dbg("FRAMING error"); 2179 - } 2180 - if (length > 0) { 2181 - for (i = 2; i < length+2; i++) { 2182 - /* Note that the error flag is duplicated for 2183 - every character received since we don't know 2184 - which character it applied to */ 2185 - if (!usb_serial_handle_sysrq_char(tty, port, 2186 - data[packet_offset + i])) 2187 - tty_insert_flip_char(tty, 2188 - data[packet_offset + i], 2189 - error_flag); 2190 - } 2191 - need_flip = 1; 2192 - } 2193 - 2194 - #ifdef NOT_CORRECT_BUT_KEEPING_IT_FOR_NOW 2195 - /* if a parity error is detected you get status packets forever 2196 - until a character is sent without a parity error. 2197 - This doesn't work well since the application receives a 2198 - never ending stream of bad data - even though new data 2199 - hasn't been sent. Therefore I (bill) have taken this out. 2200 - However - this might make sense for framing errors and so on 2201 - so I am leaving the code in for now. 2202 - */ 2203 - else { 2204 - if (error_flag != TTY_NORMAL) { 2205 - dbg("error_flag is not normal"); 2206 - /* In this case it is just status - if that is 2207 - an error send a bad character */ 2208 - if (tty->flip.count >= TTY_FLIPBUF_SIZE) 2209 - tty_flip_buffer_push(tty); 2210 - tty_insert_flip_char(tty, 0xff, error_flag); 2211 - need_flip = 1; 2212 - } 2213 - } 2214 - #endif 2215 - } /* "for(packet_offset=0..." */ 2216 - 2217 - /* Low latency */ 2218 - if (need_flip) 2219 - tty_flip_buffer_push(tty); 2220 - 2221 - if (packet_offset < urb->actual_length) { 2222 - /* not completely processed - record progress */ 2223 - priv->rx_processed = packet_offset; 2224 - dbg("%s - incomplete, %d bytes processed, %d remain", 2225 - __func__, packet_offset, 2226 - urb->actual_length - packet_offset); 2227 - /* check if we were throttled while processing */ 2228 - spin_lock_irqsave(&priv->rx_lock, flags); 2229 - if (priv->rx_flags & THROTTLED) { 2230 - priv->rx_flags |= ACTUALLY_THROTTLED; 2231 - spin_unlock_irqrestore(&priv->rx_lock, flags); 2232 - dbg("%s - deferring remainder until unthrottled", 2233 - __func__); 2234 - goto out; 2235 - } 2236 - spin_unlock_irqrestore(&priv->rx_lock, flags); 2237 - /* if the port is closed stop trying to read */ 2238 - if (port->port.count > 0) 2239 - /* delay processing of remainder */ 2240 - schedule_delayed_work(&priv->rx_work, 1); 2241 - else 2242 - dbg("%s - port is closed", __func__); 2243 - goto out; 2244 - } 2245 - 2246 - /* urb is completely processed */ 2247 - priv->rx_processed = 0; 2248 - 2249 - /* if the port is closed stop trying to read */ 2250 - if (port->port.count > 0) { 2251 - /* Continue trying to always read */ 2252 - usb_fill_bulk_urb(port->read_urb, port->serial->dev, 2253 - usb_rcvbulkpipe(port->serial->dev, 2254 - port->bulk_in_endpointAddress), 2255 - port->read_urb->transfer_buffer, 2256 - port->read_urb->transfer_buffer_length, 2257 - ftdi_read_bulk_callback, port); 2258 - 2259 - result = usb_submit_urb(port->read_urb, GFP_ATOMIC); 2260 - if (result) 2261 - dev_err(&port->dev, 2262 - "%s - failed resubmitting read urb, error %d\n", 2263 - __func__, result); 2264 - } 2265 - out: 2266 - tty_kref_put(tty); 2267 - } /* ftdi_process_read */ 2268 - 2123 + spin_lock_irqsave(&port->lock, flags); 2124 + port->throttled = port->throttle_req; 2125 + if (!port->throttled) { 2126 + spin_unlock_irqrestore(&port->lock, flags); 2127 + ftdi_submit_read_urb(port, GFP_ATOMIC); 2128 + } else 2129 + spin_unlock_irqrestore(&port->lock, flags); 2130 + } 2269 2131 2270 2132 static void ftdi_break_ctl(struct tty_struct *tty, int break_state) 2271 2133 { ··· 2447 2609 static void ftdi_throttle(struct tty_struct *tty) 2448 2610 { 2449 2611 struct usb_serial_port *port = tty->driver_data; 2450 - struct ftdi_private *priv = usb_get_serial_port_data(port); 2451 2612 unsigned long flags; 2452 2613 2453 2614 dbg("%s - port %d", __func__, port->number); 2454 2615 2455 - spin_lock_irqsave(&priv->rx_lock, flags); 2456 - priv->rx_flags |= THROTTLED; 2457 - spin_unlock_irqrestore(&priv->rx_lock, flags); 2616 + spin_lock_irqsave(&port->lock, flags); 2617 + port->throttle_req = 1; 2618 + spin_unlock_irqrestore(&port->lock, flags); 2458 2619 } 2459 2620 2460 - 2461 - static void ftdi_unthrottle(struct tty_struct *tty) 2621 + void ftdi_unthrottle(struct tty_struct *tty) 2462 2622 { 2463 2623 struct usb_serial_port *port = tty->driver_data; 2464 - struct ftdi_private *priv = usb_get_serial_port_data(port); 2465 - int actually_throttled; 2624 + int was_throttled; 2466 2625 unsigned long flags; 2467 2626 2468 2627 dbg("%s - port %d", __func__, port->number); 2469 2628 2470 - spin_lock_irqsave(&priv->rx_lock, flags); 2471 - actually_throttled = priv->rx_flags & ACTUALLY_THROTTLED; 2472 - priv->rx_flags &= ~(THROTTLED | ACTUALLY_THROTTLED); 2473 - spin_unlock_irqrestore(&priv->rx_lock, flags); 2629 + spin_lock_irqsave(&port->lock, flags); 2630 + was_throttled = port->throttled; 2631 + port->throttled = port->throttle_req = 0; 2632 + spin_unlock_irqrestore(&port->lock, flags); 2474 2633 2475 - if (actually_throttled) 2476 - schedule_delayed_work(&priv->rx_work, 0); 2634 + /* Resubmit urb if throttled and open. */ 2635 + if (was_throttled && test_bit(ASYNCB_INITIALIZED, &port->port.flags)) 2636 + ftdi_submit_read_urb(port, GFP_KERNEL); 2477 2637 } 2478 2638 2479 2639 static int __init ftdi_init(void)
+5 -7
drivers/usb/serial/garmin_gps.c
··· 1390 1390 { 1391 1391 struct usb_serial_port *port = tty->driver_data; 1392 1392 struct garmin_data *garmin_data_p = usb_get_serial_port_data(port); 1393 - unsigned long flags; 1394 1393 1395 1394 dbg("%s - port %d", __func__, port->number); 1396 1395 /* set flag, data received will be put into a queue 1397 1396 for later processing */ 1398 - spin_lock_irqsave(&garmin_data_p->lock, flags); 1397 + spin_lock_irq(&garmin_data_p->lock); 1399 1398 garmin_data_p->flags |= FLAGS_QUEUING|FLAGS_THROTTLED; 1400 - spin_unlock_irqrestore(&garmin_data_p->lock, flags); 1399 + spin_unlock_irq(&garmin_data_p->lock); 1401 1400 } 1402 1401 1403 1402 ··· 1404 1405 { 1405 1406 struct usb_serial_port *port = tty->driver_data; 1406 1407 struct garmin_data *garmin_data_p = usb_get_serial_port_data(port); 1407 - unsigned long flags; 1408 1408 int status; 1409 1409 1410 1410 dbg("%s - port %d", __func__, port->number); 1411 - spin_lock_irqsave(&garmin_data_p->lock, flags); 1411 + spin_lock_irq(&garmin_data_p->lock); 1412 1412 garmin_data_p->flags &= ~FLAGS_THROTTLED; 1413 - spin_unlock_irqrestore(&garmin_data_p->lock, flags); 1413 + spin_unlock_irq(&garmin_data_p->lock); 1414 1414 1415 1415 /* in native mode send queued data to tty, in 1416 1416 serial mode nothing needs to be done here */ ··· 1417 1419 garmin_flush_queue(garmin_data_p); 1418 1420 1419 1421 if (0 != (garmin_data_p->flags & FLAGS_BULK_IN_ACTIVE)) { 1420 - status = usb_submit_urb(port->read_urb, GFP_ATOMIC); 1422 + status = usb_submit_urb(port->read_urb, GFP_KERNEL); 1421 1423 if (status) 1422 1424 dev_err(&port->dev, 1423 1425 "%s - failed resubmitting read urb, error %d\n",
+1 -1
drivers/usb/serial/generic.c
··· 546 546 547 547 if (was_throttled) { 548 548 /* Resume reading from device */ 549 - usb_serial_generic_resubmit_read_urb(port, GFP_KERNEL); 549 + flush_and_resubmit_read_urb(port); 550 550 } 551 551 } 552 552
+9
drivers/usb/serial/ipaq.c
··· 966 966 static int ipaq_startup(struct usb_serial *serial) 967 967 { 968 968 dbg("%s", __func__); 969 + 970 + /* Some of the devices in ipaq_id_table[] are composite, and we 971 + * shouldn't bind to all the interfaces. This test will rule out 972 + * some obviously invalid possibilities. 973 + */ 974 + if (serial->num_bulk_in < serial->num_ports || 975 + serial->num_bulk_out < serial->num_ports) 976 + return -ENODEV; 977 + 969 978 if (serial->dev->actconfig->desc.bConfigurationValue != 1) { 970 979 /* 971 980 * FIXME: HP iPaq rx3715, possibly others, have 1 config that
+1 -1
drivers/usb/serial/keyspan_pda.c
··· 290 290 /* just restart the receive interrupt URB */ 291 291 dbg("keyspan_pda_rx_unthrottle port %d", port->number); 292 292 port->interrupt_in_urb->dev = port->serial->dev; 293 - if (usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC)) 293 + if (usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL)) 294 294 dbg(" usb_submit_urb(read urb) failed"); 295 295 return; 296 296 }
+1 -1
drivers/usb/serial/kl5kusb105.c
··· 951 951 dbg("%s - port %d", __func__, port->number); 952 952 953 953 port->read_urb->dev = port->serial->dev; 954 - result = usb_submit_urb(port->read_urb, GFP_ATOMIC); 954 + result = usb_submit_urb(port->read_urb, GFP_KERNEL); 955 955 if (result) 956 956 dev_err(&port->dev, 957 957 "%s - failed submitting read urb, error %d\n",
+6 -8
drivers/usb/serial/mct_u232.c
··· 777 777 { 778 778 struct usb_serial_port *port = tty->driver_data; 779 779 struct mct_u232_private *priv = usb_get_serial_port_data(port); 780 - unsigned long flags; 781 780 unsigned int control_state; 782 781 783 782 dbg("%s - port %d", __func__, port->number); 784 783 785 - spin_lock_irqsave(&priv->lock, flags); 784 + spin_lock_irq(&priv->lock); 786 785 priv->rx_flags |= THROTTLED; 787 786 if (C_CRTSCTS(tty)) { 788 787 priv->control_state &= ~TIOCM_RTS; 789 788 control_state = priv->control_state; 790 - spin_unlock_irqrestore(&priv->lock, flags); 789 + spin_unlock_irq(&priv->lock); 791 790 (void) mct_u232_set_modem_ctrl(port->serial, control_state); 792 791 } else { 793 - spin_unlock_irqrestore(&priv->lock, flags); 792 + spin_unlock_irq(&priv->lock); 794 793 } 795 794 } 796 795 ··· 798 799 { 799 800 struct usb_serial_port *port = tty->driver_data; 800 801 struct mct_u232_private *priv = usb_get_serial_port_data(port); 801 - unsigned long flags; 802 802 unsigned int control_state; 803 803 804 804 dbg("%s - port %d", __func__, port->number); 805 805 806 - spin_lock_irqsave(&priv->lock, flags); 806 + spin_lock_irq(&priv->lock); 807 807 if ((priv->rx_flags & THROTTLED) && C_CRTSCTS(tty)) { 808 808 priv->rx_flags &= ~THROTTLED; 809 809 priv->control_state |= TIOCM_RTS; 810 810 control_state = priv->control_state; 811 - spin_unlock_irqrestore(&priv->lock, flags); 811 + spin_unlock_irq(&priv->lock); 812 812 (void) mct_u232_set_modem_ctrl(port->serial, control_state); 813 813 } else { 814 - spin_unlock_irqrestore(&priv->lock, flags); 814 + spin_unlock_irq(&priv->lock); 815 815 } 816 816 } 817 817
+8 -5
drivers/usb/serial/opticon.c
··· 314 314 struct usb_serial_port *port = tty->driver_data; 315 315 struct opticon_private *priv = usb_get_serial_data(port->serial); 316 316 unsigned long flags; 317 - int result; 317 + int result, was_throttled; 318 318 319 319 dbg("%s - port %d", __func__, port->number); 320 320 321 321 spin_lock_irqsave(&priv->lock, flags); 322 322 priv->throttled = false; 323 + was_throttled = priv->actually_throttled; 323 324 priv->actually_throttled = false; 324 325 spin_unlock_irqrestore(&priv->lock, flags); 325 326 326 327 priv->bulk_read_urb->dev = port->serial->dev; 327 - result = usb_submit_urb(priv->bulk_read_urb, GFP_ATOMIC); 328 - if (result) 329 - dev_err(&port->dev, 330 - "%s - failed submitting read urb, error %d\n", 328 + if (was_throttled) { 329 + result = usb_submit_urb(priv->bulk_read_urb, GFP_ATOMIC); 330 + if (result) 331 + dev_err(&port->dev, 332 + "%s - failed submitting read urb, error %d\n", 331 333 __func__, result); 334 + } 332 335 } 333 336 334 337 static int opticon_tiocmget(struct tty_struct *tty, struct file *file)
+4
drivers/usb/serial/option.c
··· 165 165 #define HUAWEI_PRODUCT_E143D 0x143D 166 166 #define HUAWEI_PRODUCT_E143E 0x143E 167 167 #define HUAWEI_PRODUCT_E143F 0x143F 168 + #define HUAWEI_PRODUCT_E14AC 0x14AC 168 169 169 170 #define QUANTA_VENDOR_ID 0x0408 170 171 #define QUANTA_PRODUCT_Q101 0xEA02 ··· 319 318 /* TOSHIBA PRODUCTS */ 320 319 #define TOSHIBA_VENDOR_ID 0x0930 321 320 #define TOSHIBA_PRODUCT_HSDPA_MINICARD 0x1302 321 + #define TOSHIBA_PRODUCT_G450 0x0d45 322 322 323 323 #define ALINK_VENDOR_ID 0x1e0e 324 324 #define ALINK_PRODUCT_3GU 0x9200 ··· 426 424 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143D, 0xff, 0xff, 0xff) }, 427 425 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143E, 0xff, 0xff, 0xff) }, 428 426 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143F, 0xff, 0xff, 0xff) }, 427 + { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC) }, 429 428 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_9508) }, 430 429 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, /* Novatel Merlin V640/XV620 */ 431 430 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, /* Novatel Merlin V620/S620 */ ··· 584 581 { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4523) }, 585 582 { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4515) }, 586 583 { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4519) }, 584 + { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_G450) }, 587 585 { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_HSDPA_MINICARD ) }, /* Toshiba 3G HSDPA == Novatel Expedite EU870D MiniCard */ 588 586 { USB_DEVICE(ALINK_VENDOR_ID, 0x9000) }, 589 587 { USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) },
+3 -3
drivers/usb/serial/oti6858.c
··· 288 288 289 289 dbg("%s(): submitting interrupt urb", __func__); 290 290 port->interrupt_in_urb->dev = port->serial->dev; 291 - result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); 291 + result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); 292 292 if (result != 0) { 293 293 dev_err(&port->dev, "%s(): usb_submit_urb() failed" 294 294 " with error %d\n", __func__, result); ··· 335 335 336 336 dbg("%s(): submitting interrupt urb", __func__); 337 337 port->interrupt_in_urb->dev = port->serial->dev; 338 - result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); 338 + result = usb_submit_urb(port->interrupt_in_urb, GFP_NOIO); 339 339 if (result != 0) { 340 340 dev_err(&port->dev, "%s(): usb_submit_urb() failed" 341 341 " with error %d\n", __func__, result); ··· 349 349 350 350 port->write_urb->transfer_buffer_length = count; 351 351 port->write_urb->dev = port->serial->dev; 352 - result = usb_submit_urb(port->write_urb, GFP_ATOMIC); 352 + result = usb_submit_urb(port->write_urb, GFP_NOIO); 353 353 if (result != 0) { 354 354 dev_err(&port->dev, "%s(): usb_submit_urb() failed" 355 355 " with error %d\n", __func__, result);
+5 -3
drivers/usb/serial/pl2303.c
··· 1046 1046 /* overrun is special, not associated with a char */ 1047 1047 if (line_status & UART_OVERRUN_ERROR) 1048 1048 tty_insert_flip_char(tty, 0, TTY_OVERRUN); 1049 - if (port->console && port->sysrq) { 1049 + 1050 + if (tty_flag == TTY_NORMAL && !(port->console && port->sysrq)) 1051 + tty_insert_flip_string(tty, data, urb->actual_length); 1052 + else { 1050 1053 int i; 1051 1054 for (i = 0; i < urb->actual_length; ++i) 1052 1055 if (!usb_serial_handle_sysrq_char(tty, port, data[i])) 1053 1056 tty_insert_flip_char(tty, data[i], tty_flag); 1054 - } else 1055 - tty_insert_flip_string(tty, data, urb->actual_length); 1057 + } 1056 1058 tty_flip_buffer_push(tty); 1057 1059 } 1058 1060
+1 -1
drivers/usb/serial/sierra.c
··· 17 17 Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org> 18 18 */ 19 19 20 - #define DRIVER_VERSION "v.1.3.7" 20 + #define DRIVER_VERSION "v.1.3.8" 21 21 #define DRIVER_AUTHOR "Kevin Lloyd, Elina Pasheva, Matthew Safar, Rory Filer" 22 22 #define DRIVER_DESC "USB Driver for Sierra Wireless USB modems" 23 23
+12 -10
drivers/usb/serial/symbolserial.c
··· 165 165 { 166 166 struct usb_serial_port *port = tty->driver_data; 167 167 struct symbol_private *priv = usb_get_serial_data(port->serial); 168 - unsigned long flags; 169 168 170 169 dbg("%s - port %d", __func__, port->number); 171 - spin_lock_irqsave(&priv->lock, flags); 170 + spin_lock_irq(&priv->lock); 172 171 priv->throttled = true; 173 - spin_unlock_irqrestore(&priv->lock, flags); 172 + spin_unlock_irq(&priv->lock); 174 173 } 175 174 176 175 static void symbol_unthrottle(struct tty_struct *tty) 177 176 { 178 177 struct usb_serial_port *port = tty->driver_data; 179 178 struct symbol_private *priv = usb_get_serial_data(port->serial); 180 - unsigned long flags; 181 179 int result; 180 + bool was_throttled; 182 181 183 182 dbg("%s - port %d", __func__, port->number); 184 183 185 - spin_lock_irqsave(&priv->lock, flags); 184 + spin_lock_irq(&priv->lock); 186 185 priv->throttled = false; 186 + was_throttled = priv->actually_throttled; 187 187 priv->actually_throttled = false; 188 - spin_unlock_irqrestore(&priv->lock, flags); 188 + spin_unlock_irq(&priv->lock); 189 189 190 190 priv->int_urb->dev = port->serial->dev; 191 - result = usb_submit_urb(priv->int_urb, GFP_ATOMIC); 192 - if (result) 193 - dev_err(&port->dev, 194 - "%s - failed submitting read urb, error %d\n", 191 + if (was_throttled) { 192 + result = usb_submit_urb(priv->int_urb, GFP_KERNEL); 193 + if (result) 194 + dev_err(&port->dev, 195 + "%s - failed submitting read urb, error %d\n", 195 196 __func__, result); 197 + } 196 198 } 197 199 198 200 static int symbol_startup(struct usb_serial *serial)
+8 -2
drivers/usb/serial/usb-serial.c
··· 156 156 if (serial->minor != SERIAL_TTY_NO_MINOR) 157 157 return_serial(serial); 158 158 159 - serial->type->release(serial); 159 + if (serial->attached) 160 + serial->type->release(serial); 160 161 161 162 /* Now that nothing is using the ports, they can be freed */ 162 163 for (i = 0; i < serial->num_port_pointers; ++i) { ··· 1060 1059 module_put(type->driver.owner); 1061 1060 if (retval < 0) 1062 1061 goto probe_error; 1062 + serial->attached = 1; 1063 1063 if (retval > 0) { 1064 1064 /* quietly accept this device, but don't bind to a 1065 1065 serial port as it's about to disappear */ 1066 1066 serial->num_ports = 0; 1067 1067 goto exit; 1068 1068 } 1069 + } else { 1070 + serial->attached = 1; 1069 1071 } 1070 1072 1071 1073 if (get_free_serial(serial, num_ports, &minor) == NULL) { ··· 1168 1164 1169 1165 if (serial->type->suspend) { 1170 1166 r = serial->type->suspend(serial, message); 1171 - if (r < 0) 1167 + if (r < 0) { 1168 + serial->suspending = 0; 1172 1169 goto err_out; 1170 + } 1173 1171 } 1174 1172 1175 1173 for (i = 0; i < serial->num_ports; ++i) {
+15 -13
drivers/usb/serial/visor.c
··· 513 513 tty_kref_put(tty); 514 514 } 515 515 spin_lock(&priv->lock); 516 - priv->bytes_in += available_room; 516 + if (tty) 517 + priv->bytes_in += available_room; 517 518 518 519 } else { 519 520 spin_lock(&priv->lock); ··· 583 582 { 584 583 struct usb_serial_port *port = tty->driver_data; 585 584 struct visor_private *priv = usb_get_serial_port_data(port); 586 - unsigned long flags; 587 585 588 586 dbg("%s - port %d", __func__, port->number); 589 - spin_lock_irqsave(&priv->lock, flags); 587 + spin_lock_irq(&priv->lock); 590 588 priv->throttled = 1; 591 - spin_unlock_irqrestore(&priv->lock, flags); 589 + spin_unlock_irq(&priv->lock); 592 590 } 593 591 594 592 ··· 595 595 { 596 596 struct usb_serial_port *port = tty->driver_data; 597 597 struct visor_private *priv = usb_get_serial_port_data(port); 598 - unsigned long flags; 599 - int result; 598 + int result, was_throttled; 600 599 601 600 dbg("%s - port %d", __func__, port->number); 602 - spin_lock_irqsave(&priv->lock, flags); 601 + spin_lock_irq(&priv->lock); 603 602 priv->throttled = 0; 603 + was_throttled = priv->actually_throttled; 604 604 priv->actually_throttled = 0; 605 - spin_unlock_irqrestore(&priv->lock, flags); 605 + spin_unlock_irq(&priv->lock); 606 606 607 - port->read_urb->dev = port->serial->dev; 608 - result = usb_submit_urb(port->read_urb, GFP_ATOMIC); 609 - if (result) 610 - dev_err(&port->dev, 611 - "%s - failed submitting read urb, error %d\n", 607 + if (was_throttled) { 608 + port->read_urb->dev = port->serial->dev; 609 + result = usb_submit_urb(port->read_urb, GFP_KERNEL); 610 + if (result) 611 + dev_err(&port->dev, 612 + "%s - failed submitting read urb, error %d\n", 612 613 __func__, result); 614 + } 613 615 } 614 616 615 617 static int palm_os_3_probe(struct usb_serial *serial,
+4 -6
drivers/usb/serial/whiteheat.c
··· 949 949 { 950 950 struct usb_serial_port *port = tty->driver_data; 951 951 struct whiteheat_private *info = usb_get_serial_port_data(port); 952 - unsigned long flags; 953 952 954 953 dbg("%s - port %d", __func__, port->number); 955 954 956 - spin_lock_irqsave(&info->lock, flags); 955 + spin_lock_irq(&info->lock); 957 956 info->flags |= THROTTLED; 958 - spin_unlock_irqrestore(&info->lock, flags); 957 + spin_unlock_irq(&info->lock); 959 958 960 959 return; 961 960 } ··· 965 966 struct usb_serial_port *port = tty->driver_data; 966 967 struct whiteheat_private *info = usb_get_serial_port_data(port); 967 968 int actually_throttled; 968 - unsigned long flags; 969 969 970 970 dbg("%s - port %d", __func__, port->number); 971 971 972 - spin_lock_irqsave(&info->lock, flags); 972 + spin_lock_irq(&info->lock); 973 973 actually_throttled = info->flags & ACTUALLY_THROTTLED; 974 974 info->flags &= ~(THROTTLED | ACTUALLY_THROTTLED); 975 - spin_unlock_irqrestore(&info->lock, flags); 975 + spin_unlock_irq(&info->lock); 976 976 977 977 if (actually_throttled) 978 978 rx_data_softint(&info->rx_work);
+22 -7
drivers/usb/storage/transport.c
··· 768 768 /* set the result so the higher layers expect this data */ 769 769 srb->result = SAM_STAT_CHECK_CONDITION; 770 770 771 - /* If things are really okay, then let's show that. Zero 772 - * out the sense buffer so the higher layers won't realize 773 - * we did an unsolicited auto-sense. */ 774 - if (result == USB_STOR_TRANSPORT_GOOD && 775 - /* Filemark 0, ignore EOM, ILI 0, no sense */ 771 + /* We often get empty sense data. This could indicate that 772 + * everything worked or that there was an unspecified 773 + * problem. We have to decide which. 774 + */ 775 + if ( /* Filemark 0, ignore EOM, ILI 0, no sense */ 776 776 (srb->sense_buffer[2] & 0xaf) == 0 && 777 777 /* No ASC or ASCQ */ 778 778 srb->sense_buffer[12] == 0 && 779 779 srb->sense_buffer[13] == 0) { 780 - srb->result = SAM_STAT_GOOD; 781 - srb->sense_buffer[0] = 0x0; 780 + 781 + /* If things are really okay, then let's show that. 782 + * Zero out the sense buffer so the higher layers 783 + * won't realize we did an unsolicited auto-sense. 784 + */ 785 + if (result == USB_STOR_TRANSPORT_GOOD) { 786 + srb->result = SAM_STAT_GOOD; 787 + srb->sense_buffer[0] = 0x0; 788 + 789 + /* If there was a problem, report an unspecified 790 + * hardware error to prevent the higher layers from 791 + * entering an infinite retry loop. 792 + */ 793 + } else { 794 + srb->result = DID_ERROR << 16; 795 + srb->sense_buffer[2] = HARDWARE_ERROR; 796 + } 782 797 } 783 798 } 784 799
+7
drivers/usb/storage/unusual_devs.h
··· 1823 1823 US_SC_DEVICE, US_PR_DEVICE, NULL, 1824 1824 US_FL_IGNORE_RESIDUE ), 1825 1825 1826 + /* Reported by Sergey Pinaev <dfo@antex.ru> */ 1827 + UNUSUAL_DEV( 0x4102, 0x1059, 0x0000, 0x0000, 1828 + "iRiver", 1829 + "P7K", 1830 + US_SC_DEVICE, US_PR_DEVICE, NULL, 1831 + US_FL_MAX_SECTORS_64 ), 1832 + 1826 1833 /* 1827 1834 * David Härdeman <david@2gen.com> 1828 1835 * The key makes the SCSI stack print confusing (but harmless) messages
+1
include/linux/usb/serial.h
··· 150 150 struct usb_interface *interface; 151 151 unsigned char disconnected:1; 152 152 unsigned char suspending:1; 153 + unsigned char attached:1; 153 154 unsigned char minor; 154 155 unsigned char num_ports; 155 156 unsigned char num_port_pointers;