Skip to content

Commit 8d02a9a

Browse files
committed
Merge tag 'usb-5.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH: "Here are some small USB fixes for 5.1-rc3. Nothing major at all here, just a small collection of fixes for reported issues, and potential problems with error handling paths. Also a few new device ids, as normal. All of these have been in linux-next with no reported issues" * tag 'usb-5.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (25 commits) USB: serial: option: add Olicard 600 USB: serial: cp210x: add new device id usb: u132-hcd: fix resource leak usb: cdc-acm: fix race during wakeup blocking TX traffic usb: mtu3: fix EXTCON dependency usb: usb251xb: fix to avoid potential NULL pointer dereference usb: core: Try generic PHY_MODE_USB_HOST if usb_phy_roothub_set_mode fails phy: sun4i-usb: Support set_mode to USB_HOST for non-OTG PHYs xhci: Don't let USB3 ports stuck in polling state prevent suspend usb: xhci: dbc: Don't free all memory with spinlock held xhci: Fix port resume done detection for SS ports with LPM enabled USB: serial: mos7720: fix mos_parport refcount imbalance on error path USB: gadget: f_hid: fix deadlock in f_hidg_write() usb: gadget: net2272: Fix net2272_dequeue() usb: gadget: net2280: Fix net2280_dequeue() usb: gadget: net2280: Fix overrun of OUT messages usb: dwc3: pci: add support for Comet Lake PCH ID usb: usb251xb: Remove unnecessary comparison of unsigned integer with >= 0 usb: common: Consider only available nodes for dr_mode usb: typec: tcpm: Try PD-2.0 if sink does not respond to 3.0 source-caps ...
2 parents 782492a + d65d25b commit 8d02a9a

File tree

23 files changed

+110
-37
lines changed

23 files changed

+110
-37
lines changed

drivers/phy/allwinner/phy-sun4i-usb.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,11 @@ static int sun4i_usb_phy_set_mode(struct phy *_phy,
485485
struct sun4i_usb_phy_data *data = to_sun4i_usb_phy_data(phy);
486486
int new_mode;
487487

488-
if (phy->index != 0)
488+
if (phy->index != 0) {
489+
if (mode == PHY_MODE_USB_HOST)
490+
return 0;
489491
return -EINVAL;
492+
}
490493

491494
switch (mode) {
492495
case PHY_MODE_USB_HOST:

drivers/usb/class/cdc-acm.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -558,10 +558,8 @@ static void acm_softint(struct work_struct *work)
558558
clear_bit(EVENT_RX_STALL, &acm->flags);
559559
}
560560

561-
if (test_bit(EVENT_TTY_WAKEUP, &acm->flags)) {
561+
if (test_and_clear_bit(EVENT_TTY_WAKEUP, &acm->flags))
562562
tty_port_tty_wakeup(&acm->port);
563-
clear_bit(EVENT_TTY_WAKEUP, &acm->flags);
564-
}
565563
}
566564

