<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/usb/core/urb.c, branch linux-3.13.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.13.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.13.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2013-10-11T23:33:58Z</updated>
<entry>
<title>usb-anchor: Delay usb_wait_anchor_empty_timeout wake up till completion is done</title>
<updated>2013-10-11T23:33:58Z</updated>
<author>
<name>Hans de Goede</name>
</author>
<published>2013-10-09T15:01:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6ec4147e7bdbde168f5bce30de5984aa4f971b22'/>
<id>urn:sha1:6ec4147e7bdbde168f5bce30de5984aa4f971b22</id>
<content type='text'>
usb_wait_anchor_empty_timeout() should wait till the completion handler
has run. Both the zd1211rw driver and the uas driver (in its task mgmt) depend
on the completion handler having completed when usb_wait_anchor_empty_timeout()
returns, as they read state set by the completion handler after an
usb_wait_anchor_empty_timeout() call.

But __usb_hcd_giveback_urb() calls usb_unanchor_urb before calling the
completion handler. This is necessary as the completion handler may
re-submit and re-anchor the urb. But this introduces a race where the state
these drivers want to read has not been set yet by the completion handler
(this race is easily triggered with the uas task mgmt code).

I've considered adding an anchor_count to struct urb, which would be
incremented on anchor and decremented on unanchor, and then only actually
do the anchor / unanchor on 0 -&gt; 1 and 1 -&gt; 0 transtions, combined with
moving the unanchor call in hcd_giveback_urb to after calling the completion
handler. But this will only work if urb's are only re-anchored to the same
anchor as they were anchored to before the completion handler ran.

And at least one driver re-anchors to another anchor from the completion
handler (rtlwifi).

So I have come up with this patch instead, which adds the ability to
suspend wakeups of usb_wait_anchor_empty_timeout() waiters to the usb_anchor
functionality, and uses this in __usb_hcd_giveback_urb() to delay wake-ups
until the completion handler has run.

Signed-off-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
Acked-by: Oliver Neukum &lt;oliver@neukum.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: introduce usb_device_no_sg_constraint() helper</title>
<updated>2013-08-12T18:56:16Z</updated>
<author>
<name>Ming Lei</name>
</author>
<published>2013-08-08T13:48:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bcc48f1a7a0d40ae2e5a26aff72c2b674fd8b596'/>
<id>urn:sha1:bcc48f1a7a0d40ae2e5a26aff72c2b674fd8b596</id>
<content type='text'>
Some host controllers(such as xHCI) can support building
packet from discontinuous buffers, so introduce one flag
and helper for this kind of host controllers, then the
feature can help some applications(such as usbnet) by
supporting arbitrary length of sg buffers.

Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Signed-off-by: Ming Lei &lt;ming.lei@canonical.com&gt;
Reviewed-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: fix some scripts/kernel-doc warnings</title>
<updated>2013-08-03T03:30:14Z</updated>
<author>
<name>Yacine Belkadi</name>
</author>
<published>2013-08-02T18:10:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=626f090c5cbbe557379978c7a9525011ad7fbbf6'/>
<id>urn:sha1:626f090c5cbbe557379978c7a9525011ad7fbbf6</id>
<content type='text'>
When building the htmldocs (in verbose mode), scripts/kernel-doc reports the
following type of warnings:

Warning(drivers/usb/core/usb.c:76): No description found for return value of
'usb_find_alt_setting'

Fix them by:
- adding some missing descriptions of return values
- using "Return" sections for those descriptions

Signed-off-by: Yacine Belkadi &lt;yacine.belkadi.1@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: check sg buffer size in usb_submit_urb</title>
<updated>2013-07-24T22:52:43Z</updated>
<author>
<name>Ming Lei</name>
</author>
<published>2013-06-28T01:38:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=10e232c597ac757e7f8600649f7e872e86de190f'/>
<id>urn:sha1:10e232c597ac757e7f8600649f7e872e86de190f</id>
<content type='text'>
USB spec stats that short packet can only appear at the end
of transfer. Because lost of HC(EHCI/UHCI/OHCI/...) can't
build a full packet from discontinuous buffers, we introduce
the limit in usb_submit_urb() to avoid such kind of bad sg buffers
coming from driver.

The limit might be a bit strict:
	- platform has iommu to do sg list mapping
	- some host controllers may support to build full packet from
	discontinuous buffers.

But considered that most of HCs don't support that, and driver
need work well or keep consistent on different HCs and ARCHs, we
have to introduce the limit.

Currently, only usbtest is reported to pass such sg buffers to HC,
and other users(mass storage, usbfs) don't have the problem.

We don't check it on USB wireless device, because:
	- wireless devices can't be attached to common USB
	  bus(EHCI/UHCI/OHCI/...)
	- the max packet size of endpoint may be odd, and often can't
	devide 4KB which is a typical usage in usb mass storage application

