Here are a number of tiny USB fixes for 3.4-rc4.
 
 Most of them are in the USB gadget area, but a few other minor USB driver and
 core fixes are here as well.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.18 (GNU/Linux)
 
 iEYEABECAAYFAk+RmT0ACgkQMUfUDdst+yn+ZwCfdYjcW7uIvCqNifegNcSapAX5
 zDUAninQ0Dhuu+jSkB3+hbfYDxFCutbW
 =H4c9
 -----END PGP SIGNATURE-----

Merge tag 'usb-3.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB fixes from Greg Kroah-Hartman:
 "Here are a number of tiny USB fixes for 3.4-rc4.

  Most of them are in the USB gadget area, but a few other minor USB
  driver and core fixes are here as well.

  Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"

* tag 'usb-3.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (36 commits)
  USB: serial: cp210x: Fixed usb_control_msg timeout values
  USB: ehci-tegra: don't call set_irq_flags(IRQF_VALID)
  USB: yurex: Fix missing URB_NO_TRANSFER_DMA_MAP flag in urb
  USB: yurex: Remove allocation of coherent buffer for setup-packet buffer
  drivers/usb/misc/usbtest.c: add kfrees
  USB: ehci-fsl: Fix kernel crash on mpc5121e
  uwb: fix error handling
  uwb: fix use of del_timer_sync() in interrupt
  EHCI: always clear the STS_FLR status bit
  EHCI: fix criterion for resuming the root hub
  USB: sierra: avoid QMI/wwan interface on MC77xx
  usb: usbtest: avoid integer overflow in alloc_sglist()
  usb: usbtest: avoid integer overflow in test_ctrl_queue()
  USB: fix deadlock in bConfigurationValue attribute method
  usb: gadget: eliminate NULL pointer dereference (bugfix)
  usb: gadget: uvc: Remove non-required locking from 'uvc_queue_next_buffer' routine
  usb: gadget: rndis: fix Missing req->context assignment
  usb: musb: omap: fix the error check for pm_runtime_get_sync
  usb: gadget: udc-core: fix asymmetric calls in remove_driver
  usb: musb: omap: fix crash when musb glue (omap) gets initialized
  ...
This commit is contained in:
Linus Torvalds 2012-04-20 11:38:02 -07:00
Родитель c1acb0ba33 2d5733fcd3
Коммит 1cd653a665
24 изменённых файлов: 151 добавлений и 76 удалений

Просмотреть файл

@ -1667,7 +1667,6 @@ void usb_disconnect(struct usb_device **pdev)
{ {
struct usb_device *udev = *pdev; struct usb_device *udev = *pdev;
int i; int i;
struct usb_hcd *hcd = bus_to_hcd(udev->bus);
/* mark the device as inactive, so any further urb submissions for /* mark the device as inactive, so any further urb submissions for
* this device (and any of its children) will fail immediately. * this device (and any of its children) will fail immediately.
@ -1690,9 +1689,7 @@ void usb_disconnect(struct usb_device **pdev)
* so that the hardware is now fully quiesced. * so that the hardware is now fully quiesced.
*/ */
dev_dbg (&udev->dev, "unregistering device\n"); dev_dbg (&udev->dev, "unregistering device\n");
mutex_lock(hcd->bandwidth_mutex);
usb_disable_device(udev, 0); usb_disable_device(udev, 0);
mutex_unlock(hcd->bandwidth_mutex);
usb_hcd_synchronize_unlinks(udev); usb_hcd_synchronize_unlinks(udev);
usb_remove_ep_devs(&udev->ep0); usb_remove_ep_devs(&udev->ep0);

Просмотреть файл

@ -1136,8 +1136,6 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf,
* Deallocates hcd/hardware state for the endpoints (nuking all or most * Deallocates hcd/hardware state for the endpoints (nuking all or most
* pending urbs) and usbcore state for the interfaces, so that usbcore * pending urbs) and usbcore state for the interfaces, so that usbcore
* must usb_set_configuration() before any interfaces could be used. * must usb_set_configuration() before any interfaces could be used.
*
* Must be called with hcd->bandwidth_mutex held.
*/ */
void usb_disable_device(struct usb_device *dev, int skip_ep0) void usb_disable_device(struct usb_device *dev, int skip_ep0)
{ {
@ -1190,7 +1188,9 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
usb_disable_endpoint(dev, i + USB_DIR_IN, false); usb_disable_endpoint(dev, i + USB_DIR_IN, false);
} }
/* Remove endpoints from the host controller internal state */ /* Remove endpoints from the host controller internal state */
mutex_lock(hcd->bandwidth_mutex);
usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL);
mutex_unlock(hcd->bandwidth_mutex);
/* Second pass: remove endpoint pointers */ /* Second pass: remove endpoint pointers */
} }
for (i = skip_ep0; i < 16; ++i) { for (i = skip_ep0; i < 16; ++i) {
@ -1750,7 +1750,6 @@ free_interfaces:
/* if it's already configured, clear out old state first. /* if it's already configured, clear out old state first.
* getting rid of old interfaces means unbinding their drivers. * getting rid of old interfaces means unbinding their drivers.
*/ */
mutex_lock(hcd->bandwidth_mutex);
if (dev->state != USB_STATE_ADDRESS) if (dev->state != USB_STATE_ADDRESS)
usb_disable_device(dev, 1); /* Skip ep0 */ usb_disable_device(dev, 1); /* Skip ep0 */
@ -1763,6 +1762,7 @@ free_interfaces:
* host controller will not allow submissions to dropped endpoints. If * host controller will not allow submissions to dropped endpoints. If
* this call fails, the device state is unchanged. * this call fails, the device state is unchanged.
*/ */
mutex_lock(hcd->bandwidth_mutex);
ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL); ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL);
if (ret < 0) { if (ret < 0) {
mutex_unlock(hcd->bandwidth_mutex); mutex_unlock(hcd->bandwidth_mutex);

Просмотреть файл

@ -206,11 +206,11 @@ static void dwc3_free_event_buffers(struct dwc3 *dwc)
for (i = 0; i < dwc->num_event_buffers; i++) { for (i = 0; i < dwc->num_event_buffers; i++) {
evt = dwc->ev_buffs[i]; evt = dwc->ev_buffs[i];
if (evt) { if (evt)
dwc3_free_one_event_buffer(dwc, evt); dwc3_free_one_event_buffer(dwc, evt);
dwc->ev_buffs[i] = NULL;
}
} }
kfree(dwc->ev_buffs);
} }
/** /**

Просмотреть файл

@ -353,6 +353,9 @@ static int dwc3_ep0_handle_feature(struct dwc3 *dwc,
dwc->test_mode_nr = wIndex >> 8; dwc->test_mode_nr = wIndex >> 8;
dwc->test_mode = true; dwc->test_mode = true;
break;
default:
return -EINVAL;
} }
break; break;
@ -559,15 +562,20 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
length = trb->size & DWC3_TRB_SIZE_MASK; length = trb->size & DWC3_TRB_SIZE_MASK;
if (dwc->ep0_bounced) { if (dwc->ep0_bounced) {
unsigned transfer_size = ur->length;
unsigned maxp = ep0->endpoint.maxpacket;
transfer_size += (maxp - (transfer_size % maxp));
transferred = min_t(u32, ur->length, transferred = min_t(u32, ur->length,
ep0->endpoint.maxpacket - length); transfer_size - length);
memcpy(ur->buf, dwc->ep0_bounce, transferred); memcpy(ur->buf, dwc->ep0_bounce, transferred);
dwc->ep0_bounced = false; dwc->ep0_bounced = false;
} else { } else {
transferred = ur->length - length; transferred = ur->length - length;
ur->actual += transferred;
} }
ur->actual += transferred;
if ((epnum & 1) && ur->actual < ur->length) { if ((epnum & 1) && ur->actual < ur->length) {
/* for some reason we did not get everything out */ /* for some reason we did not get everything out */

