usb: fixes for v4.14-rc2

First set of fixes for the gadget side. Not much this time around,
 things have been rather calm.
 
 In no order whatsoever, this pull request contains:
 
 - A DMA starvation fix on dwc3 caused by some recent changes to how we
   map/unmap requests
 
 - A build error fix on the snps_udc_plat.c driver
 
 - A fix for how to we call ->udc_set_speed()
 
 - Spinlock recursion fix on the printer gadget
 
 - Removal of pointless comparisons on dummy driver
 -----BEGIN PGP SIGNATURE-----
 
 iQJRBAABCgA7FiEElLzh7wn96CXwjh2IzL64meEamQYFAlnDbVAdHGZlbGlwZS5i
 YWxiaUBsaW51eC5pbnRlbC5jb20ACgkQzL64meEamQZYjw//XqvpbfQEIRi0wcTs
 82z7mwMG1+DhkWOXA6ZtMXN3KuXKIm+SdaqaiDfdFUnR9p2boDqPRuOs8vYFL30l
 SWhW1/4PjaxCaj0r2zJ0zNujj2WPpS7e72w5be+jz05C3WVe0xQIV1ERlDMzizWT
 4NZgGosMvkZQBuCGS1wXUlzu2KrHMknPJLw1PuzuW4uV93Hv/6Rolv7UPRbu4alU
 WxlaipHDdBLPKNu6SPkZeGP/DZvP6fuPumhQtInL1KJvnCKmqGBsC58GLpWxsY1V
 tdCyoZEQBsa7e3KKLxT7M4PwlRt29dwGqIvBNnxg6QCbs3niL/rZxCuNSgicKEal
 TpSS4tdAG3CqPJUyLWwlCp2WBzyQeOcO0yCA+aHiXblw6RdIRBHD+Tm51mEIfl3Q
 /B3gPTXOKTcV9WRujn0cgSJ6vwzf7FTAdzNfDeAvn31DCj8K063xabuBpENF2uSm
 kUkeQRAJapS0VP/mfpFuB+IEViP2xfuPHCwlGmBnmMglNSkQHMRJNqBiWR7XEpXg
 IT93vm6oC/i0pb5WSfyCRQEdvq2zKA3SgWxUfWZtnAgUoZ4PP+uuMHc/sZ8FErhK
 mGGBHme/Zy0PGD9BTx9xdl0ZvLI8qL/sOIv7/YscflXgGH5Ti5n+FYoRYqrNj7WJ
 GvQAVM/WUix6yUMmVw2I5WswN/w=
 =5OKH
 -----END PGP SIGNATURE-----

Merge tag 'fixes-for-v4.14-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus

Felipe writes:

usb: fixes for v4.14-rc2

First set of fixes for the gadget side. Not much this time around,
things have been rather calm.

In no order whatsoever, this pull request contains:

- A DMA starvation fix on dwc3 caused by some recent changes to how we
  map/unmap requests

- A build error fix on the snps_udc_plat.c driver

- A fix for how to we call ->udc_set_speed()

- Spinlock recursion fix on the printer gadget

- Removal of pointless comparisons on dummy driver
This commit is contained in:
Greg Kroah-Hartman 2017-09-21 10:05:41 +02:00
commit 60e70ecd7a
5 changed files with 19 additions and 8 deletions

View File

@ -990,6 +990,8 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc,
DWC3_TRBCTL_CONTROL_DATA,
true);
req->trb = &dwc->ep0_trb[dep->trb_enqueue - 1];
/* Now prepare one extra TRB to align transfer size */
dwc3_ep0_prepare_one_trb(dep, dwc->bounce_addr,
maxpacket - rem,
@ -1015,6 +1017,8 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc,
DWC3_TRBCTL_CONTROL_DATA,
true);
req->trb = &dwc->ep0_trb[dep->trb_enqueue - 1];
/* Now prepare one extra TRB to align transfer size */
dwc3_ep0_prepare_one_trb(dep, dwc->bounce_addr,
0, DWC3_TRBCTL_CONTROL_DATA,
@ -1029,6 +1033,9 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc,
dwc3_ep0_prepare_one_trb(dep, req->request.dma,
req->request.length, DWC3_TRBCTL_CONTROL_DATA,
false);
req->trb = &dwc->ep0_trb[dep->trb_enqueue];
ret = dwc3_ep0_start_trans(dep);
}

View File

@ -555,6 +555,7 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
size_t size; /* Amount of data in a TX request. */
size_t bytes_copied = 0;
struct usb_request *req;
int value;
DBG(dev, "printer_write trying to send %d bytes\n", (int)len);
@ -634,7 +635,11 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
return -EAGAIN;
}
if (usb_ep_queue(dev->in_ep, req, GFP_ATOMIC)) {
/* here, we unlock, and only unlock, to avoid deadlock. */
spin_unlock(&dev->lock);
value = usb_ep_queue(dev->in_ep, req, GFP_ATOMIC);
spin_lock(&dev->lock);
if (value) {
list_add(&req->list, &dev->tx_reqs);
spin_unlock_irqrestore(&dev->lock, flags);
mutex_unlock(&dev->lock_printer_io);

View File

@ -273,6 +273,7 @@ config USB_SNP_CORE
config USB_SNP_UDC_PLAT
tristate "Synopsys USB 2.0 Device controller"
depends on USB_GADGET && OF && HAS_DMA
depends on EXTCON || EXTCON=n
select USB_GADGET_DUALSPEED
select USB_SNP_CORE
default ARCH_BCM_IPROC

View File

@ -1320,7 +1320,6 @@ static int udc_bind_to_driver(struct usb_udc *udc, struct usb_gadget_driver *dri
udc->dev.driver = &driver->driver;
udc->gadget->dev.driver = &driver->driver;
if (driver->max_speed < udc->gadget->max_speed)
usb_gadget_udc_set_speed(udc, driver->max_speed);
ret = driver->bind(udc->gadget, driver);

View File

@ -375,10 +375,9 @@ static void set_link_state_by_speed(struct dummy_hcd *dum_hcd)
USB_PORT_STAT_CONNECTION) == 0)
dum_hcd->port_status |=
(USB_PORT_STAT_C_CONNECTION << 16);
if ((dum_hcd->port_status &
USB_PORT_STAT_ENABLE) == 1 &&
if ((dum_hcd->port_status & USB_PORT_STAT_ENABLE) &&
(dum_hcd->port_status &
USB_SS_PORT_LS_U0) == 1 &&
USB_PORT_STAT_LINK_STATE) == USB_SS_PORT_LS_U0 &&
dum_hcd->rh_state != DUMMY_RH_SUSPENDED)
dum_hcd->active = 1;
}