Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6bc2b95e authored by Linus Torvalds's avatar Linus Torvalds
Browse files


Here are a bunch of USB patches for 3.3-rc1.

Nothing major, largest thing here is the removal of some drivers that
did not work at all.  Other than that, the normal collection of bugfixes
and new device ids.

Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>

* tag 'usb-3.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (52 commits)
  uwb & wusb: fix kconfig error
  USB: Realtek cr: fix autopm scheduling while atomic
  USB: ftdi_sio: Add more identifiers
  xHCI: Cleanup isoc transfer ring when TD length mismatch found
  usb: musb: omap2430: minor cleanups.
  qcaux: add more Pantech UML190 and UML290 ports
  Revert "drivers: usb: Fix dependency for USB_HWA_HCD"
  usb: mv-otg - Fix build if CONFIG_USB is not set
  USB: cdc-wdm: Avoid hanging on interface with no USB_CDC_DMM_TYPE
  usb: add support for STA2X11 host driver
  drivers: usb: Fix dependency for USB_HWA_HCD
  kernel-doc: fix new warning in usb.h
  USB: OHCI: fix new compiler warnings
  usb: serial: kobil_sct: fix compile warning:
  drivers/usb/host/ehci-fsl.c: add missing iounmap
  USB: cdc-wdm: better allocate a buffer that is at least as big as we tell the USB core
  USB: cdc-wdm: call wake_up_all to allow driver to shutdown on device removal
  USB: cdc-wdm: use two mutexes to allow simultaneous read and write
  USB: cdc-wdm: updating desc->length must be protected by spin_lock
  USB: usbsevseg: fix max length
  ...
parents a14a8d93 a0701f04
Loading
Loading
Loading
Loading
+38 −21
Original line number Diff line number Diff line
@@ -57,6 +57,8 @@ MODULE_DEVICE_TABLE (usb, wdm_ids);

#define WDM_MAX			16

/* CDC-WMC r1.1 requires wMaxCommand to be "at least 256 decimal (0x100)" */
#define WDM_DEFAULT_BUFSIZE	256

static DEFINE_MUTEX(wdm_mutex);

@@ -88,7 +90,8 @@ struct wdm_device {
	int			count;
	dma_addr_t		shandle;
	dma_addr_t		ihandle;
	struct mutex		lock;
	struct mutex		wlock;
	struct mutex		rlock;
	wait_queue_head_t	wait;
	struct work_struct	rxwork;
	int			werr;
@@ -323,7 +326,7 @@ static ssize_t wdm_write
	}

	/* concurrent writes and disconnect */
	r = mutex_lock_interruptible(&desc->lock);
	r = mutex_lock_interruptible(&desc->wlock);
	rv = -ERESTARTSYS;
	if (r) {
		kfree(buf);
@@ -386,7 +389,7 @@ static ssize_t wdm_write
out:
	usb_autopm_put_interface(desc->intf);
outnp:
	mutex_unlock(&desc->lock);
	mutex_unlock(&desc->wlock);
outnl:
	return rv < 0 ? rv : count;
}
@@ -399,7 +402,7 @@ static ssize_t wdm_read
	struct wdm_device *desc = file->private_data;


	rv = mutex_lock_interruptible(&desc->lock); /*concurrent reads */
	rv = mutex_lock_interruptible(&desc->rlock); /*concurrent reads */
	if (rv < 0)
		return -ERESTARTSYS;

@@ -467,14 +470,16 @@ retry:
	for (i = 0; i < desc->length - cntr; i++)
		desc->ubuf[i] = desc->ubuf[i + cntr];

	spin_lock_irq(&desc->iuspin);
	desc->length -= cntr;
	spin_unlock_irq(&desc->iuspin);
	/* in case we had outstanding data */
	if (!desc->length)
		clear_bit(WDM_READ, &desc->flags);
	rv = cntr;

err:
	mutex_unlock(&desc->lock);
	mutex_unlock(&desc->rlock);
	return rv;
}