Просмотреть файл

@ -712,7 +712,7 @@ static long ffs_ep0_ioctl(struct file *file, unsigned code, unsigned long value)
if (code == FUNCTIONFS_INTERFACE_REVMAP) { if (code == FUNCTIONFS_INTERFACE_REVMAP) {
struct ffs_function *func = ffs->func; struct ffs_function *func = ffs->func;
ret = func ? ffs_func_revmap_intf(func, value) : -ENODEV; ret = func ? ffs_func_revmap_intf(func, value) : -ENODEV;
} else if (gadget->ops->ioctl) { } else if (gadget && gadget->ops->ioctl) {
ret = gadget->ops->ioctl(gadget, code, value); ret = gadget->ops->ioctl(gadget, code, value);
} else { } else {
ret = -ENOTTY; ret = -ENOTTY;
@ -1382,6 +1382,7 @@ static void functionfs_unbind(struct ffs_data *ffs)
ffs->ep0req = NULL; ffs->ep0req = NULL;
ffs->gadget = NULL; ffs->gadget = NULL;
ffs_data_put(ffs); ffs_data_put(ffs);
clear_bit(FFS_FL_BOUND, &ffs->flags);
} }
} }

Просмотреть файл

@ -500,6 +500,7 @@ rndis_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
if (buf) { if (buf) {
memcpy(req->buf, buf, n); memcpy(req->buf, buf, n);
req->complete = rndis_response_complete; req->complete = rndis_response_complete;
req->context = rndis;
rndis_free_response(rndis->config, buf); rndis_free_response(rndis->config, buf);
value = n; value = n;
} }

Просмотреть файл