567565
/*

drivers/usb/common/common.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *np, int arg0)
145145

146146
do {
147147
controller = of_find_node_with_property(controller, "phys");
148+
if (!of_device_is_available(controller))
149+
continue;
148150
index = 0;
149151
do {
150152
if (arg0 == -1) {

drivers/usb/core/hcd.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2741,6 +2741,9 @@ int usb_add_hcd(struct usb_hcd *hcd,
27412741

27422742
retval = usb_phy_roothub_set_mode(hcd->phy_roothub,
27432743
PHY_MODE_USB_HOST_SS);
2744+
if (retval)
2745+
retval = usb_phy_roothub_set_mode(hcd->phy_roothub,
2746+
PHY_MODE_USB_HOST);
27442747
if (retval)
27452748
goto err_usb_phy_roothub_power_on;
27462749

drivers/usb/dwc3/dwc3-pci.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#define PCI_DEVICE_ID_INTEL_BXT_M 0x1aaa
3030
#define PCI_DEVICE_ID_INTEL_APL 0x5aaa
3131
#define PCI_DEVICE_ID_INTEL_KBP 0xa2b0
32+
#define PCI_DEVICE_ID_INTEL_CMLH 0x02ee
3233
#define PCI_DEVICE_ID_INTEL_GLK 0x31aa
3334
#define PCI_DEVICE_ID_INTEL_CNPLP 0x9dee
3435
#define PCI_DEVICE_ID_INTEL_CNPH 0xa36e
@@ -305,6 +306,9 @@ static const struct pci_device_id dwc3_pci_id_table[] = {
305306
{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MRFLD),
306307
(kernel_ulong_t) &dwc3_pci_mrfld_properties, },
307308

309+
{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CMLH),
310+
(kernel_ulong_t) &dwc3_pci_intel_properties, },
311+
308312
{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_SPTLP),
309313
(kernel_ulong_t) &dwc3_pci_intel_properties, },
310314

drivers/usb/gadget/function/f_hid.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,20 +391,20 @@ static ssize_t f_hidg_write(struct file *file, const char __user *buffer,
391391
req->complete = f_hidg_req_complete;
392392
req->context = hidg;
393393

394+
spin_unlock_irqrestore(&hidg->write_spinlock, flags);
395+
394396
status = usb_ep_queue(hidg->in_ep, req, GFP_ATOMIC);
395397
if (status < 0) {
396398
ERROR(hidg->func.config->cdev,
397399
"usb_ep_queue error on int endpoint %zd\n", status);
398-
goto release_write_pending_unlocked;
400+
goto release_write_pending;
399401
} else {
400402
status = count;
401403
}
402-
spin_unlock_irqrestore(&hidg->write_spinlock, flags);
403404

404405
return status;
405406
release_write_pending:
406407
spin_lock_irqsave(&hidg->write_spinlock, flags);
407-
release_write_pending_unlocked:
408408
hidg->write_pending = 0;
409409
spin_unlock_irqrestore(&hidg->write_spinlock, flags);
410410

drivers/usb/gadget/udc/net2272.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,7 @@ net2272_dequeue(struct usb_ep *_ep, struct usb_request *_req)
945945
break;
946946
}
947947
if (&req->req != _req) {
948+
ep->stopped = stopped;
948949
spin_unlock_irqrestore(&ep->dev->lock, flags);
949950
return -EINVAL;
950951
}

drivers/usb/gadget/udc/net2280.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -866,9 +866,6 @@ static void start_queue(struct net2280_ep *ep, u32 dmactl, u32 td_dma)
866866
(void) readl(&ep->dev->pci->pcimstctl);
867867

868868
writel(BIT(DMA_START), &dma->dmastat);
869-
870-
if (!ep->is_in)
871-
stop_out_naking(ep);
872869
}
873870

874871
static void start_dma(struct net2280_ep *ep, struct net2280_request *req)
@@ -907,6 +904,7 @@ static void start_dma(struct net2280_ep *ep, struct net2280_request *req)
907904
writel(BIT(DMA_START), &dma->dmastat);
908905
return;
909906
}
907+
stop_out_naking(ep);
910908
}
911909

912910
tmp = dmactl_default;
@@ -1275,9 +1273,9 @@ static int net2280_dequeue(struct usb_ep *_ep, struct usb_request *_req)
12751273
break;
12761274
}
12771275
if (&req->req != _req) {
1276+
ep->stopped = stopped;
12781277
spin_unlock_irqrestore(&ep->dev->lock, flags);
1279-
dev_err(&ep->dev->pdev->dev, "%s: Request mismatch\n",
1280-
__func__);
1278+
ep_dbg(ep->dev, "%s: Request mismatch\n", __func__);
12811279
return -EINVAL;
12821280
}
12831281

drivers/usb/host/u132-hcd.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3204,6 +3204,9 @@ static int __init u132_hcd_init(void)
32043204
printk(KERN_INFO "driver %s\n", hcd_name);
32053205
workqueue = create_singlethread_workqueue("u132");
32063206
retval = platform_driver_register(&u132_platform_driver);
3207+
if (retval)
3208+
destroy_workqueue(workqueue);
3209+
32073210
return retval;
32083211
}
32093212

drivers/usb/host/xhci-dbgcap.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,6 @@ static int xhci_do_dbc_stop(struct xhci_hcd *xhci)
516516
return -1;
517517

518518
writel(0, &dbc->regs->control);
519-
xhci_dbc_mem_cleanup(xhci);
520519
dbc->state = DS_DISABLED;
521520

522521
return 0;
@@ -562,8 +561,10 @@ static void xhci_dbc_stop(struct xhci_hcd *xhci)
562561
ret = xhci_do_dbc_stop(xhci);
563562
spin_unlock_irqrestore(&dbc->lock, flags);
564563

565-
if (!ret)
564+
if (!ret) {
565+
xhci_dbc_mem_cleanup(xhci);
566566
pm_runtime_put_sync(xhci_to_hcd(xhci)->self.controller);
567+
}
567568
}
568569

569570
static void

0 commit comments

Comments
 (0)