Reported-by: Konstantin Filatov &lt;kfilatov@parallels.com&gt;
Reported-by: Denis V. Lunev &lt;den@openvz.org&gt;
Cc: Felipe Balbi &lt;balbi@ti.com&gt;
Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Signed-off-by: Ming Lei &lt;ming.lei@canonical.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: fix urb-poison imbalance</title>
<updated>2013-03-25T20:48:27Z</updated>
<author>
<name>Johan Hovold</name>
</author>
<published>2013-03-21T11:36:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=68a2bed130a10cffbf68620f41d08a900b1d776b'/>
<id>urn:sha1:68a2bed130a10cffbf68620f41d08a900b1d776b</id>
<content type='text'>
The calls to usb_poison_urb and usb_unpoison_urb are expected to be
balanced. However, if an urb that has not yet been submitted is
poisoned, its reject counter will not be increased as its ep-field is
NULL. A consecutive call to unpoison will thus in fact poison the urb
as its reject counter will be decremented to a negative value,
effectively preventing the urb from being submitted.

Note that there are currently no in-kernel drivers affected by this.

Cc: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Signed-off-by: Johan Hovold &lt;jhovold@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: report submission of active URBs</title>
<updated>2012-11-12T02:10:46Z</updated>
<author>
<name>Alan Stern</name>
</author>
<published>2012-11-07T21:35:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2f02bc8af3abb846823811af65ec6cc46a4d525d'/>
<id>urn:sha1:2f02bc8af3abb846823811af65ec6cc46a4d525d</id>
<content type='text'>
This patch (as1633) changes slightly the way usbcore handled
submissions of URBs that are already active.  It will now return
-EBUSY rather than -EINVAL, and it will call WARN_ONCE to draw
people's attention to the bug.

Signed-off-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: update documentation for URB_ISO_ASAP</title>
<updated>2012-10-22T18:10:24Z</updated>
<author>
<name>Alan Stern</name>
</author>
<published>2012-10-01T14:31:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a03bede5c73a6876fa891cfe82a65460dc9f4698'/>
<id>urn:sha1:a03bede5c73a6876fa891cfe82a65460dc9f4698</id>
<content type='text'>
This patch (as1611) updates the USB documentation and kerneldoc to
give a more precise meaning for the URB_ISO_ASAP flag and to explain
more of the details of scheduling for isochronous URBs.

Signed-off-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usbhid: prevent deadlock during timeout</title>
<updated>2012-05-01T17:22:13Z</updated>
<author>
<name>Oliver Neukum</name>
</author>
<published>2012-04-30T07:13:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8815bb09af21316aeb5f8948b24ac62181670db2'/>
<id>urn:sha1:8815bb09af21316aeb5f8948b24ac62181670db2</id>
<content type='text'>
On some HCDs usb_unlink_urb() can directly call the
completion handler. That limits the spinlocks that can
be taken in the handler to locks not held while calling
usb_unlink_urb()
To prevent a race with resubmission, this patch exposes
usbcore's infrastructure for blocking submission, uses it
and so drops the lock without causing a race in usbhid.

Signed-off-by: Oliver Neukum &lt;oneukum@suse.de&gt;
Acked-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
Cc: stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB documentation: explain lifetime rules for unlinking URBs</title>
<updated>2012-04-06T20:54:00Z</updated>
<author>
<name>Alan Stern</name>
</author>
<published>2012-03-28T20:13:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=da8bfb090c2b30af9f3879443355f7eb1d0fe10a'/>
<id>urn:sha1:da8bfb090c2b30af9f3879443355f7eb1d0fe10a</id>
<content type='text'>
This patch (as1534c) updates the documentation for usb_unlink_urb and
related functions.  It explains that the caller must prevent the URB
being unlinked from getting deallocated while the unlink is taking
place.

Signed-off-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
CC: Ming Lei &lt;tom.leiming@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb/core: remove "always" from usb_unlink_urb() kernel doc entry</title>
<updated>2012-03-03T00:22:11Z</updated>
<author>
<name>Sebastian Andrzej Siewior</name>
</author>
<published>2012-02-29T22:04:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=371f3b49f2cb1a8b6ac09b6b108841ca92349eb1'/>
<id>urn:sha1:371f3b49f2cb1a8b6ac09b6b108841ca92349eb1</id>
<content type='text'>
The kernel doc entry for usb_unlink_urb() contains the phrase "This
request is always asynchronous.". The "always" leads to the assumption
that the -&gt;complete() callback is not called from within
usb_unlink_urb(). This is not true. The HCD is allowed to call the
-&gt;complete() from within -&gt;urb_dequeue() if it is appropriate for the
hardware.
This patch updates the kernel doc so usb-device driver authors make sure
to drop all locks (and make sure it is okay to drop them) which are
acquired by the complete callback before calling usb_unlink_urb().

Signed-off-by: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