@ -730,7 +730,7 @@ static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req)
: (1 << (ep_index(ep))); : (1 << (ep_index(ep)));
/* check if the pipe is empty */ /* check if the pipe is empty */
if (!(list_empty(&ep->queue))) { if (!(list_empty(&ep->queue)) && !(ep_index(ep) == 0)) {
/* Add td to the end */ /* Add td to the end */
struct fsl_req *lastreq; struct fsl_req *lastreq;
lastreq = list_entry(ep->queue.prev, struct fsl_req, queue); lastreq = list_entry(ep->queue.prev, struct fsl_req, queue);
@ -918,10 +918,6 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
return -ENOMEM; return -ENOMEM;
} }
/* Update ep0 state */
if ((ep_index(ep) == 0))
udc->ep0_state = DATA_STATE_XMIT;
/* irq handler advances the queue */ /* irq handler advances the queue */
if (req != NULL) if (req != NULL)
list_add_tail(&req->queue, &ep->queue); list_add_tail(&req->queue, &ep->queue);
@ -1279,7 +1275,8 @@ static int ep0_prime_status(struct fsl_udc *udc, int direction)
udc->ep0_dir = USB_DIR_OUT; udc->ep0_dir = USB_DIR_OUT;
ep = &udc->eps[0]; ep = &udc->eps[0];
udc->ep0_state = WAIT_FOR_OUT_STATUS; if (udc->ep0_state != DATA_STATE_XMIT)
udc->ep0_state = WAIT_FOR_OUT_STATUS;
req->ep = ep; req->ep = ep;
req->req.length = 0; req->req.length = 0;
@ -1384,6 +1381,9 @@ static void ch9getstatus(struct fsl_udc *udc, u8 request_type, u16 value,
list_add_tail(&req->queue, &ep->queue); list_add_tail(&req->queue, &ep->queue);
udc->ep0_state = DATA_STATE_XMIT; udc->ep0_state = DATA_STATE_XMIT;
if (ep0_prime_status(udc, EP_DIR_OUT))
ep0stall(udc);
return; return;
stall: stall:
ep0stall(udc); ep0stall(udc);
@ -1492,6 +1492,14 @@ static void setup_received_irq(struct fsl_udc *udc,
spin_lock(&udc->lock); spin_lock(&udc->lock);
udc->ep0_state = (setup->bRequestType & USB_DIR_IN) udc->ep0_state = (setup->bRequestType & USB_DIR_IN)
? DATA_STATE_XMIT : DATA_STATE_RECV; ? DATA_STATE_XMIT : DATA_STATE_RECV;
/*
* If the data stage is IN, send status prime immediately.
* See 2.0 Spec chapter 8.5.3.3 for detail.
*/
if (udc->ep0_state == DATA_STATE_XMIT)
if (ep0_prime_status(udc, EP_DIR_OUT))
ep0stall(udc);
} else { } else {
/* No data phase, IN status from gadget */ /* No data phase, IN status from gadget */
udc->ep0_dir = USB_DIR_IN; udc->ep0_dir = USB_DIR_IN;
@ -1520,9 +1528,8 @@ static void ep0_req_complete(struct fsl_udc *udc, struct fsl_ep *ep0,
switch (udc->ep0_state) { switch (udc->ep0_state) {
case DATA_STATE_XMIT: case DATA_STATE_XMIT:
/* receive status phase */ /* already primed at setup_received_irq */
if (ep0_prime_status(udc, EP_DIR_OUT)) udc->ep0_state = WAIT_FOR_OUT_STATUS;
ep0stall(udc);
break; break;
case DATA_STATE_RECV: case DATA_STATE_RECV:
/* send status phase */ /* send status phase */

Просмотреть файл

@ -161,7 +161,7 @@ static struct usb_composite_driver gfs_driver = {
static struct ffs_data *gfs_ffs_data; static struct ffs_data *gfs_ffs_data;
static unsigned long gfs_registered; static unsigned long gfs_registered;
static int gfs_init(void) static int __init gfs_init(void)
{ {
ENTER(); ENTER();
@ -169,7 +169,7 @@ static int gfs_init(void)
} }
module_init(gfs_init); module_init(gfs_init);
static void gfs_exit(void) static void __exit gfs_exit(void)
{ {
ENTER(); ENTER();

Просмотреть файл

@ -340,7 +340,7 @@ static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg)
/* currently we allocate TX FIFOs for all possible endpoints, /* currently we allocate TX FIFOs for all possible endpoints,
* and assume that they are all the same size. */ * and assume that they are all the same size. */
for (ep = 0; ep <= 15; ep++) { for (ep = 1; ep <= 15; ep++) {
val = addr; val = addr;
val |= size << S3C_DPTXFSIZn_DPTxFSize_SHIFT; val |= size << S3C_DPTXFSIZn_DPTxFSize_SHIFT;
addr += size; addr += size;
@ -741,7 +741,7 @@ static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg,
/* write size / packets */ /* write size / packets */
writel(epsize, hsotg->regs + epsize_reg); writel(epsize, hsotg->regs + epsize_reg);
if (using_dma(hsotg)) { if (using_dma(hsotg) && !continuing) {
unsigned int dma_reg; unsigned int dma_reg;
/* write DMA address to control register, buffer already /* write DMA address to control register, buffer already
@ -1696,10 +1696,12 @@ static void s3c_hsotg_set_ep_maxpacket(struct s3c_hsotg *hsotg,
reg |= mpsval; reg |= mpsval;
writel(reg, regs + S3C_DIEPCTL(ep)); writel(reg, regs + S3C_DIEPCTL(ep));
reg = readl(regs + S3C_DOEPCTL(ep)); if (ep) {
reg &= ~S3C_DxEPCTL_MPS_MASK; reg = readl(regs + S3C_DOEPCTL(ep));
reg |= mpsval; reg &= ~S3C_DxEPCTL_MPS_MASK;
writel(reg, regs + S3C_DOEPCTL(ep)); reg |= mpsval;
writel(reg, regs + S3C_DOEPCTL(ep));
}
return; return;
@ -1919,7 +1921,8 @@ static void s3c_hsotg_epint(struct s3c_hsotg *hsotg, unsigned int idx,
ints & S3C_DIEPMSK_TxFIFOEmpty) { ints & S3C_DIEPMSK_TxFIFOEmpty) {
dev_dbg(hsotg->dev, "%s: ep%d: TxFIFOEmpty\n", dev_dbg(hsotg->dev, "%s: ep%d: TxFIFOEmpty\n",
__func__, idx); __func__, idx);
s3c_hsotg_trytx(hsotg, hs_ep); if (!using_dma(hsotg))
s3c_hsotg_trytx(hsotg, hs_ep);
} }
} }
} }

Просмотреть файл

@ -264,8 +264,8 @@ static void usb_gadget_remove_driver(struct usb_udc *udc)
if (udc_is_newstyle(udc)) { if (udc_is_newstyle(udc)) {
udc->driver->disconnect(udc->gadget); udc->driver->disconnect(udc->gadget);
udc->driver->unbind(udc->gadget); udc->driver->unbind(udc->gadget);
usb_gadget_udc_stop(udc->gadget, udc->driver);
usb_gadget_disconnect(udc->gadget); usb_gadget_disconnect(udc->gadget);
usb_gadget_udc_stop(udc->gadget, udc->driver);
} else { } else {
usb_gadget_stop(udc->gadget, udc->driver); usb_gadget_stop(udc->gadget, udc->driver);
} }
@ -411,8 +411,12 @@ static ssize_t usb_udc_softconn_store(struct device *dev,
struct usb_udc *udc = container_of(dev, struct usb_udc, dev); struct usb_udc *udc = container_of(dev, struct usb_udc, dev);
if (sysfs_streq(buf, "connect")) { if (sysfs_streq(buf, "connect")) {
if (udc_is_newstyle(udc))
usb_gadget_udc_start(udc->gadget, udc->driver);
usb_gadget_connect(udc->gadget); usb_gadget_connect(udc->gadget);
} else if (sysfs_streq(buf, "disconnect")) { } else if (sysfs_streq(buf, "disconnect")) {
if (udc_is_newstyle(udc))
usb_gadget_udc_stop(udc->gadget, udc->driver);
usb_gadget_disconnect(udc->gadget); usb_gadget_disconnect(udc->gadget);
} else { } else {
dev_err(dev, "unsupported command '%s'\n", buf); dev_err(dev, "unsupported command '%s'\n", buf);

Просмотреть файл

@ -543,11 +543,11 @@ done:
return ret; return ret;
} }
/* called with queue->irqlock held.. */
static struct uvc_buffer * static struct uvc_buffer *
uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf) uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf)
{ {
struct uvc_buffer *nextbuf; struct uvc_buffer *nextbuf;
unsigned long flags;
if ((queue->flags & UVC_QUEUE_DROP_INCOMPLETE) && if ((queue->flags & UVC_QUEUE_DROP_INCOMPLETE) &&
buf->buf.length != buf->buf.bytesused) { buf->buf.length != buf->buf.bytesused) {
@ -556,14 +556,12 @@ uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf)
return buf; return buf;
} }
spin_lock_irqsave(&queue->irqlock, flags);
list_del(&buf->queue); list_del(&buf->queue);
if (!list_empty(&queue->irqqueue)) if (!list_empty(&queue->irqqueue))
nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer, nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer,
queue); queue);
else else
nextbuf = NULL; nextbuf = NULL;
spin_unlock_irqrestore(&queue->irqlock, flags);
buf->buf.sequence = queue->sequence++; buf->buf.sequence = queue->sequence++;
do_gettimeofday(&buf->buf.timestamp); do_gettimeofday(&buf->buf.timestamp);

Просмотреть файл

@ -218,6 +218,9 @@ static void ehci_fsl_setup_phy(struct ehci_hcd *ehci,
u32 portsc; u32 portsc;
struct usb_hcd *hcd = ehci_to_hcd(ehci); struct usb_hcd *hcd = ehci_to_hcd(ehci);
void __iomem *non_ehci = hcd->regs; void __iomem *non_ehci = hcd->regs;
struct fsl_usb2_platform_data *pdata;
pdata = hcd->self.controller->platform_data;
portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]); portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]);
portsc &= ~(PORT_PTS_MSK | PORT_PTS_PTW); portsc &= ~(PORT_PTS_MSK | PORT_PTS_PTW);
@ -234,7 +237,9 @@ static void ehci_fsl_setup_phy(struct ehci_hcd *ehci,
/* fall through */ /* fall through */
case FSL_USB2_PHY_UTMI: case FSL_USB2_PHY_UTMI:
/* enable UTMI PHY */ /* enable UTMI PHY */
setbits32(non_ehci + FSL_SOC_USB_CTRL, CTRL_UTMI_PHY_EN); if (pdata->have_sysif_regs)
setbits32(non_ehci + FSL_SOC_USB_CTRL,
CTRL_UTMI_PHY_EN);
portsc |= PORT_PTS_UTMI; portsc |= PORT_PTS_UTMI;
break; break;
case FSL_USB2_PHY_NONE: case FSL_USB2_PHY_NONE:

Просмотреть файл

@ -858,8 +858,13 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
goto dead; goto dead;
} }
/*
* We don't use STS_FLR, but some controllers don't like it to
* remain on, so mask it out along with the other status bits.
*/
masked_status = status & (INTR_MASK | STS_FLR);
/* Shared IRQ? */ /* Shared IRQ? */
masked_status = status & INTR_MASK;
if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) { if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) {
spin_unlock(&ehci->lock); spin_unlock(&ehci->lock);
return IRQ_NONE; return IRQ_NONE;
@ -910,7 +915,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
pcd_status = status; pcd_status = status;
/* resume root hub? */ /* resume root hub? */
if (!(cmd & CMD_RUN)) if (ehci->rh_state == EHCI_RH_SUSPENDED)
usb_hcd_resume_root_hub(hcd); usb_hcd_resume_root_hub(hcd);
/* get per-port change detect bits */ /* get per-port change detect bits */

Просмотреть файл

@ -731,7 +731,6 @@ static int tegra_ehci_probe(struct platform_device *pdev)
err = -ENODEV; err = -ENODEV;
goto fail; goto fail;
} }
set_irq_flags(irq, IRQF_VALID);
#ifdef CONFIG_USB_OTG_UTILS #ifdef CONFIG_USB_OTG_UTILS
if (pdata->operating_mode == TEGRA_USB_OTG) { if (pdata->operating_mode == TEGRA_USB_OTG) {

Просмотреть файл

@ -423,7 +423,7 @@ alloc_sglist(int nents, int max, int vary)
unsigned i; unsigned i;
unsigned size = max; unsigned size = max;
sg = kmalloc(nents * sizeof *sg, GFP_KERNEL); sg = kmalloc_array(nents, sizeof *sg, GFP_KERNEL);
if (!sg) if (!sg)
return NULL; return NULL;
sg_init_table(sg, nents); sg_init_table(sg, nents);
@ -904,6 +904,9 @@ test_ctrl_queue(struct usbtest_dev *dev, struct usbtest_param *param)
struct ctrl_ctx context; struct ctrl_ctx context;
int i; int i;
if (param->sglen == 0 || param->iterations > UINT_MAX / param->sglen)
return -EOPNOTSUPP;
spin_lock_init(&context.lock); spin_lock_init(&context.lock);
context.dev = dev; context.dev = dev;
init_completion(&context.complete); init_completion(&context.complete);
@ -1981,8 +1984,6 @@ usbtest_ioctl(struct usb_interface *intf, unsigned int code, void *buf)
/* queued control messaging */ /* queued control messaging */
case 10: case 10:
if (param->sglen == 0)
break;
retval = 0; retval = 0;
dev_info(&intf->dev, dev_info(&intf->dev,
"TEST 10: queue %d control calls, %d times\n", "TEST 10: queue %d control calls, %d times\n",
@ -2276,6 +2277,8 @@ usbtest_probe(struct usb_interface *intf, const struct usb_device_id *id)
if (status < 0) { if (status < 0) {
WARNING(dev, "couldn't get endpoints, %d\n", WARNING(dev, "couldn't get endpoints, %d\n",
status); status);
kfree(dev->buf);
kfree(dev);
return status; return status;
} }
/* may find bulk or ISO pipes */ /* may find bulk or ISO pipes */

Просмотреть файл

@ -99,9 +99,7 @@ static void yurex_delete(struct kref *kref)
usb_put_dev(dev->udev); usb_put_dev(dev->udev);
if (dev->cntl_urb) { if (dev->cntl_urb) {
usb_kill_urb(dev->cntl_urb); usb_kill_urb(dev->cntl_urb);
if (dev->cntl_req) kfree(dev->cntl_req);
usb_free_coherent(dev->udev, YUREX_BUF_SIZE,
dev->cntl_req, dev->cntl_urb->setup_dma);
if (dev->cntl_buffer) if (dev->cntl_buffer)
usb_free_coherent(dev->udev, YUREX_BUF_SIZE, usb_free_coherent(dev->udev, YUREX_BUF_SIZE,
dev->cntl_buffer, dev->cntl_urb->transfer_dma); dev->cntl_buffer, dev->cntl_urb->transfer_dma);
@ -234,9 +232,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
} }
/* allocate buffer for control req */ /* allocate buffer for control req */
dev->cntl_req = usb_alloc_coherent(dev->udev, YUREX_BUF_SIZE, dev->cntl_req = kmalloc(YUREX_BUF_SIZE, GFP_KERNEL);
GFP_KERNEL,
&dev->cntl_urb->setup_dma);
if (!dev->cntl_req) { if (!dev->cntl_req) {
err("Could not allocate cntl_req"); err("Could not allocate cntl_req");
goto error; goto error;
@ -286,7 +282,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr), usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr),
dev->int_buffer, YUREX_BUF_SIZE, yurex_interrupt, dev->int_buffer, YUREX_BUF_SIZE, yurex_interrupt,
dev, 1); dev, 1);
dev->cntl_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; dev->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
if (usb_submit_urb(dev->urb, GFP_KERNEL)) { if (usb_submit_urb(dev->urb, GFP_KERNEL)) {
retval = -EIO; retval = -EIO;
err("Could not submitting URB"); err("Could not submitting URB");

Просмотреть файл

@ -137,6 +137,9 @@ static int musb_ulpi_read(struct usb_phy *phy, u32 offset)
int i = 0; int i = 0;
u8 r; u8 r;
u8 power; u8 power;
int ret;
pm_runtime_get_sync(phy->io_dev);
/* Make sure the transceiver is not in low power mode */ /* Make sure the transceiver is not in low power mode */
power = musb_readb(addr, MUSB_POWER); power = musb_readb(addr, MUSB_POWER);
@ -154,15 +157,22 @@ static int musb_ulpi_read(struct usb_phy *phy, u32 offset)
while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL)
& MUSB_ULPI_REG_CMPLT)) { & MUSB_ULPI_REG_CMPLT)) {
i++; i++;
if (i == 10000) if (i == 10000) {
return -ETIMEDOUT; ret = -ETIMEDOUT;
goto out;
}
} }
r = musb_readb(addr, MUSB_ULPI_REG_CONTROL); r = musb_readb(addr, MUSB_ULPI_REG_CONTROL);
r &= ~MUSB_ULPI_REG_CMPLT; r &= ~MUSB_ULPI_REG_CMPLT;
musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r); musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r);
return musb_readb(addr, MUSB_ULPI_REG_DATA); ret = musb_readb(addr, MUSB_ULPI_REG_DATA);
out:
pm_runtime_put(phy->io_dev);
return ret;
} }
static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data)
@ -171,6 +181,9 @@ static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data)
int i = 0; int i = 0;
u8 r = 0; u8 r = 0;
u8 power; u8 power;
int ret = 0;
pm_runtime_get_sync(phy->io_dev);
/* Make sure the transceiver is not in low power mode */ /* Make sure the transceiver is not in low power mode */
power = musb_readb(addr, MUSB_POWER); power = musb_readb(addr, MUSB_POWER);
@ -184,15 +197,20 @@ static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data)
while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL)
& MUSB_ULPI_REG_CMPLT)) { & MUSB_ULPI_REG_CMPLT)) {
i++; i++;
if (i == 10000) if (i == 10000) {
return -ETIMEDOUT; ret = -ETIMEDOUT;
goto out;
}
} }
r = musb_readb(addr, MUSB_ULPI_REG_CONTROL); r = musb_readb(addr, MUSB_ULPI_REG_CONTROL);
r &= ~MUSB_ULPI_REG_CMPLT; r &= ~MUSB_ULPI_REG_CMPLT;
musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r); musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r);
return 0; out:
pm_runtime_put(phy->io_dev);
return ret;
} }
#else #else
#define musb_ulpi_read NULL #define musb_ulpi_read NULL
@ -1904,14 +1922,17 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
if (!musb->isr) { if (!musb->isr) {
status = -ENODEV; status = -ENODEV;
goto fail3; goto fail2;
} }
if (!musb->xceiv->io_ops) { if (!musb->xceiv->io_ops) {
musb->xceiv->io_dev = musb->controller;
musb->xceiv->io_priv = musb->mregs; musb->xceiv->io_priv = musb->mregs;
musb->xceiv->io_ops = &musb_ulpi_access; musb->xceiv->io_ops = &musb_ulpi_access;
} }
pm_runtime_get_sync(musb->controller);
#ifndef CONFIG_MUSB_PIO_ONLY #ifndef CONFIG_MUSB_PIO_ONLY
if (use_dma && dev->dma_mask) { if (use_dma && dev->dma_mask) {
struct dma_controller *c; struct dma_controller *c;
@ -2023,6 +2044,8 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
goto fail5; goto fail5;
#endif #endif
pm_runtime_put(musb->controller);
dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n", dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n",
({char *s; ({char *s;
switch (musb->board_mode) { switch (musb->board_mode) {
@ -2047,6 +2070,9 @@ fail4:
musb_gadget_cleanup(musb); musb_gadget_cleanup(musb);
fail3: fail3:
pm_runtime_put_sync(musb->controller);
fail2:
if (musb->irq_wake) if (musb->irq_wake)
device_init_wakeup(dev, 0); device_init_wakeup(dev, 0);
musb_platform_exit(musb); musb_platform_exit(musb);

Просмотреть файл

@ -2098,7 +2098,7 @@ static int musb_cleanup_urb(struct urb *urb, struct musb_qh *qh)
} }
/* turn off DMA requests, discard state, stop polling ... */ /* turn off DMA requests, discard state, stop polling ... */
if (is_in) { if (ep->epnum && is_in) {
/* giveback saves bulk toggle */ /* giveback saves bulk toggle */
csr = musb_h_flush_rxfifo(ep, 0); csr = musb_h_flush_rxfifo(ep, 0);

Просмотреть файл

@ -282,7 +282,8 @@ static void musb_otg_notifier_work(struct work_struct *data_notifier_work)
static int omap2430_musb_init(struct musb *musb) static int omap2430_musb_init(struct musb *musb)
{ {
u32 l, status = 0; u32 l;
int status = 0;
struct device *dev = musb->controller; struct device *dev = musb->controller;
struct musb_hdrc_platform_data *plat = dev->platform_data; struct musb_hdrc_platform_data *plat = dev->platform_data;
struct omap_musb_board_data *data = plat->board_data; struct omap_musb_board_data *data = plat->board_data;
@ -301,7 +302,7 @@ static int omap2430_musb_init(struct musb *musb)
status = pm_runtime_get_sync(dev); status = pm_runtime_get_sync(dev);
if (status < 0) { if (status < 0) {
dev_err(dev, "pm_runtime_get_sync FAILED"); dev_err(dev, "pm_runtime_get_sync FAILED %d\n", status);
goto err1; goto err1;
} }
@ -333,6 +334,7 @@ static int omap2430_musb_init(struct musb *musb)
setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb); setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb);
pm_runtime_put_noidle(musb->controller);
return 0; return 0;
err1: err1:
@ -452,14 +454,14 @@ static int __devinit omap2430_probe(struct platform_device *pdev)
goto err2; goto err2;
} }
pm_runtime_enable(&pdev->dev);
ret = platform_device_add(musb); ret = platform_device_add(musb);
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to register musb device\n"); dev_err(&pdev->dev, "failed to register musb device\n");
goto err2; goto err2;
} }
pm_runtime_enable(&pdev->dev);
return 0; return 0;
err2: err2:
@ -478,7 +480,6 @@ static int __devexit omap2430_remove(struct platform_device *pdev)
platform_device_del(glue->musb); platform_device_del(glue->musb);
platform_device_put(glue->musb); platform_device_put(glue->musb);
pm_runtime_put(&pdev->dev);
kfree(glue); kfree(glue);
return 0; return 0;
@ -491,11 +492,13 @@ static int omap2430_runtime_suspend(struct device *dev)
struct omap2430_glue *glue = dev_get_drvdata(dev); struct omap2430_glue *glue = dev_get_drvdata(dev);
struct musb *musb = glue_to_musb(glue); struct musb *musb = glue_to_musb(glue);
musb->context.otg_interfsel = musb_readl(musb->mregs, if (musb) {
OTG_INTERFSEL); musb->context.otg_interfsel = musb_readl(musb->mregs,
OTG_INTERFSEL);
omap2430_low_level_exit(musb); omap2430_low_level_exit(musb);
usb_phy_set_suspend(musb->xceiv, 1); usb_phy_set_suspend(musb->xceiv, 1);
}
return 0; return 0;
} }
@ -505,11 +508,13 @@ static int omap2430_runtime_resume(struct device *dev)
struct omap2430_glue *glue = dev_get_drvdata(dev); struct omap2430_glue *glue = dev_get_drvdata(dev);
struct musb *musb = glue_to_musb(glue); struct musb *musb = glue_to_musb(glue);
omap2430_low_level_init(musb); if (musb) {
musb_writel(musb->mregs, OTG_INTERFSEL, omap2430_low_level_init(musb);
musb->context.otg_interfsel); musb_writel(musb->mregs, OTG_INTERFSEL,
musb->context.otg_interfsel);
usb_phy_set_suspend(musb->xceiv, 0); usb_phy_set_suspend(musb->xceiv, 0);
}
return 0; return 0;
} }

