Tasklets have long been deprecated as being too heavy on the system
by running in irq context - and this is not a performance critical
path. If a higher priority process wants to run, it must wait for
the tasklet to finish before doing so.
c67x00_do_work() will now run in process context and have further
concurrency (tasklets being serialized among themselves), but this
is done holding the c67x00->lock, so it should be fine. Furthermore,
this patch fixes the usage of the lock in the callback as otherwise
it would need to be irq-safe.
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Link: https://lore.kernel.org/r/20210113031537.79859-1-dave@stgolabs.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-----BEGIN PGP SIGNATURE-----
iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAl9ML+IeHHRvcnZhbGRz
QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGA8EIAIy/kTbFS0yrE9yV
hb98oX0z9+EU9YQg9vhaRWwPd+rJF/JMQZLqYcwbhjG9abaUL3T3fEcSAefMHw8E
LAt+hYzA38dHt7tqhsFQX3vV1VorvDVICBVN0yRPRWKKikq4OPIHzaAR9tleGAF5
8btQisl1PjN+obwYmLuNb6aX16OCwAF+uXOwehcoJs9dvMNhwtXRzfOflWzOvOo6
tE0bHErlylLDfLv4ZzEfczTdks4QJZ7C0xLSf3oN9AAynW42Xnhct4hi8qZY/hCf
CMaqeN4hdpub6TvQIqBdDqMMjEXGFgeNSnAEBQY9VpvUqz8NTu6sQxwgJEKDF5tg
d81lv2c=
=uW/F
-----END PGP SIGNATURE-----
Merge 5.9-rc3 into usb-next
We want the USB fixes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.
Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
Link: https://lore.kernel.org/r/20200817090209.26351-3-allen.cryptic@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-----BEGIN PGP SIGNATURE-----
iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAl8UzA4eHHRvcnZhbGRz
QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGQ7cH/3v+Gv+SmHJCvaT2
CSu0+7okVnYbY3UTb3hykk7/aOqb6284KjxR03r0CWFzsEsZVhC5pvvruASSiMQg
Pi04sLqv6CsGLHd1n+pl4AUYEaxq6k4KS3uU3HHSWxrahDDApQoRUx2F8lpOxyj8
RiwnoO60IMPA7IFJqzcZuFqsgdxqiiYvnzT461KX8Mrw6fyMXeR2KAj2NwMX8dZN
At21Sf8+LSoh6q2HnugfiUd/jR10XbfxIIx2lXgIinb15GXgWydEQVrDJ7cUV7ix
Jd0S+dtOtp+lWtFHDoyjjqqsMV7+G8i/rFNZoxSkyZqsUTaKzaR6JD3moSyoYZgG
0+eXO4A=
=9EpR
-----END PGP SIGNATURE-----
Merge 5.8-rc6 into usb-next
We need the USB fixes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
clang static analysis flags this error
c67x00-sched.c:489:55: warning: Use of memory after it is freed [unix.Malloc]
usb_hcd_giveback_urb(c67x00_hcd_to_hcd(c67x00), urb, urbp->status);
^~~~~~~~~~~~
Problem happens in this block of code
c67x00_release_urb(c67x00, urb);
usb_hcd_unlink_urb_from_ep(c67x00_hcd_to_hcd(c67x00), urb);
spin_unlock(&c67x00->lock);
usb_hcd_giveback_urb(c67x00_hcd_to_hcd(c67x00), urb, urbp->status);
In the call to c67x00_release_urb has this freeing of urbp
urbp = urb->hcpriv;
urb->hcpriv = NULL;
list_del(&urbp->hep_node);
kfree(urbp);
And so urbp is freed before usb_hcd_giveback_urb uses it as its 3rd
parameter.
Since all is required is the status, pass the status directly as is
done in c64x00_urb_dequeue
Fixes: e9b29ffc51 ("USB: add Cypress c67x00 OTG controller HCD driver")
Signed-off-by: Tom Rix <trix@redhat.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200708131243.24336-1-trix@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
No attempt has been made to document any of the functions here.
Fixes the following W=1 kernel build warning(s):
drivers/usb/c67x00/c67x00-sched.c:35: warning: Function parameter or member 'queue' not described in 'c67x00_ep_data'
drivers/usb/c67x00/c67x00-sched.c:35: warning: Function parameter or member 'node' not described in 'c67x00_ep_data'
drivers/usb/c67x00/c67x00-sched.c:35: warning: Function parameter or member 'hep' not described in 'c67x00_ep_data'
drivers/usb/c67x00/c67x00-sched.c:35: warning: Function parameter or member 'dev' not described in 'c67x00_ep_data'
drivers/usb/c67x00/c67x00-sched.c:35: warning: Function parameter or member 'next_frame' not described in 'c67x00_ep_data'
drivers/usb/c67x00/c67x00-sched.c:71: warning: Function parameter or member 'ly_base_addr' not described in 'c67x00_td'
drivers/usb/c67x00/c67x00-sched.c:71: warning: Function parameter or member 'port_length' not described in 'c67x00_td'
drivers/usb/c67x00/c67x00-sched.c:71: warning: Function parameter or member 'pid_ep' not described in 'c67x00_td'
drivers/usb/c67x00/c67x00-sched.c:71: warning: Function parameter or member 'dev_addr' not described in 'c67x00_td'
drivers/usb/c67x00/c67x00-sched.c:71: warning: Function parameter or member 'ctrl_reg' not described in 'c67x00_td'
drivers/usb/c67x00/c67x00-sched.c:71: warning: Function parameter or member 'status' not described in 'c67x00_td'
drivers/usb/c67x00/c67x00-sched.c:71: warning: Function parameter or member 'retry_cnt' not described in 'c67x00_td'
drivers/usb/c67x00/c67x00-sched.c:71: warning: Function parameter or member 'residue' not described in 'c67x00_td'
drivers/usb/c67x00/c67x00-sched.c:71: warning: Function parameter or member 'next_td_addr' not described in 'c67x00_td'
drivers/usb/c67x00/c67x00-sched.c:71: warning: Function parameter or member 'td_list' not described in 'c67x00_td'
drivers/usb/c67x00/c67x00-sched.c:71: warning: Function parameter or member 'td_addr' not described in 'c67x00_td'
drivers/usb/c67x00/c67x00-sched.c:71: warning: Function parameter or member 'data' not described in 'c67x00_td'
drivers/usb/c67x00/c67x00-sched.c:71: warning: Function parameter or member 'urb' not described in 'c67x00_td'
drivers/usb/c67x00/c67x00-sched.c:71: warning: Function parameter or member 'privdata' not described in 'c67x00_td'
drivers/usb/c67x00/c67x00-sched.c:71: warning: Function parameter or member 'ep_data' not described in 'c67x00_td'
drivers/usb/c67x00/c67x00-sched.c:71: warning: Function parameter or member 'pipe' not described in 'c67x00_td'
drivers/usb/c67x00/c67x00-sched.c:137: warning: Function parameter or member 'c67x00' not described in 'dbg_td'
drivers/usb/c67x00/c67x00-sched.c:137: warning: Function parameter or member 'td' not described in 'dbg_td'
drivers/usb/c67x00/c67x00-sched.c:137: warning: Function parameter or member 'msg' not described in 'dbg_td'
drivers/usb/c67x00/c67x00-sched.c:169: warning: Function parameter or member 'a' not described in 'frame_add'
drivers/usb/c67x00/c67x00-sched.c:169: warning: Function parameter or member 'b' not described in 'frame_add'
drivers/usb/c67x00/c67x00-sched.c:177: warning: Function parameter or member 'a' not described in 'frame_after'
drivers/usb/c67x00/c67x00-sched.c:177: warning: Function parameter or member 'b' not described in 'frame_after'
drivers/usb/c67x00/c67x00-sched.c:186: warning: Function parameter or member 'a' not described in 'frame_after_eq'
drivers/usb/c67x00/c67x00-sched.c:186: warning: Function parameter or member 'b' not described in 'frame_after_eq'
drivers/usb/c67x00/c67x00-sched.c:199: warning: Function parameter or member 'c67x00' not described in 'c67x00_release_urb'
drivers/usb/c67x00/c67x00-sched.c:199: warning: Function parameter or member 'urb' not described in 'c67x00_release_urb'
drivers/usb/c67x00/c67x00-sched.c:566: warning: Function parameter or member 'c67x00' not described in 'c67x00_create_td'
drivers/usb/c67x00/c67x00-sched.c:566: warning: Function parameter or member 'urb' not described in 'c67x00_create_td'
drivers/usb/c67x00/c67x00-sched.c:566: warning: Function parameter or member 'data' not described in 'c67x00_create_td'
drivers/usb/c67x00/c67x00-sched.c:566: warning: Function parameter or member 'len' not described in 'c67x00_create_td'
drivers/usb/c67x00/c67x00-sched.c:566: warning: Function parameter or member 'pid' not described in 'c67x00_create_td'
drivers/usb/c67x00/c67x00-sched.c:566: warning: Function parameter or member 'toggle' not described in 'c67x00_create_td'
drivers/usb/c67x00/c67x00-sched.c:566: warning: Function parameter or member 'privdata' not described in 'c67x00_create_td'
drivers/usb/c67x00/c67x00-sched.c:692: warning: Function parameter or member 'c67x00' not described in 'c67x00_add_ctrl_urb'
drivers/usb/c67x00/c67x00-sched.c:692: warning: Function parameter or member 'urb' not described in 'c67x00_add_ctrl_urb'
drivers/usb/c67x00/c67x00-sched.c:830: warning: Function parameter or member 'c67x00' not described in 'c67x00_parse_td'
drivers/usb/c67x00/c67x00-sched.c:830: warning: Function parameter or member 'td' not described in 'c67x00_parse_td'
drivers/usb/c67x00/c67x00-sched.c:978: warning: Function parameter or member 'c67x00' not described in 'c67x00_check_td_list'
drivers/usb/c67x00/c67x00-sched.c:1052: warning: Function parameter or member 'c67x00' not described in 'c67x00_send_td'
drivers/usb/c67x00/c67x00-sched.c:1052: warning: Function parameter or member 'td' not described in 'c67x00_send_td'
drivers/usb/c67x00/c67x00-sched.c:1088: warning: Function parameter or member 'c67x00' not described in 'c67x00_do_work'
Cc: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20200702144625.2533530-31-lee.jones@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Now that the SPDX tag is in all USB files, that identifies the license
in a specific and legally-defined manner. So the extra GPL text wording
can be removed as it is no longer needed at all.
This is done on a quest to remove the 700+ different ways that files in
the kernel describe the GPL license text. And there's unneeded stuff
like the address (sometimes incorrect) for the FSF which is never
needed.
No copyright headers or other non-license-description text was removed.
Cc: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
It's good to have SPDX identifiers in all files to make it easier to
audit the kernel tree for correct licenses.
Update the drivers/usb/ and include/linux/usb* files with the correct
SPDX license identifier based on the license text in the file itself.
The SPDX identifier is a legally binding shorthand, which can be used
instead of the full boiler plate text.
This work is based on a script and data from Thomas Gleixner, Philippe
Ombredanne, and Kate Stewart.
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Acked-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Pointer urbp is assigned but is never read, hence it is redundant
and can be removed. Cleans up clang warning:
drivers/usb/c67x00/c67x00-sched.c:975:2: warning: Value stored to 'urbp'
is never read
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This removes the usage of CONFIG_USB_DEBUG in the c67x00 driver. There
was only one place, where the TD was dumped to the kernel log, and that
was using the dynamic debug infrastructure already, with the exception
of the call to print_hex_dump(). So move everything to the dynamic
debug infrastructure, including one odd printk(KERN_DEBUG...) line that
looks like it was forgotten about a long time ago.
Acked-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Use this new function to make code more comprehensible, since we are
reinitialzing the completion, not initializing.
[akpm@linux-foundation.org: linux-next resyncs]
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org> (personally at LCE13)
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
RetryCnt value in c67x00 TD should be 3 (both bits set to 1). Reference
Cypress Semiconductor BIOS User's Manual 1.2, page 3-14
Signed-off-by: Dave Tubbs <dave.tubbs@portalislc.com>
Acked-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
This patch adds HCD support for the Cypress c67x00 family of devices.
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>