@@ -540,7 +545,8 @@ static int wdm_open(struct inode *inode, struct file *file)
	}
	intf->needs_remote_wakeup = 1;

	mutex_lock(&desc->lock);
	/* using write lock to protect desc->count */
	mutex_lock(&desc->wlock);
	if (!desc->count++) {
		desc->werr = 0;
		desc->rerr = 0;
@@ -553,7 +559,7 @@ static int wdm_open(struct inode *inode, struct file *file)
	} else {
		rv = 0;
	}
	mutex_unlock(&desc->lock);
	mutex_unlock(&desc->wlock);
	usb_autopm_put_interface(desc->intf);
out:
	mutex_unlock(&wdm_mutex);
@@ -565,9 +571,11 @@ static int wdm_release(struct inode *inode, struct file *file)
	struct wdm_device *desc = file->private_data;

	mutex_lock(&wdm_mutex);
	mutex_lock(&desc->lock);

	/* using write lock to protect desc->count */
	mutex_lock(&desc->wlock);
	desc->count--;
	mutex_unlock(&desc->lock);
	mutex_unlock(&desc->wlock);

	if (!desc->count) {
		dev_dbg(&desc->intf->dev, "wdm_release: cleanup");
@@ -630,7 +638,7 @@ static int wdm_probe(struct usb_interface *intf, const struct usb_device_id *id)
	struct usb_cdc_dmm_desc *dmhd;
	u8 *buffer = intf->altsetting->extra;
	int buflen = intf->altsetting->extralen;
	u16 maxcom = 0;
	u16 maxcom = WDM_DEFAULT_BUFSIZE;

	if (!buffer)
		goto out;
@@ -665,7 +673,8 @@ next_desc:
	desc = kzalloc(sizeof(struct wdm_device), GFP_KERNEL);
	if (!desc)
		goto out;
	mutex_init(&desc->lock);
	mutex_init(&desc->rlock);
	mutex_init(&desc->wlock);
	spin_lock_init(&desc->iuspin);
	init_waitqueue_head(&desc->wait);
	desc->wMaxCommand = maxcom;
@@ -716,7 +725,7 @@ next_desc:
		goto err;

	desc->inbuf = usb_alloc_coherent(interface_to_usbdev(intf),
					 desc->bMaxPacketSize0,
					 desc->wMaxCommand,
					 GFP_KERNEL,
					 &desc->response->transfer_dma);
	if (!desc->inbuf)
@@ -779,11 +788,13 @@ static void wdm_disconnect(struct usb_interface *intf)
	/* to terminate pending flushes */
	clear_bit(WDM_IN_USE, &desc->flags);
	spin_unlock_irqrestore(&desc->iuspin, flags);
	mutex_lock(&desc->lock);
	wake_up_all(&desc->wait);
	mutex_lock(&desc->rlock);
	mutex_lock(&desc->wlock);
	kill_urbs(desc);
	cancel_work_sync(&desc->rxwork);
	mutex_unlock(&desc->lock);
	wake_up_all(&desc->wait);
	mutex_unlock(&desc->wlock);
	mutex_unlock(&desc->rlock);
	if (!desc->count)
		cleanup(desc);
	mutex_unlock(&wdm_mutex);
@@ -798,8 +809,10 @@ static int wdm_suspend(struct usb_interface *intf, pm_message_t message)
	dev_dbg(&desc->intf->dev, "wdm%d_suspend\n", intf->minor);

	/* if this is an autosuspend the caller does the locking */
	if (!PMSG_IS_AUTO(message))
		mutex_lock(&desc->lock);
	if (!PMSG_IS_AUTO(message)) {
		mutex_lock(&desc->rlock);
		mutex_lock(&desc->wlock);
	}
	spin_lock_irq(&desc->iuspin);

	if (PMSG_IS_AUTO(message) &&
@@ -815,8 +828,10 @@ static int wdm_suspend(struct usb_interface *intf, pm_message_t message)
		kill_urbs(desc);
		cancel_work_sync(&desc->rxwork);
	}
	if (!PMSG_IS_AUTO(message))
		mutex_unlock(&desc->lock);
	if (!PMSG_IS_AUTO(message)) {
		mutex_unlock(&desc->wlock);
		mutex_unlock(&desc->rlock);
	}

	return rv;
}
@@ -854,7 +869,8 @@ static int wdm_pre_reset(struct usb_interface *intf)
{
	struct wdm_device *desc = usb_get_intfdata(intf);

	mutex_lock(&desc->lock);
	mutex_lock(&desc->rlock);
	mutex_lock(&desc->wlock);
	kill_urbs(desc);

	/*
@@ -876,7 +892,8 @@ static int wdm_post_reset(struct usb_interface *intf)
	int rv;

	rv = recover_from_urb_loss(desc);
	mutex_unlock(&desc->lock);
	mutex_unlock(&desc->wlock);
	mutex_unlock(&desc->rlock);
	return 0;
}

+4 −11
Original line number Diff line number Diff line
@@ -126,7 +126,6 @@ static int __dwc3_gadget_ep0_queue(struct dwc3_ep *dep,
		struct dwc3_request *req)
{
	struct dwc3		*dwc = dep->dwc;
	u32			type;
	int			ret = 0;

	req->request.actual	= 0;
@@ -149,20 +148,14 @@ static int __dwc3_gadget_ep0_queue(struct dwc3_ep *dep,

		direction = !!(dep->flags & DWC3_EP0_DIR_IN);

		if (dwc->ep0state == EP0_STATUS_PHASE) {
			type = dwc->three_stage_setup
				? DWC3_TRBCTL_CONTROL_STATUS3
				: DWC3_TRBCTL_CONTROL_STATUS2;
		} else if (dwc->ep0state == EP0_DATA_PHASE) {
			type = DWC3_TRBCTL_CONTROL_DATA;
		} else {
			/* should never happen */
			WARN_ON(1);
		if (dwc->ep0state != EP0_DATA_PHASE) {
			dev_WARN(dwc->dev, "Unexpected pending request\n");
			return 0;
		}

		ret = dwc3_ep0_start_trans(dwc, direction,
				req->request.dma, req->request.length, type);
				req->request.dma, req->request.length,
				DWC3_TRBCTL_CONTROL_DATA);
		dep->flags &= ~(DWC3_EP_PENDING_REQUEST |
				DWC3_EP0_DIR_IN);
	} else if (dwc->delayed_status) {
+1 −1
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ void dwc3_unmap_buffer_from_dma(struct dwc3_request *req)
	if (req->request.num_mapped_sgs) {
		req->request.dma = DMA_ADDR_INVALID;
		dma_unmap_sg(dwc->dev, req->request.sg,
				req->request.num_sgs,
				req->request.num_mapped_sgs,
				req->direction ? DMA_TO_DEVICE
				: DMA_FROM_DEVICE);

+3 −4
Original line number Diff line number Diff line
@@ -175,13 +175,12 @@ ep_found:
	_ep->comp_desc = comp_desc;
	if (g->speed == USB_SPEED_SUPER) {
		switch (usb_endpoint_type(_ep->desc)) {
		case USB_ENDPOINT_XFER_BULK:
		case USB_ENDPOINT_XFER_INT:
			_ep->maxburst = comp_desc->bMaxBurst;
			break;
		case USB_ENDPOINT_XFER_ISOC:
			/* mult: bits 1:0 of bmAttributes */
			_ep->mult = comp_desc->bmAttributes & 0x3;
		case USB_ENDPOINT_XFER_BULK:
		case USB_ENDPOINT_XFER_INT:
			_ep->maxburst = comp_desc->bMaxBurst;
			break;
		default:
			/* Do nothing for control endpoints */
+1 −1
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ ep_matches (
	 * descriptor and see if the EP matches it
	 */
	if (usb_endpoint_xfer_bulk(desc)) {
		if (ep_comp) {
		if (ep_comp && gadget->max_speed >= USB_SPEED_SUPER) {
			num_req_streams = ep_comp->bmAttributes & 0x1f;
			if (num_req_streams > ep->max_streams)
				return 0;
Loading