Просмотреть файл

@ -287,7 +287,8 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request,
/* Issue the request, attempting to read 'size' bytes */ /* Issue the request, attempting to read 'size' bytes */
result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
request, REQTYPE_DEVICE_TO_HOST, 0x0000, request, REQTYPE_DEVICE_TO_HOST, 0x0000,
port_priv->bInterfaceNumber, buf, size, 300); port_priv->bInterfaceNumber, buf, size,
USB_CTRL_GET_TIMEOUT);
/* Convert data into an array of integers */ /* Convert data into an array of integers */
for (i = 0; i < length; i++) for (i = 0; i < length; i++)
@ -340,12 +341,14 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request,
result = usb_control_msg(serial->dev, result = usb_control_msg(serial->dev,
usb_sndctrlpipe(serial->dev, 0), usb_sndctrlpipe(serial->dev, 0),
request, REQTYPE_HOST_TO_DEVICE, 0x0000, request, REQTYPE_HOST_TO_DEVICE, 0x0000,
port_priv->bInterfaceNumber, buf, size, 300); port_priv->bInterfaceNumber, buf, size,
USB_CTRL_SET_TIMEOUT);
} else { } else {
result = usb_control_msg(serial->dev, result = usb_control_msg(serial->dev,
usb_sndctrlpipe(serial->dev, 0), usb_sndctrlpipe(serial->dev, 0),
request, REQTYPE_HOST_TO_DEVICE, data[0], request, REQTYPE_HOST_TO_DEVICE, data[0],
port_priv->bInterfaceNumber, NULL, 0, 300); port_priv->bInterfaceNumber, NULL, 0,
USB_CTRL_SET_TIMEOUT);
} }
kfree(buf); kfree(buf);

