aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/dwc3/dwc3-omap.c3
-rw-r--r--drivers/usb/dwc3/gadget.c76
-rw-r--r--drivers/usb/dwc3/gadget.h14
-rw-r--r--drivers/usb/gadget/configfs.c1
-rw-r--r--drivers/usb/gadget/function/f_fs.c17
-rw-r--r--drivers/usb/gadget/function/f_uvc.c7
-rw-r--r--drivers/usb/gadget/legacy/inode.c7
-rw-r--r--drivers/usb/gadget/udc/atmel_usba_udc.c4
-rw-r--r--drivers/usb/gadget/udc/dummy_hcd.c2
-rw-r--r--drivers/usb/gadget/udc/net2280.c25
-rw-r--r--drivers/usb/gadget/udc/pxa27x_udc.c5
-rw-r--r--drivers/usb/host/ohci-at91.c4
-rw-r--r--drivers/usb/host/xhci-dbg.c2
-rw-r--r--drivers/usb/host/xhci-mtk.c7
-rw-r--r--drivers/usb/host/xhci-plat.c2
-rw-r--r--drivers/usb/host/xhci-tegra.c1
-rw-r--r--drivers/usb/host/xhci.c4
-rw-r--r--drivers/usb/misc/iowarrior.c21
-rw-r--r--drivers/usb/misc/usb251xb.c59
-rw-r--r--drivers/usb/phy/phy-isp1301.c7
-rw-r--r--drivers/usb/serial/digi_acceleport.c2
-rw-r--r--drivers/usb/serial/io_ti.c8
-rw-r--r--drivers/usb/serial/omninet.c13
-rw-r--r--drivers/usb/serial/safe_serial.c5
-rw-r--r--drivers/usb/storage/unusual_devs.h14
25 files changed, 198 insertions, 112 deletions
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 2092e46b1380..f8d0747810e7 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -250,6 +250,7 @@ static void dwc3_omap_set_mailbox(struct dwc3_omap *omap,
250 val = dwc3_omap_read_utmi_ctrl(omap); 250 val = dwc3_omap_read_utmi_ctrl(omap);
251 val |= USBOTGSS_UTMI_OTG_CTRL_IDDIG; 251 val |= USBOTGSS_UTMI_OTG_CTRL_IDDIG;
252 dwc3_omap_write_utmi_ctrl(omap, val); 252 dwc3_omap_write_utmi_ctrl(omap, val);
253 break;
253 254
254 case OMAP_DWC3_VBUS_OFF: 255 case OMAP_DWC3_VBUS_OFF:
255 val = dwc3_omap_read_utmi_ctrl(omap); 256 val = dwc3_omap_read_utmi_ctrl(omap);
@@ -392,7 +393,7 @@ static void dwc3_omap_set_utmi_mode(struct dwc3_omap *omap)
392{ 393{
393 u32 reg; 394 u32 reg;
394 struct device_node *node = omap->dev->of_node; 395 struct device_node *node = omap->dev->of_node;
395 int utmi_mode = 0; 396 u32 utmi_mode = 0;
396 397
397 reg = dwc3_omap_read_utmi_ctrl(omap); 398 reg = dwc3_omap_read_utmi_ctrl(omap);
398 399
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 4db97ecae885..0d75158e43fe 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1342,6 +1342,68 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
1342 if (r == req) { 1342 if (r == req) {
1343 /* wait until it is processed */ 1343 /* wait until it is processed */
1344 dwc3_stop_active_transfer(dwc, dep->number, true); 1344 dwc3_stop_active_transfer(dwc, dep->number, true);
1345
1346 /*
1347 * If request was already started, this means we had to
1348 * stop the transfer. With that we also need to ignore
1349 * all TRBs used by the request, however TRBs can only
1350 * be modified after completion of END_TRANSFER
1351 * command. So what we do here is that we wait for
1352 * END_TRANSFER completion and only after that, we jump
1353 * over TRBs by clearing HWO and incrementing dequeue
1354 * pointer.
1355 *
1356 * Note that we have 2 possible types of transfers here:
1357 *
1358 * i) Linear buffer request
1359 * ii) SG-list based request
1360 *
1361 * SG-list based requests will have r->num_pending_sgs
1362 * set to a valid number (> 0). Linear requests,
1363 * normally use a single TRB.
1364 *
1365 * For each of these two cases, if r->unaligned flag is
1366 * set, one extra TRB has been used to align transfer
1367 * size to wMaxPacketSize.
1368 *
1369 * All of these cases need to be taken into
1370 * consideration so we don't mess up our TRB ring
1371 * pointers.
1372 */
1373 wait_event_lock_irq(dep->wait_end_transfer,
1374 !(dep->flags & DWC3_EP_END_TRANSFER_PENDING),
1375 dwc->lock);
1376
1377 if (!r->trb)
1378 goto out1;
1379
1380 if (r->num_pending_sgs) {
1381 struct dwc3_trb *trb;
1382 int i = 0;
1383
1384 for (i = 0; i < r->num_pending_sgs; i++) {
1385 trb = r->trb + i;
1386 trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
1387 dwc3_ep_inc_deq(dep);
1388 }
1389
1390 if (r->unaligned) {
1391 trb = r->trb + r->num_pending_sgs + 1;
1392 trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
1393 dwc3_ep_inc_deq(dep);
1394 }
1395 } else {
1396 struct dwc3_trb *trb = r->trb;
1397
1398 trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
1399 dwc3_ep_inc_deq(dep);
1400
1401 if (r->unaligned) {
1402 trb = r->trb + 1;
1403 trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
1404 dwc3_ep_inc_deq(dep);
1405 }
1406 }
1345 goto out1; 1407 goto out1;
1346 } 1408 }
1347 dev_err(dwc->dev, "request %p was not queued to %s\n", 1409 dev_err(dwc->dev, "request %p was not queued to %s\n",
@@ -1352,6 +1414,7 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
1352 1414
1353out1: 1415out1:
1354 /* giveback the request */ 1416 /* giveback the request */
1417 dep->queued_requests--;
1355 dwc3_gadget_giveback(dep, req, -ECONNRESET); 1418 dwc3_gadget_giveback(dep, req, -ECONNRESET);
1356 1419
1357out0: 1420out0:
@@ -2126,12 +2189,12 @@ static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep,
2126 return 1; 2189 return 1;
2127 } 2190 }
2128 2191
2129 if ((trb->ctrl & DWC3_TRB_CTRL_HWO) && status != -ESHUTDOWN)
2130 return 1;
2131
2132 count = trb->size & DWC3_TRB_SIZE_MASK; 2192 count = trb->size & DWC3_TRB_SIZE_MASK;
2133 req->remaining += count; 2193 req->remaining += count;
2134 2194
2195 if ((trb->ctrl & DWC3_TRB_CTRL_HWO) && status != -ESHUTDOWN)
2196 return 1;
2197
2135 if (dep->direction) { 2198 if (dep->direction) {
2136 if (count) { 2199 if (count) {
2137 trb_status = DWC3_TRB_SIZE_TRBSTS(trb->size); 2200 trb_status = DWC3_TRB_SIZE_TRBSTS(trb->size);
@@ -3228,15 +3291,10 @@ void dwc3_gadget_exit(struct dwc3 *dwc)
3228 3291
3229int dwc3_gadget_suspend(struct dwc3 *dwc) 3292int dwc3_gadget_suspend(struct dwc3 *dwc)
3230{ 3293{
3231 int ret;
3232
3233 if (!dwc->gadget_driver) 3294 if (!dwc->gadget_driver)
3234 return 0; 3295 return 0;
3235 3296
3236 ret = dwc3_gadget_run_stop(dwc, false, false); 3297 dwc3_gadget_run_stop(dwc, false, false);
3237 if (ret < 0)
3238 return ret;
3239
3240 dwc3_disconnect_gadget(dwc); 3298 dwc3_disconnect_gadget(dwc);
3241 __dwc3_gadget_stop(dwc); 3299 __dwc3_gadget_stop(dwc);
3242 3300
diff --git a/drivers/usb/dwc3/gadget.h b/drivers/usb/dwc3/gadget.h
index 3129bcf74d7d..265e223ab645 100644
--- a/drivers/usb/dwc3/gadget.h
+++ b/drivers/usb/dwc3/gadget.h
@@ -28,23 +28,23 @@ struct dwc3;
28#define gadget_to_dwc(g) (container_of(g, struct dwc3, gadget)) 28#define gadget_to_dwc(g) (container_of(g, struct dwc3, gadget))
29 29
30/* DEPCFG parameter 1 */ 30/* DEPCFG parameter 1 */
31#define DWC3_DEPCFG_INT_NUM(n) ((n) << 0) 31#define DWC3_DEPCFG_INT_NUM(n) (((n) & 0x1f) << 0)
32#define DWC3_DEPCFG_XFER_COMPLETE_EN (1 << 8) 32#define DWC3_DEPCFG_XFER_COMPLETE_EN (1 << 8)
33#define DWC3_DEPCFG_XFER_IN_PROGRESS_EN (1 << 9) 33#define DWC3_DEPCFG_XFER_IN_PROGRESS_EN (1 << 9)
34#define DWC3_DEPCFG_XFER_NOT_READY_EN (1 << 10) 34#define DWC3_DEPCFG_XFER_NOT_READY_EN (1 << 10)
35#define DWC3_DEPCFG_FIFO_ERROR_EN (1 << 11) 35#define DWC3_DEPCFG_FIFO_ERROR_EN (1 << 11)
36#define DWC3_DEPCFG_STREAM_EVENT_EN (1 << 13) 36#define DWC3_DEPCFG_STREAM_EVENT_EN (1 << 13)
37#define DWC3_DEPCFG_BINTERVAL_M1(n) ((n) << 16) 37#define DWC3_DEPCFG_BINTERVAL_M1(n) (((n) & 0xff) << 16)
38#define DWC3_DEPCFG_STREAM_CAPABLE (1 << 24) 38#define DWC3_DEPCFG_STREAM_CAPABLE (1 << 24)
39#define DWC3_DEPCFG_EP_NUMBER(n) ((n) << 25) 39#define DWC3_DEPCFG_EP_NUMBER(n) (((n) & 0x1f) << 25)
40#define DWC3_DEPCFG_BULK_BASED (1 << 30) 40#define DWC3_DEPCFG_BULK_BASED (1 << 30)
41#define DWC3_DEPCFG_FIFO_BASED (1 << 31) 41#define DWC3_DEPCFG_FIFO_BASED (1 << 31)
42 42
43/* DEPCFG parameter 0 */ 43/* DEPCFG parameter 0 */
44#define DWC3_DEPCFG_EP_TYPE(n) ((n) << 1) 44#define DWC3_DEPCFG_EP_TYPE(n) (((n) & 0x3) << 1)
45#define DWC3_DEPCFG_MAX_PACKET_SIZE(n) ((n) << 3) 45#define DWC3_DEPCFG_MAX_PACKET_SIZE(n) (((n) & 0x7ff) << 3)
46#define DWC3_DEPCFG_FIFO_NUMBER(n) ((n) << 17) 46#define DWC3_DEPCFG_FIFO_NUMBER(n) (((n) & 0x1f) << 17)
47#define DWC3_DEPCFG_BURST_SIZE(n) ((n) << 22) 47#define DWC3_DEPCFG_BURST_SIZE(n) (((n) & 0xf) << 22)
48#define DWC3_DEPCFG_DATA_SEQ_NUM(n) ((n) << 26) 48#define DWC3_DEPCFG_DATA_SEQ_NUM(n) ((n) << 26)
49/* This applies for core versions earlier than 1.94a */ 49/* This applies for core versions earlier than 1.94a */
50#define DWC3_DEPCFG_IGN_SEQ_NUM (1 << 31) 50#define DWC3_DEPCFG_IGN_SEQ_NUM (1 << 31)
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index 78c44979dde3..cbff3b02840d 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -269,6 +269,7 @@ static ssize_t gadget_dev_desc_UDC_store(struct config_item *item,
269 ret = unregister_gadget(gi); 269 ret = unregister_gadget(gi);
270 if (ret) 270 if (ret)
271 goto err; 271 goto err;
272 kfree(name);
272 } else { 273 } else {
273 if (gi->composite.gadget_driver.udc_name) { 274 if (gi->composite.gadget_driver.udc_name) {
274 ret = -EBUSY; 275 ret = -EBUSY;
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index a5b7cd615698..a0085571824d 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -1834,11 +1834,14 @@ static int ffs_func_eps_enable(struct ffs_function *func)
1834 spin_lock_irqsave(&func->ffs->eps_lock, flags); 1834 spin_lock_irqsave(&func->ffs->eps_lock, flags);
1835 while(count--) { 1835 while(count--) {
1836 struct usb_endpoint_descriptor *ds; 1836 struct usb_endpoint_descriptor *ds;
1837 struct usb_ss_ep_comp_descriptor *comp_desc = NULL;
1838 int needs_comp_desc = false;
1837 int desc_idx; 1839 int desc_idx;
1838 1840
1839 if (ffs->gadget->speed == USB_SPEED_SUPER) 1841 if (ffs->gadget->speed == USB_SPEED_SUPER) {
1840 desc_idx = 2; 1842 desc_idx = 2;
1841 else if (ffs->gadget->speed == USB_SPEED_HIGH) 1843 needs_comp_desc = true;
1844 } else if (ffs->gadget->speed == USB_SPEED_HIGH)
1842 desc_idx = 1; 1845 desc_idx = 1;
1843 else 1846 else
1844 desc_idx = 0; 1847 desc_idx = 0;
@@ -1855,6 +1858,14 @@ static int ffs_func_eps_enable(struct ffs_function *func)
1855 1858
1856 ep->ep->driver_data = ep; 1859 ep->ep->driver_data = ep;
1857 ep->ep->desc = ds; 1860 ep->ep->desc = ds;
1861
1862 comp_desc = (struct usb_ss_ep_comp_descriptor *)(ds +
1863 USB_DT_ENDPOINT_SIZE);
1864 ep->ep->maxburst = comp_desc->bMaxBurst + 1;
1865
1866 if (needs_comp_desc)
1867 ep->ep->comp_desc = comp_desc;
1868
1858 ret = usb_ep_enable(ep->ep); 1869 ret = usb_ep_enable(ep->ep);
1859 if (likely(!ret)) { 1870 if (likely(!ret)) {
1860 epfile->ep = ep; 1871 epfile->ep = ep;
@@ -2253,7 +2264,7 @@ static int __ffs_data_do_os_desc(enum ffs_os_desc_type type,
2253 2264
2254 if (len < sizeof(*d) || 2265 if (len < sizeof(*d) ||
2255 d->bFirstInterfaceNumber >= ffs->interfaces_count || 2266 d->bFirstInterfaceNumber >= ffs->interfaces_count ||
2256 d->Reserved1) 2267 !d->Reserved1)
2257 return -EINVAL; 2268 return -EINVAL;
2258 for (i = 0; i < ARRAY_SIZE(d->Reserved2); ++i) 2269 for (i = 0; i < ARRAY_SIZE(d->Reserved2); ++i)
2259 if (d->Reserved2[i]) 2270 if (d->Reserved2[i])
diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
index 27ed51b5082f..29b41b5dee04 100644
--- a/drivers/usb/gadget/function/f_uvc.c
+++ b/drivers/usb/gadget/function/f_uvc.c
@@ -258,13 +258,6 @@ uvc_function_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
258 memcpy(&uvc_event->req, ctrl, sizeof(uvc_event->req)); 258 memcpy(&uvc_event->req, ctrl, sizeof(uvc_event->req));
259 v4l2_event_queue(&uvc->vdev, &v4l2_event); 259 v4l2_event_queue(&uvc->vdev, &v4l2_event);
260 260
261 /* Pass additional setup data to userspace */
262 if (uvc->event_setup_out && uvc->event_length) {
263 uvc->control_req->length = uvc->event_length;
264 return usb_ep_queue(uvc->func.config->cdev->gadget->ep0,
265 uvc->control_req, GFP_ATOMIC);
266 }
267
268 return 0; 261 return 0;
269} 262}
270 263
diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index a2615d64d07c..a2c916869293 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -84,8 +84,7 @@ static int ep_open(struct inode *, struct file *);
84 84
85/* /dev/gadget/$CHIP represents ep0 and the whole device */ 85/* /dev/gadget/$CHIP represents ep0 and the whole device */
86enum ep0_state { 86enum ep0_state {
87 /* DISBLED is the initial state. 87 /* DISABLED is the initial state. */
88 */
89 STATE_DEV_DISABLED = 0, 88 STATE_DEV_DISABLED = 0,
90 89
91 /* Only one open() of /dev/gadget/$CHIP; only one file tracks 90 /* Only one open() of /dev/gadget/$CHIP; only one file tracks
@@ -1782,8 +1781,10 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
1782 1781
1783 spin_lock_irq (&dev->lock); 1782 spin_lock_irq (&dev->lock);
1784 value = -EINVAL; 1783 value = -EINVAL;
1785 if (dev->buf) 1784 if (dev->buf) {
1785 kfree(kbuf);
1786 goto fail; 1786 goto fail;
1787 }
1787 dev->buf = kbuf; 1788 dev->buf = kbuf;
1788 1789
1789 /* full or low speed config */ 1790 /* full or low speed config */
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 11bbce28bc23..2035906b8ced 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -610,7 +610,7 @@ usba_ep_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
610{ 610{
611 struct usba_ep *ep = to_usba_ep(_ep); 611 struct usba_ep *ep = to_usba_ep(_ep);
612 struct usba_udc *udc = ep->udc; 612 struct usba_udc *udc = ep->udc;
613 unsigned long flags, ept_cfg, maxpacket; 613 unsigned long flags, maxpacket;
614 unsigned int nr_trans; 614 unsigned int nr_trans;
615 615
616 DBG(DBG_GADGET, "%s: ep_enable: desc=%p\n", ep->ep.name, desc); 616 DBG(DBG_GADGET, "%s: ep_enable: desc=%p\n", ep->ep.name, desc);
@@ -630,7 +630,7 @@ usba_ep_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
630 ep->is_in = 0; 630 ep->is_in = 0;
631 631
632 DBG(DBG_ERR, "%s: EPT_CFG = 0x%lx (maxpacket = %lu)\n", 632 DBG(DBG_ERR, "%s: EPT_CFG = 0x%lx (maxpacket = %lu)\n",
633 ep->ep.name, ept_cfg, maxpacket); 633 ep->ep.name, ep->ept_cfg, maxpacket);
634 634
635 if (usb_endpoint_dir_in(desc)) { 635 if (usb_endpoint_dir_in(desc)) {
636 ep->is_in = 1; 636 ep->is_in = 1;
diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
index c60abe3a68f9..8cabc5944d5f 100644
--- a/drivers/usb/gadget/udc/dummy_hcd.c
+++ b/drivers/usb/gadget/udc/dummy_hcd.c
@@ -1031,6 +1031,8 @@ static int dummy_udc_probe(struct platform_device *pdev)
1031 int rc; 1031 int rc;
1032 1032
1033 dum = *((void **)dev_get_platdata(&pdev->dev)); 1033 dum = *((void **)dev_get_platdata(&pdev->dev));
1034 /* Clear usb_gadget region for new registration to udc-core */
1035 memzero_explicit(&dum->gadget, sizeof(struct usb_gadget));
1034 dum->gadget.name = gadget_name; 1036 dum->gadget.name = gadget_name;
1035 dum->gadget.ops = &dummy_ops; 1037 dum->gadget.ops = &dummy_ops;
1036 dum->gadget.max_speed = USB_SPEED_SUPER; 1038 dum->gadget.max_speed = USB_SPEED_SUPER;
diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c
index 85504419ab31..3828c2ec8623 100644
--- a/drivers/usb/gadget/udc/net2280.c
+++ b/drivers/usb/gadget/udc/net2280.c
@@ -1146,15 +1146,15 @@ static int scan_dma_completions(struct net2280_ep *ep)
1146 */ 1146 */
1147 while (!list_empty(&ep->queue)) { 1147 while (!list_empty(&ep->queue)) {
1148 struct net2280_request *req; 1148 struct net2280_request *req;
1149 u32 tmp; 1149 u32 req_dma_count;
1150 1150
1151 req = list_entry(ep->queue.next, 1151 req = list_entry(ep->queue.next,
1152 struct net2280_request, queue); 1152 struct net2280_request, queue);
1153 if (!req->valid) 1153 if (!req->valid)
1154 break; 1154 break;
1155 rmb(); 1155 rmb();
1156 tmp = le32_to_cpup(&req->td->dmacount); 1156 req_dma_count = le32_to_cpup(&req->td->dmacount);
1157 if ((tmp & BIT(VALID_BIT)) != 0) 1157 if ((req_dma_count & BIT(VALID_BIT)) != 0)
1158 break; 1158 break;
1159 1159
1160 /* SHORT_PACKET_TRANSFERRED_INTERRUPT handles "usb-short" 1160 /* SHORT_PACKET_TRANSFERRED_INTERRUPT handles "usb-short"
@@ -1163,40 +1163,41 @@ static int scan_dma_completions(struct net2280_ep *ep)
1163 */ 1163 */
1164 if (unlikely(req->td->dmadesc == 0)) { 1164 if (unlikely(req->td->dmadesc == 0)) {
1165 /* paranoia */ 1165 /* paranoia */
1166 tmp = readl(&ep->dma->dmacount); 1166 u32 const ep_dmacount = readl(&ep->dma->dmacount);
1167 if (tmp & DMA_BYTE_COUNT_MASK) 1167
1168 if (ep_dmacount & DMA_BYTE_COUNT_MASK)
1168 break; 1169 break;
1169 /* single transfer mode */ 1170 /* single transfer mode */
1170 dma_done(ep, req, tmp, 0); 1171 dma_done(ep, req, req_dma_count, 0);
1171 num_completed++; 1172 num_completed++;
1172 break; 1173 break;
1173 } else if (!ep->is_in && 1174 } else if (!ep->is_in &&
1174 (req->req.length % ep->ep.maxpacket) && 1175 (req->req.length % ep->ep.maxpacket) &&
1175 !(ep->dev->quirks & PLX_PCIE)) { 1176 !(ep->dev->quirks & PLX_PCIE)) {
1176 1177
1177 tmp = readl(&ep->regs->ep_stat); 1178 u32 const ep_stat = readl(&ep->regs->ep_stat);
1178 /* AVOID TROUBLE HERE by not issuing short reads from 1179 /* AVOID TROUBLE HERE by not issuing short reads from
1179 * your gadget driver. That helps avoids errata 0121, 1180 * your gadget driver. That helps avoids errata 0121,
1180 * 0122, and 0124; not all cases trigger the warning. 1181 * 0122, and 0124; not all cases trigger the warning.
1181 */ 1182 */
1182 if ((tmp & BIT(NAK_OUT_PACKETS)) == 0) { 1183 if ((ep_stat & BIT(NAK_OUT_PACKETS)) == 0) {
1183 ep_warn(ep->dev, "%s lost packet sync!\n", 1184 ep_warn(ep->dev, "%s lost packet sync!\n",
1184 ep->ep.name); 1185 ep->ep.name);
1185 req->req.status = -EOVERFLOW; 1186 req->req.status = -EOVERFLOW;
1186 } else { 1187 } else {
1187 tmp = readl(&ep->regs->ep_avail); 1188 u32 const ep_avail = readl(&ep->regs->ep_avail);
1188 if (tmp) { 1189 if (ep_avail) {
1189 /* fifo gets flushed later */ 1190 /* fifo gets flushed later */
1190 ep->out_overflow = 1; 1191 ep->out_overflow = 1;
1191 ep_dbg(ep->dev, 1192 ep_dbg(ep->dev,
1192 "%s dma, discard %d len %d\n", 1193 "%s dma, discard %d len %d\n",
1193 ep->ep.name, tmp, 1194 ep->ep.name, ep_avail,
1194 req->req.length); 1195 req->req.length);
1195 req->req.status = -EOVERFLOW; 1196 req->req.status = -EOVERFLOW;
1196 } 1197 }
1197 } 1198 }
1198 } 1199 }
1199 dma_done(ep, req, tmp, 0); 1200 dma_done(ep, req, req_dma_count, 0);
1200 num_completed++; 1201 num_completed++;
1201 } 1202 }
1202 1203
diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c
index e1335ad5bce9..832c4fdbe985 100644
--- a/drivers/usb/gadget/udc/pxa27x_udc.c
+++ b/drivers/usb/gadget/udc/pxa27x_udc.c
@@ -2534,9 +2534,10 @@ static int pxa_udc_remove(struct platform_device *_dev)
2534 usb_del_gadget_udc(&udc->gadget); 2534 usb_del_gadget_udc(&udc->gadget);
2535 pxa_cleanup_debugfs(udc); 2535 pxa_cleanup_debugfs(udc);
2536 2536
2537 if (!IS_ERR_OR_NULL(udc->transceiver)) 2537 if (!IS_ERR_OR_NULL(udc->transceiver)) {
2538 usb_unregister_notifier(udc->transceiver, &pxa27x_udc_phy); 2538 usb_unregister_notifier(udc->transceiver, &pxa27x_udc_phy);
2539 usb_put_phy(udc->transceiver); 2539 usb_put_phy(udc->transceiver);
2540 }
2540 2541
2541 udc->transceiver = NULL; 2542 udc->transceiver = NULL;
2542 the_controller = NULL; 2543 the_controller = NULL;
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 414e3c376dbb..5302f988e7e6 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -350,7 +350,7 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
350 350
351 case USB_PORT_FEAT_SUSPEND: 351 case USB_PORT_FEAT_SUSPEND:
352 dev_dbg(hcd->self.controller, "SetPortFeat: SUSPEND\n"); 352 dev_dbg(hcd->self.controller, "SetPortFeat: SUSPEND\n");
353 if (valid_port(wIndex)) { 353 if (valid_port(wIndex) && ohci_at91->sfr_regmap) {
354 ohci_at91_port_suspend(ohci_at91->sfr_regmap, 354 ohci_at91_port_suspend(ohci_at91->sfr_regmap,
355 1); 355 1);
356 return 0; 356 return 0;
@@ -393,7 +393,7 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
393 393
394 case USB_PORT_FEAT_SUSPEND: 394 case USB_PORT_FEAT_SUSPEND:
395 dev_dbg(hcd->self.controller, "ClearPortFeature: SUSPEND\n"); 395 dev_dbg(hcd->self.controller, "ClearPortFeature: SUSPEND\n");
396 if (valid_port(wIndex)) { 396 if (valid_port(wIndex) && ohci_at91->sfr_regmap) {
397 ohci_at91_port_suspend(ohci_at91->sfr_regmap, 397 ohci_at91_port_suspend(ohci_at91->sfr_regmap,
398 0); 398 0);
399 return 0; 399 return 0;
diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c
index 363d125300ea..2b4a00fa735d 100644
--- a/drivers/usb/host/xhci-dbg.c
+++ b/drivers/usb/host/xhci-dbg.c
@@ -109,7 +109,7 @@ static void xhci_print_cap_regs(struct xhci_hcd *xhci)
109 xhci_dbg(xhci, "RTSOFF 0x%x:\n", temp & RTSOFF_MASK); 109 xhci_dbg(xhci, "RTSOFF 0x%x:\n", temp & RTSOFF_MASK);
110 110
111 /* xhci 1.1 controllers have the HCCPARAMS2 register */ 111 /* xhci 1.1 controllers have the HCCPARAMS2 register */
112 if (hci_version > 100) { 112 if (hci_version > 0x100) {
113 temp = readl(&xhci->cap_regs->hcc_params2); 113 temp = readl(&xhci->cap_regs->hcc_params2);
114 xhci_dbg(xhci, "HCC PARAMS2 0x%x:\n", (unsigned int) temp); 114 xhci_dbg(xhci, "HCC PARAMS2 0x%x:\n", (unsigned int) temp);
115 xhci_dbg(xhci, " HC %s Force save context capability", 115 xhci_dbg(xhci, " HC %s Force save context capability",
diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index 9066ec9e0c2e..67d5dc79b6b5 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -382,7 +382,6 @@ static int usb_wakeup_of_property_parse(struct xhci_hcd_mtk *mtk,
382 382
383static int xhci_mtk_setup(struct usb_hcd *hcd); 383static int xhci_mtk_setup(struct usb_hcd *hcd);
384static const struct xhci_driver_overrides xhci_mtk_overrides __initconst = { 384static const struct xhci_driver_overrides xhci_mtk_overrides __initconst = {
385 .extra_priv_size = sizeof(struct xhci_hcd),
386 .reset = xhci_mtk_setup, 385 .reset = xhci_mtk_setup,
387}; 386};
388 387
@@ -678,13 +677,13 @@ static int xhci_mtk_probe(struct platform_device *pdev)
678 goto power_off_phys; 677 goto power_off_phys;
679 } 678 }
680 679
681 if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
682 xhci->shared_hcd->can_do_streams = 1;
683
684 ret = usb_add_hcd(hcd, irq, IRQF_SHARED); 680 ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
685 if (ret) 681 if (ret)
686 goto put_usb3_hcd; 682 goto put_usb3_hcd;
687 683
684 if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
685 xhci->shared_hcd->can_do_streams = 1;
686
688 ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED); 687 ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
689 if (ret) 688 if (ret)
690 goto dealloc_usb2_hcd; 689 goto dealloc_usb2_hcd;
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 6d33b42ffcf5..bd02a6cd8e2c 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -286,6 +286,8 @@ static int xhci_plat_remove(struct platform_device *dev)
286 struct xhci_hcd *xhci = hcd_to_xhci(hcd); 286 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
287 struct clk *clk = xhci->clk; 287 struct clk *clk = xhci->clk;
288 288
289 xhci->xhc_state |= XHCI_STATE_REMOVING;
290
289 usb_remove_hcd(xhci->shared_hcd); 291 usb_remove_hcd(xhci->shared_hcd);
290 usb_phy_shutdown(hcd->usb_phy); 292 usb_phy_shutdown(hcd->usb_phy);
291 293
diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c
index a59fafb4b329..74436f8ca538 100644
--- a/drivers/usb/host/xhci-tegra.c
+++ b/drivers/usb/host/xhci-tegra.c
@@ -1308,7 +1308,6 @@ static int tegra_xhci_setup(struct usb_hcd *hcd)
1308} 1308}
1309 1309
1310static const struct xhci_driver_overrides tegra_xhci_overrides __initconst = { 1310static const struct xhci_driver_overrides tegra_xhci_overrides __initconst = {
1311 .extra_priv_size = sizeof(struct xhci_hcd),
1312 .reset = tegra_xhci_setup, 1311 .reset = tegra_xhci_setup,
1313}; 1312};
1314 1313
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 6d6c46000e56..50aee8b7718b 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -868,7 +868,7 @@ static void xhci_disable_port_wake_on_bits(struct xhci_hcd *xhci)
868 868
869 spin_lock_irqsave(&xhci->lock, flags); 869 spin_lock_irqsave(&xhci->lock, flags);
870 870
871 /* disble usb3 ports Wake bits*/ 871 /* disable usb3 ports Wake bits */
872 port_index = xhci->num_usb3_ports; 872 port_index = xhci->num_usb3_ports;
873 port_array = xhci->usb3_ports; 873 port_array = xhci->usb3_ports;
874 while (port_index--) { 874 while (port_index--) {
@@ -879,7 +879,7 @@ static void xhci_disable_port_wake_on_bits(struct xhci_hcd *xhci)
879 writel(t2, port_array[port_index]); 879 writel(t2, port_array[port_index]);
880 } 880 }
881 881
882 /* disble usb2 ports Wake bits*/ 882 /* disable usb2 ports Wake bits */
883 port_index = xhci->num_usb2_ports; 883 port_index = xhci->num_usb2_ports;
884 port_array = xhci->usb2_ports; 884 port_array = xhci->usb2_ports;
885 while (port_index--) { 885 while (port_index--) {
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
index 095778ff984d..37c63cb39714 100644
--- a/drivers/usb/misc/iowarrior.c
+++ b/drivers/usb/misc/iowarrior.c
@@ -781,12 +781,6 @@ static int iowarrior_probe(struct usb_interface *interface,
781 iface_desc = interface->cur_altsetting; 781 iface_desc = interface->cur_altsetting;
782 dev->product_id = le16_to_cpu(udev->descriptor.idProduct); 782 dev->product_id = le16_to_cpu(udev->descriptor.idProduct);
783 783
784 if (iface_desc->desc.bNumEndpoints < 1) {
785 dev_err(&interface->dev, "Invalid number of endpoints\n");
786 retval = -EINVAL;
787 goto error;
788 }
789
790 /* set up the endpoint information */ 784 /* set up the endpoint information */
791 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { 785 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
792 endpoint = &iface_desc->endpoint[i].desc; 786 endpoint = &iface_desc->endpoint[i].desc;
@@ -797,6 +791,21 @@ static int iowarrior_probe(struct usb_interface *interface,
797 /* this one will match for the IOWarrior56 only */ 791 /* this one will match for the IOWarrior56 only */
798 dev->int_out_endpoint = endpoint; 792 dev->int_out_endpoint = endpoint;
799 } 793 }
794
795 if (!dev->int_in_endpoint) {
796 dev_err(&interface->dev, "no interrupt-in endpoint found\n");
797 retval = -ENODEV;
798 goto error;
799 }
800
801 if (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW56) {
802 if (!dev->int_out_endpoint) {
803 dev_err(&interface->dev, "no interrupt-out endpoint found\n");
804 retval = -ENODEV;
805 goto error;
806 }
807 }
808
800 /* we have to check the report_size often, so remember it in the endianness suitable for our machine */ 809 /* we have to check the report_size often, so remember it in the endianness suitable for our machine */
801 dev->report_size = usb_endpoint_maxp(dev->int_in_endpoint); 810 dev->report_size = usb_endpoint_maxp(dev->int_in_endpoint);
802 if ((dev->interface->cur_altsetting->desc.bInterfaceNumber == 0) && 811 if ((dev->interface->cur_altsetting->desc.bInterfaceNumber == 0) &&
diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c
index 4e18600dc9b4..91f66d68bcb7 100644
--- a/drivers/usb/misc/usb251xb.c
+++ b/drivers/usb/misc/usb251xb.c
@@ -375,18 +375,24 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
375 if (of_get_property(np, "dynamic-power-switching", NULL)) 375 if (of_get_property(np, "dynamic-power-switching", NULL))
376 hub->conf_data2 |= BIT(7); 376 hub->conf_data2 |= BIT(7);
377 377
378 if (of_get_property(np, "oc-delay-100us", NULL)) { 378 if (!of_property_read_u32(np, "oc-delay-us", property_u32)) {
379 hub->conf_data2 &= ~BIT(5); 379 if (*property_u32 == 100) {
380 hub->conf_data2 &= ~BIT(4); 380 /* 100 us*/
381 } else if (of_get_property(np, "oc-delay-4ms", NULL)) { 381 hub->conf_data2 &= ~BIT(5);
382 hub->conf_data2 &= ~BIT(5); 382 hub->conf_data2 &= ~BIT(4);
383 hub->conf_data2 |= BIT(4); 383 } else if (*property_u32 == 4000) {
384 } else if (of_get_property(np, "oc-delay-8ms", NULL)) { 384 /* 4 ms */
385 hub->conf_data2 |= BIT(5); 385 hub->conf_data2 &= ~BIT(5);
386 hub->conf_data2 &= ~BIT(4); 386 hub->conf_data2 |= BIT(4);
387 } else if (of_get_property(np, "oc-delay-16ms", NULL)) { 387 } else if (*property_u32 == 16000) {
388 hub->conf_data2 |= BIT(5); 388 /* 16 ms */
389 hub->conf_data2 |= BIT(4); 389 hub->conf_data2 |= BIT(5);
390 hub->conf_data2 |= BIT(4);
391 } else {
392 /* 8 ms (DEFAULT) */
393 hub->conf_data2 |= BIT(5);
394 hub->conf_data2 &= ~BIT(4);
395 }
390 } 396 }
391 397
392 if (of_get_property(np, "compound-device", NULL)) 398 if (of_get_property(np, "compound-device", NULL))
@@ -432,30 +438,9 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
432 } 438 }
433 } 439 }
434 440
435 hub->max_power_sp = USB251XB_DEF_MAX_POWER_SELF;
436 if (!of_property_read_u32(np, "max-sp-power", property_u32))
437 hub->max_power_sp = min_t(u8, be32_to_cpu(*property_u32) / 2,
438 250);
439
440 hub->max_power_bp = USB251XB_DEF_MAX_POWER_BUS;
441 if (!of_property_read_u32(np, "max-bp-power", property_u32))
442 hub->max_power_bp = min_t(u8, be32_to_cpu(*property_u32) / 2,
443 250);
444
445 hub->max_current_sp = USB251XB_DEF_MAX_CURRENT_SELF;
446 if (!of_property_read_u32(np, "max-sp-current", property_u32))
447 hub->max_current_sp = min_t(u8, be32_to_cpu(*property_u32) / 2,
448 250);
449
450 hub->max_current_bp = USB251XB_DEF_MAX_CURRENT_BUS;
451 if (!of_property_read_u32(np, "max-bp-current", property_u32))
452 hub->max_current_bp = min_t(u8, be32_to_cpu(*property_u32) / 2,
453 250);
454
455 hub->power_on_time = USB251XB_DEF_POWER_ON_TIME; 441 hub->power_on_time = USB251XB_DEF_POWER_ON_TIME;
456 if (!of_property_read_u32(np, "power-on-time", property_u32)) 442 if (!of_property_read_u32(np, "power-on-time-ms", property_u32))
457 hub->power_on_time = min_t(u8, be32_to_cpu(*property_u32) / 2, 443 hub->power_on_time = min_t(u8, *property_u32 / 2, 255);
458 255);
459 444
460 if (of_property_read_u16_array(np, "language-id", &hub->lang_id, 1)) 445 if (of_property_read_u16_array(np, "language-id", &hub->lang_id, 1))
461 hub->lang_id = USB251XB_DEF_LANGUAGE_ID; 446 hub->lang_id = USB251XB_DEF_LANGUAGE_ID;
@@ -492,6 +477,10 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
492 /* The following parameters are currently not exposed to devicetree, but 477 /* The following parameters are currently not exposed to devicetree, but
493 * may be as soon as needed. 478 * may be as soon as needed.
494 */ 479 */
480 hub->max_power_sp = USB251XB_DEF_MAX_POWER_SELF;
481 hub->max_power_bp = USB251XB_DEF_MAX_POWER_BUS;
482 hub->max_current_sp = USB251XB_DEF_MAX_CURRENT_SELF;
483 hub->max_current_bp = USB251XB_DEF_MAX_CURRENT_BUS;
495 hub->bat_charge_en = USB251XB_DEF_BATTERY_CHARGING_ENABLE; 484 hub->bat_charge_en = USB251XB_DEF_BATTERY_CHARGING_ENABLE;
496 hub->boost_up = USB251XB_DEF_BOOST_UP; 485 hub->boost_up = USB251XB_DEF_BOOST_UP;
497 hub->boost_x = USB251XB_DEF_BOOST_X; 486 hub->boost_x = USB251XB_DEF_BOOST_X;
diff --git a/drivers/usb/phy/phy-isp1301.c b/drivers/usb/phy/phy-isp1301.c
index db68156568e6..b3b33cf7ddf6 100644
--- a/drivers/usb/phy/phy-isp1301.c
+++ b/drivers/usb/phy/phy-isp1301.c
@@ -33,6 +33,12 @@ static const struct i2c_device_id isp1301_id[] = {
33}; 33};
34MODULE_DEVICE_TABLE(i2c, isp1301_id); 34MODULE_DEVICE_TABLE(i2c, isp1301_id);
35 35
36static const struct of_device_id isp1301_of_match[] = {
37 {.compatible = "nxp,isp1301" },
38 { },
39};
40MODULE_DEVICE_TABLE(of, isp1301_of_match);
41
36static struct i2c_client *isp1301_i2c_client; 42static struct i2c_client *isp1301_i2c_client;
37 43
38static int __isp1301_write(struct isp1301 *isp, u8 reg, u8 value, u8 clear) 44static int __isp1301_write(struct isp1301 *isp, u8 reg, u8 value, u8 clear)
@@ -130,6 +136,7 @@ static int isp1301_remove(struct i2c_client *client)
130static struct i2c_driver isp1301_driver = { 136static struct i2c_driver isp1301_driver = {
131 .driver = { 137 .driver = {
132 .name = DRV_NAME, 138 .name = DRV_NAME,
139 .of_match_table = of_match_ptr(isp1301_of_match),
133 }, 140 },
134 .probe = isp1301_probe, 141 .probe = isp1301_probe,
135 .remove = isp1301_remove, 142 .remove = isp1301_remove,
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
index ab78111e0968..6537d3ca2797 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -1500,7 +1500,7 @@ static int digi_read_oob_callback(struct urb *urb)
1500 return -1; 1500 return -1;
1501 1501
1502 /* handle each oob command */ 1502 /* handle each oob command */
1503 for (i = 0; i < urb->actual_length - 4; i += 4) { 1503 for (i = 0; i < urb->actual_length - 3; i += 4) {
1504 opcode = buf[i]; 1504 opcode = buf[i];
1505 line = buf[i + 1]; 1505 line = buf[i + 1];
1506 status = buf[i + 2]; 1506 status = buf[i + 2];
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index ceaeebaa6f90..a76b95d32157 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -1674,6 +1674,12 @@ static void edge_interrupt_callback(struct urb *urb)
1674 function = TIUMP_GET_FUNC_FROM_CODE(data[0]); 1674 function = TIUMP_GET_FUNC_FROM_CODE(data[0]);
1675 dev_dbg(dev, "%s - port_number %d, function %d, info 0x%x\n", __func__, 1675 dev_dbg(dev, "%s - port_number %d, function %d, info 0x%x\n", __func__,
1676 port_number, function, data[1]); 1676 port_number, function, data[1]);
1677
1678 if (port_number >= edge_serial->serial->num_ports) {
1679 dev_err(dev, "bad port number %d\n", port_number);
1680 goto exit;
1681 }
1682
1677 port = edge_serial->serial->port[port_number]; 1683 port = edge_serial->serial->port[port_number];
1678 edge_port = usb_get_serial_port_data(port); 1684 edge_port = usb_get_serial_port_data(port);
1679 if (!edge_port) { 1685 if (!edge_port) {
@@ -1755,7 +1761,7 @@ static void edge_bulk_in_callback(struct urb *urb)
1755 1761
1756 port_number = edge_port->port->port_number; 1762 port_number = edge_port->port->port_number;
1757 1763
1758 if (edge_port->lsr_event) { 1764 if (urb->actual_length > 0 && edge_port->lsr_event) {
1759 edge_port->lsr_event = 0; 1765 edge_port->lsr_event = 0;
1760 dev_dbg(dev, "%s ===== Port %u LSR Status = %02x, Data = %02x ======\n", 1766 dev_dbg(dev, "%s ===== Port %u LSR Status = %02x, Data = %02x ======\n",
1761 __func__, port_number, edge_port->lsr_mask, *data); 1767 __func__, port_number, edge_port->lsr_mask, *data);
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
index a180b17d2432..dd706953b466 100644
--- a/drivers/usb/serial/omninet.c
+++ b/drivers/usb/serial/omninet.c
@@ -31,7 +31,6 @@
31#define BT_IGNITIONPRO_ID 0x2000 31#define BT_IGNITIONPRO_ID 0x2000
32 32
33/* function prototypes */ 33/* function prototypes */
34static int omninet_open(struct tty_struct *tty, struct usb_serial_port *port);
35static void omninet_process_read_urb(struct urb *urb); 34static void omninet_process_read_urb(struct urb *urb);
36static void omninet_write_bulk_callback(struct urb *urb); 35static void omninet_write_bulk_callback(struct urb *urb);
37static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port, 36static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port,
@@ -60,7 +59,6 @@ static struct usb_serial_driver zyxel_omninet_device = {
60 .attach = omninet_attach, 59 .attach = omninet_attach,
61 .port_probe = omninet_port_probe, 60 .port_probe = omninet_port_probe,
62 .port_remove = omninet_port_remove, 61 .port_remove = omninet_port_remove,
63 .open = omninet_open,
64 .write = omninet_write, 62 .write = omninet_write,
65 .write_room = omninet_write_room, 63 .write_room = omninet_write_room,
66 .write_bulk_callback = omninet_write_bulk_callback, 64 .write_bulk_callback = omninet_write_bulk_callback,
@@ -140,17 +138,6 @@ static int omninet_port_remove(struct usb_serial_port *port)
140 return 0; 138 return 0;
141} 139}
142 140
143static int omninet_open(struct tty_struct *tty, struct usb_serial_port *port)
144{
145 struct usb_serial *serial = port->serial;
146 struct usb_serial_port *wport;
147
148 wport = serial->port[1];
149 tty_port_tty_set(&wport->port, tty);
150
151 return usb_serial_generic_open(tty, port);
152}
153
154#define OMNINET_HEADERLEN 4 141#define OMNINET_HEADERLEN 4
155#define OMNINET_BULKOUTSIZE 64 142#define OMNINET_BULKOUTSIZE 64
156#define OMNINET_PAYLOADSIZE (OMNINET_BULKOUTSIZE - OMNINET_HEADERLEN) 143#define OMNINET_PAYLOADSIZE (OMNINET_BULKOUTSIZE - OMNINET_HEADERLEN)
diff --git a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c
index 93c6c9b08daa..8a069aa154ed 100644
--- a/drivers/usb/serial/safe_serial.c
+++ b/drivers/usb/serial/safe_serial.c
@@ -200,6 +200,11 @@ static void safe_process_read_urb(struct urb *urb)
200 if (!safe) 200 if (!safe)
201 goto out; 201 goto out;
202 202
203 if (length < 2) {
204 dev_err(&port->dev, "malformed packet\n");
205 return;
206 }
207
203 fcs = fcs_compute10(data, length, CRC10_INITFCS); 208 fcs = fcs_compute10(data, length, CRC10_INITFCS);
204 if (fcs) { 209 if (fcs) {
205 dev_err(&port->dev, "%s - bad CRC %x\n", __func__, fcs); 210 dev_err(&port->dev, "%s - bad CRC %x\n", __func__, fcs);
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 16cc18369111..9129f6cb8230 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -2071,6 +2071,20 @@ UNUSUAL_DEV( 0x1370, 0x6828, 0x0110, 0x0110,
2071 USB_SC_DEVICE, USB_PR_DEVICE, NULL, 2071 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
2072 US_FL_IGNORE_RESIDUE ), 2072 US_FL_IGNORE_RESIDUE ),
2073 2073
2074/*
2075 * Reported by Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
2076 * The INIC-3619 bridge is used in the StarTech SLSODDU33B
2077 * SATA-USB enclosure for slimline optical drives.
2078 *
2079 * The quirk enables MakeMKV to properly exchange keys with
2080 * an installed BD drive.
2081 */
2082UNUSUAL_DEV( 0x13fd, 0x3609, 0x0209, 0x0209,
2083 "Initio Corporation",
2084 "INIC-3619",
2085 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
2086 US_FL_IGNORE_RESIDUE ),
2087
2074/* Reported by Qinglin Ye <yestyle@gmail.com> */ 2088/* Reported by Qinglin Ye <yestyle@gmail.com> */
2075UNUSUAL_DEV( 0x13fe, 0x3600, 0x0100, 0x0100, 2089UNUSUAL_DEV( 0x13fe, 0x3600, 0x0100, 0x0100,
2076 "Kingston", 2090 "Kingston",