Просмотреть файл

@ -221,7 +221,7 @@ static const struct sierra_iface_info typeB_interface_list = {
}; };
/* 'blacklist' of interfaces not served by this driver */ /* 'blacklist' of interfaces not served by this driver */
static const u8 direct_ip_non_serial_ifaces[] = { 7, 8, 9, 10, 11 }; static const u8 direct_ip_non_serial_ifaces[] = { 7, 8, 9, 10, 11, 19, 20 };
static const struct sierra_iface_info direct_ip_interface_blacklist = { static const struct sierra_iface_info direct_ip_interface_blacklist = {
.infolen = ARRAY_SIZE(direct_ip_non_serial_ifaces), .infolen = ARRAY_SIZE(direct_ip_non_serial_ifaces),
.ifaceinfo = direct_ip_non_serial_ifaces, .ifaceinfo = direct_ip_non_serial_ifaces,
@ -289,7 +289,6 @@ static const struct usb_device_id id_table[] = {
{ USB_DEVICE(0x1199, 0x6856) }, /* Sierra Wireless AirCard 881 U */ { USB_DEVICE(0x1199, 0x6856) }, /* Sierra Wireless AirCard 881 U */
{ USB_DEVICE(0x1199, 0x6859) }, /* Sierra Wireless AirCard 885 E */ { USB_DEVICE(0x1199, 0x6859) }, /* Sierra Wireless AirCard 885 E */
{ USB_DEVICE(0x1199, 0x685A) }, /* Sierra Wireless AirCard 885 E */ { USB_DEVICE(0x1199, 0x685A) }, /* Sierra Wireless AirCard 885 E */
{ USB_DEVICE(0x1199, 0x68A2) }, /* Sierra Wireless MC7710 */
/* Sierra Wireless C885 */ /* Sierra Wireless C885 */
{ USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6880, 0xFF, 0xFF, 0xFF)}, { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6880, 0xFF, 0xFF, 0xFF)},
/* Sierra Wireless C888, Air Card 501, USB 303, USB 304 */ /* Sierra Wireless C888, Air Card 501, USB 303, USB 304 */
@ -299,6 +298,9 @@ static const struct usb_device_id id_table[] = {
/* Sierra Wireless HSPA Non-Composite Device */ /* Sierra Wireless HSPA Non-Composite Device */
{ USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)},
{ USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */ { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */
{ USB_DEVICE(0x1199, 0x68A2), /* Sierra Wireless MC77xx in QMI mode */
.driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
},
{ USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */
.driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
}, },

Просмотреть файл

@ -645,7 +645,8 @@ void hwarc_neep_cb(struct urb *urb)
dev_err(dev, "NEEP: URB error %d\n", urb->status); dev_err(dev, "NEEP: URB error %d\n", urb->status);
} }
result = usb_submit_urb(urb, GFP_ATOMIC); result = usb_submit_urb(urb, GFP_ATOMIC);
if (result < 0) { if (result < 0 && result != -ENODEV && result != -EPERM) {
/* ignoring unrecoverable errors */
dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n", dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n",
result); result);
goto error; goto error;

Просмотреть файл

@ -107,6 +107,7 @@ struct uwb_rc_neh {
u8 evt_type; u8 evt_type;
__le16 evt; __le16 evt;
u8 context; u8 context;
u8 completed;
uwb_rc_cmd_cb_f cb; uwb_rc_cmd_cb_f cb;
void *arg; void *arg;
@ -409,6 +410,7 @@ static void uwb_rc_neh_grok_event(struct uwb_rc *rc, struct uwb_rceb *rceb, size
struct device *dev = &rc->uwb_dev.dev; struct device *dev = &rc->uwb_dev.dev;
struct uwb_rc_neh *neh; struct uwb_rc_neh *neh;
struct uwb_rceb *notif; struct uwb_rceb *notif;
unsigned long flags;
if (rceb->bEventContext == 0) { if (rceb->bEventContext == 0) {
notif = kmalloc(size, GFP_ATOMIC); notif = kmalloc(size, GFP_ATOMIC);
@ -422,7 +424,11 @@ static void uwb_rc_neh_grok_event(struct uwb_rc *rc, struct uwb_rceb *rceb, size
} else { } else {
neh = uwb_rc_neh_lookup(rc, rceb); neh = uwb_rc_neh_lookup(rc, rceb);
if (neh) { if (neh) {
del_timer_sync(&neh->timer); spin_lock_irqsave(&rc->neh_lock, flags);
/* to guard against a timeout */
neh->completed = 1;
del_timer(&neh->timer);
spin_unlock_irqrestore(&rc->neh_lock, flags);
uwb_rc_neh_cb(neh, rceb, size); uwb_rc_neh_cb(neh, rceb, size);
} else } else
dev_warn(dev, "event 0x%02x/%04x/%02x (%zu bytes): nobody cared\n", dev_warn(dev, "event 0x%02x/%04x/%02x (%zu bytes): nobody cared\n",
@ -568,6 +574,10 @@ static void uwb_rc_neh_timer(unsigned long arg)
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&rc->neh_lock, flags); spin_lock_irqsave(&rc->neh_lock, flags);
if (neh->completed) {
spin_unlock_irqrestore(&rc->neh_lock, flags);
return;
}
if (neh->context) if (neh->context)
__uwb_rc_neh_rm(rc, neh); __uwb_rc_neh_rm(rc, neh);
else else

Просмотреть файл

@ -94,6 +94,7 @@ struct usb_phy {
struct usb_otg *otg; struct usb_otg *otg;
struct device *io_dev;
struct usb_phy_io_ops *io_ops; struct usb_phy_io_ops *io_ops;
void __iomem *io_priv; void __iomem *io_priv;