Commit graph

2920 commits

Author SHA1 Message Date
Boris Brezillon 9aa0216550 usb: gadget: at91_udc: Drop uclk clock
Now that at91 system clocks forward set_rate request to their parent we
can remove the uclk clock and directly call clk_set_rate on fclk.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
2015-01-15 14:35:13 +01:00
Boris Brezillon 7923540385 usb: gadget: at91_udc: Fix clock names
The driver is requesting clock by their global name (those declared in the
clk_lookup list), but this only works with !CCF kernels.

Now that all SoCs have moved to CCF, fix the driver to use local names
(hclk and pclk).

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
2015-01-15 14:35:13 +01:00
Greg Kroah-Hartman 06087cb42d usb: fixes for v3.19-rc5
Just three fixes this time. An oops fix in ep_write() from gadgetfs,
 another oops for the Atmel UDC when unloading a gadget driver and
 the fix for PHY deferred probing.
 
 Signed-off-by: Felipe Balbi <balbi@ti.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJUtAxnAAoJEIaOsuA1yqRErBcP/RzyenZEkuw8A6nNbGHmAi8p
 eYYRPfWDdVLFyouvDcSevz2YR6PTviRfuTUu45yFlMLPQLOY00IQtwy4F+DTCB3A
 Ce0QUVFTvzvXbyHteG5VaYIWvDtJQnXrhTjv8XVsvW/UXtbzCE0RWWtNGbKsvCv8
 WRj/nFqymkCYhB1qqy/2b8Kdp1k8e/m1RzvaNusBaWzu73ejExme338tx6vfepQi
 MSjguviCAybSgbbZbvDGfd0D1LVDnrS78gLGm/JGGU1M+mcOnv3EGY00bgnlCB9o
 ydNIL+UkQTNTi6qrJQxNomwKexF9QkCrrKazMLA8lunTIt7yYuvxes01DZuLrSuN
 4vXjMlyiDFjtu7tA4Fe/k1rCPwRmpKQlr2uqcMcExcSeDJ7zwsUNYsFyzDnk1JMx
 nPmcuyCkP/S8QNY6w4LqcTb++cTKdH5A73nVoVHaPA5DUEAcmyMFdwm8N/R9V+PX
 yvzpPwAtkLeJPkjJwt0Bg6jcJ+FfNAfnXXrIHxFYXcKnud2VmqYtSJNMhrwdbdAh
 WG/jsdCtRJFAoMZzNEEPzFwQU+UW0c9ux9+jhzKFV1ognzqQALlREc5dGK2qoxDt
 5yWXqD6EymsWMLKo6vuYmIzoR5WXzIdzjgSvTJQNqEafCUMBAhIRKUxq4IVoX95d
 mwxe5ePPjww1tIM+8fjs
 =7Fj7
 -----END PGP SIGNATURE-----

Merge tag 'fixes-for-v3.19-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus

Felipe writes:

usb: fixes for v3.19-rc5

Just three fixes this time. An oops fix in ep_write() from gadgetfs,
another oops for the Atmel UDC when unloading a gadget driver and
the fix for PHY deferred probing.

Signed-off-by: Felipe Balbi <balbi@ti.com>

Conflicts:
	drivers/usb/phy/phy.c
2015-01-12 10:51:04 -08:00
Peter Chen 487d60cc09 usb: gadget: mv_udc_core: delete pullup operation at .udc_start
UDC core has already done it after .udc_start.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:24:29 -06:00
Peter Chen 14d19d9f05 usb: gadget: pxa27x_udc: delete pullup operation at .udc_start and .udc_stop
UDC core has already done it before .udc_stop and after .udc_start.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:24:22 -06:00
Peter Chen 42c1ecff0e usb: gadget: pxa27x_udc: delete pullup operation at .udc_start and .udc_stop
UDC core has already done it before .udc_stop and after .udc_start.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:24:15 -06:00
Michal Nazarewicz 67913bbd0b usb: gadget: f_fs: refactor and document __ffs_ep0_read_events better
Instead of using variable length array, use a static length equal to
the size of the ffs->ev.types array.  This gets rid of a sparse warning:

	drivers/usb/gadget/function/f_fs.c:401:44: warning:
	Variable length array is used.

and makes it more explicit that the array has a very tight upper size
limit.  Also add some more documentation about the ev.types array and
how its size is limited and affects the rest of the code.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reported-by: Rohith Seelaboyina <rseelaboyina@nvidia.com>
Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:29 -06:00
Boris Brezillon e3a912a124 usb: gadget: atmel_usba: Cache INT_ENB register value
Cache INT_ENB register value in order to avoid uncached iomem access, and
thus improve access time to INT_ENB value.

Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:29 -06:00
Boris Brezillon 9870d895ad usb: atmel_usba_udc: Mask status with enabled irqs
Avoid interpreting useless status flags when we're not waiting for such
events by masking the status variable with the interrupt enabled register
value.

Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Reported-by: Patrice VILCHEZ <patrice.vilchez@atmel.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:29 -06:00
Boris Brezillon 258e2ddd63 usb: atmel_usba_udc: Add at91sam9g45 and at91sam9x5 errata handling
at91sam9g45 and at91sam9x5 SoCs have an hardware bug forcing us to
generate a pulse on the BIAS signal on "USB end of reset” and
“USB end of resume" events.

Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Reported-by: Patrice VILCHEZ <patrice.vilchez@atmel.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:29 -06:00
Boris Brezillon 3280e67536 usb: atmel_usba_udc: Rework at91sam9rl errata handling
at91sam9rl SoC has an erratum forcing us to toggle the BIAS on USB
suspend/resume events.

This specific handling is only activated when CONFIG_ARCH_AT91SAM9RL is
set and this option is only set when building a non-DT kernel, which is
problematic since non-DT support for at91sam9rl SoC has been removed.

Rework the toggle_bias implementation to attach it to the "at91sam9rl-udc"
compatible string.

Add new compatible strings to avoid executing at91sam9rl erratum handling
on other SoCs.

Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:29 -06:00
Ricardo Ribalda Delgado cb442ee159 usb: gadget: udc: net2280: Re-enable dynamic debug messages
Some debug messages were not build due to unconditional #if 0.

These messages are very useful for debugging and the user can enable
them on demand via dynamic debug.

If they are not enabled the performance is not affected.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:28 -06:00
Ricardo Ribalda Delgado d82f3db266 usb: gadget: udc: net2280: Move ASSERT_OUT_NAKING into out_flush
ASSERT_OUT_NAKING was only called by out_flush and was hidden behind a
ifdef.

This patch moves the inline function into out_flush and remove the
ifdef. The user can decide to print the debug message or not via dynamic
printk

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:28 -06:00
Ricardo Ribalda Delgado 43780aaa1c usb: gadget: udc: net2280: Simplify scan_dma_completions
After fix superspeed dma_done was applied we can simplify the code by
removing the duplicated dma_done and letting the function check if there
are more completed dma transactions.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:28 -06:00
Ricardo Ribalda Delgado 6897d4b2ba usb: gadget: udc: net2280: Declare allow_status_338x as inline
The function is very simple, does not declare any variable and it is
called in the irq path.

The counterpart for net228x is already declared as inline.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:28 -06:00
Ricardo Ribalda Delgado 5153c219e7 usb: gadget: udc: net2280: Remove function resume_dma
Function resume_dma is not used, remove it.

The reason the compiler did not catch this dead code is the inline
modifier.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:28 -06:00
Ricardo Ribalda Delgado 5517525e05 usb: gadget: udc: net2280: Improve patching of defect 7374
Once the defect 7374 is patched, there is no reason the keep reading the
idx scratch register.

Cache the content of the scratch idx register on device flag.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:28 -06:00
Ricardo Ribalda Delgado 485f44d06b usb: gadget: udc: net2280: Clean function net2280_queue
Do not duplicate the code for the else branch of the condition.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:28 -06:00
Ricardo Ribalda Delgado e721c4575d usb: gadget: udc: net2280: Merge abort_dma for 228x and 338x
We can use the same function for both families of chips and also remove
the ep_stop_dma() function.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:28 -06:00
Ricardo Ribalda Delgado e0cbb04627 usb: gadget: udc: net2280: Remove function ep_stall
irqs_superspeed calls ep_stall instead of set/clear_halt, due to a
workaround for SS seqnum. Create a function with the workaround and
call set/clear_halt instead.

This way we can compare the code of super/normal speed and it is easier
to follow the code.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:27 -06:00
Ricardo Ribalda Delgado 5d1b6840fd usb: gadget: udc: net2280: Remove field is_halt
Field is_halt is never used by any function.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:27 -06:00
Ricardo Ribalda Delgado cf8b1cdeba usb: gadget: udc: net2280: Code cleanout remove ep_stdrsp function
ep_stdrsp was only called by handle_stat0_irqs_superspeed and with
always the same flags.

Remove the function and replace the call by the code inside the
function, since it is very simple once the dead code is removed.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:27 -06:00
Ricardo Ribalda Delgado 61e72dc65a usb: gadget: udc: net2280: Remove restart_dma inline function definition
restart_dma is not used before it is declaration. Therefore we can
remove this definition.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:27 -06:00
Ricardo Ribalda Delgado cb52c698c6 usb: gadget: udc: net2280: Remove dma_started field
Remove dma_started field from net2280_ep structure, since it is not used
by any function.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:27 -06:00
Ricardo Ribalda Delgado d588ff58c2 usb: gadget: udc: net2280: Remove use_dma module parameter
use_dma parameter was designed to enable the dma on the chip. It was
enabled by default.

It comes from the time when the dma was not reliable. Now it has been
working ok in production.

This patch removes this parameter.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:27 -06:00
Ricardo Ribalda Delgado 9c864c2342 usb: gadget: udc: net2280: Remove module parameter use_msi
Parameter use_msi was used to enable msi irq on usb338x chips, it was
enabled by default.

There is no reason to prefer non-msi irq on usb338x, and it falls back
to non msi on error.

Therefore remove this option.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:27 -06:00
Ricardo Ribalda Delgado 7a74c48172 usb: gadget: udc: net2280: remove full_speed module parameter
This patch removes the full_speed parameter used force full-speed
operation.

It was designed exclusively for testing purposes, and there is no
reason to maintain this in a production kernel.

Reverts: 2f07607747
Suggested-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:27 -06:00
Ricardo Ribalda Delgado 906641980c usb: gadget: udc: net2280: Remove obsolete module param use_dma_chaining
use_dma_chaining module parameter was designed to avoid creating one irq
per package on a group of packages (with the help of the driver's flag
no_interrupt).

Unfortunately, when this parameter is enabled, the driver fails to work
on both net2280 and 3380 chips.

This patch removes this parameter, which was disabled by default.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:27 -06:00
Nicholas Mc Guire 9f56ce075d usb: gadget: cleanup on stack DECLARE_COMPLETIONs
fixups for incorrect use of DECLARE_COMPLETION. see also commit
6e9a4738 ("completions: lockdep annotate on stack completions")

patch is against 3.18.0 linux-next

This was only code reviewed and compile tested

Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:27 -06:00
Xuebing Wang 8d252db174 usb: gadget: f_uac1: update Class-Specific AudioControl Interface Header Descriptor
Update this according to USB Audio Class 1.0 spec. This fixes the Windows 7
detection issue.

Cc: Rafael Brune <mail@rbrune.de>
Signed-off-by: Xuebing Wang <xbing6@gmail.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
(Fixed some code style issues)
Tested-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:27 -06:00
Xuebing Wang 625763d101 usb: gadget: f_uac1: configure endpoint before using it
UAC1 forget to do it.

Signed-off-by: Xuebing Wang <xbing6@gmail.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:26 -06:00
Julia Lawall 90f9e53345 usb: gadget: fix platform_no_drv_owner.cocci warnings
Remove .owner field if calls are used which set it automatically

Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:26 -06:00
Dan Carpenter d71b0d7764 usb: gadget: udc: remove bogus NULL check
"ep" isn't NULL here, and static checkers complain because we
dereferenced it on the previous line.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:26 -06:00
Dan Carpenter 5e841efef7 usb: gadget: udc: clean up a printk
We already know what "value" is, so there is no need to check.  It
puzzles static checkers to have the unneeded condition.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:26 -06:00
Andrzej Pietrasiewicz 46919a23ee usb: gadget: uvc: configfs support in uvc function
Add support for using the uvc function as a component of USB gadgets composed
with configfs.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:26 -06:00
Andrzej Pietrasiewicz 6c25955ed6 usb: gadget: uvc: verify descriptors presence
If the caller of uvc_alloc() does not provide enough
descriptors, binding the function should fail, so appropriate
code is returned from uvc_copy_descriptors().

uvc_function_bind() is modified accordingly to account for possible
errors from uvc_copy_descriptors().

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:26 -06:00
Andrzej Pietrasiewicz bbea6de1bd usb: gadget: f_uvc: rename a macro to avoid conflicts
When configfs is integrated, CONFIGFS_ATTR_STRUCT and CONFIGFS_ATTR_OPS
macros should be used, but the latter expects that tere is a to_f_uvc_opts
function accepting a config_item, whereas the macro being changed
can be applied to a different type of argument.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:26 -06:00
Andrzej Pietrasiewicz 39a2ac2738 usb: gadget: hid: consistently use 2^n - 1 for max values
A maximum value which fits in 16 bits, unsigned, is 65535.

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:26 -06:00
Rickard Strandqvist d16cd0b8f7 usb: gadget: udc: s3c2410_udc.c: Remove some unused functions
Removes some functions that are not used anywhere:
s3c2410_udc_clear_ep_state() s3c2410_udc_set_ep0_sse_out()

This was partially found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:24 -06:00
Songjun Wu 5fb694f96e usb: gadget: udc: atmel: fix possible oops when unloading module
When unloading the module 'g_hid.ko', the urb request will be dequeued and the
completion routine will be excuted. If there is no urb packet, the urb request
will not be added to the endpoint queue and the completion routine pointer in
urb request is NULL.

Accessing to this NULL function pointer will cause the Oops issue reported
below.

Add the code to check if the urb request is in the endpoint queue
or not. If the urb request is not in the endpoint queue, a negative
error code will be returned.

Here is the Oops log:

Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = dedf0000
[00000000] *pgd=3ede5831, *pte=00000000, *ppte=00000000
Internal error: Oops: 80000007 [#1] ARM
Modules linked in: g_hid(-) usb_f_hid libcomposite
CPU: 0 PID: 923 Comm: rmmod Not tainted 3.18.0+ #2
Hardware name: Atmel SAMA5 (Device Tree)
task: df6b1100 ti: dedf6000 task.ti: dedf6000
PC is at 0x0
LR is at usb_gadget_giveback_request+0xc/0x10
pc : [<00000000>]    lr : [<c02ace88>]    psr: 60000093
sp : dedf7eb0  ip : df572634  fp : 00000000
r10: 00000000  r9 : df52e210  r8 : 60000013
r7 : df6a9858  r6 : df52e210  r5 : df6a9858  r4 : df572600
r3 : 00000000  r2 : ffffff98  r1 : df572600  r0 : df6a9868
Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 10c53c7d  Table: 3edf0059  DAC: 00000015
Process rmmod (pid: 923, stack limit = 0xdedf6230)
Stack: (0xdedf7eb0 to 0xdedf8000)
7ea0:                                     00000000 c02adbbc df572580 deced608
7ec0: df572600 df6a9868 df572634 c02aed3c df577c00 c01b8608 00000000 df6be27c
7ee0: 00200200 00100100 bf0162f4 c000e544 dedf6000 00000000 00000000 bf010c00
7f00: bf0162cc bf00159c 00000000 df572980 df52e218 00000001 df5729b8 bf0031d0
[..]
[<c02ace88>] (usb_gadget_giveback_request) from [<c02adbbc>] (request_complete+0x64/0x88)
[<c02adbbc>] (request_complete) from [<c02aed3c>] (usba_ep_dequeue+0x70/0x128)
[<c02aed3c>] (usba_ep_dequeue) from [<bf010c00>] (hidg_unbind+0x50/0x7c [usb_f_hid])
[<bf010c00>] (hidg_unbind [usb_f_hid]) from [<bf00159c>] (remove_config.isra.6+0x98/0x9c [libcomposite])
[<bf00159c>] (remove_config.isra.6 [libcomposite]) from [<bf0031d0>] (__composite_unbind+0x34/0x98 [libcomposite])
[<bf0031d0>] (__composite_unbind [libcomposite]) from [<c02acee0>] (usb_gadget_remove_driver+0x50/0x78)
[<c02acee0>] (usb_gadget_remove_driver) from [<c02ad570>] (usb_gadget_unregister_driver+0x64/0x94)
[<c02ad570>] (usb_gadget_unregister_driver) from [<bf0160c0>] (hidg_cleanup+0x10/0x34 [g_hid])
[<bf0160c0>] (hidg_cleanup [g_hid]) from [<c0056748>] (SyS_delete_module+0x118/0x19c)
[<c0056748>] (SyS_delete_module) from [<c000e3c0>] (ret_fast_syscall+0x0/0x30)
Code: bad PC value

Signed-off-by: Songjun Wu <songjun.wu@atmel.com>
[nicolas.ferre@atmel.com: reworked the commit message]
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Fixes: 914a3f3b37 ("USB: add atmel_usba_udc driver")
Cc: <stable@vger.kernel.org> # 2.6.x-ish
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-09 18:15:11 -06:00
Dan Carpenter 42d6cfa0ca usb: gadget: gadgetfs: fix an oops in ep_write()
We try to free an ERR_PTR on this error path.

Fixes: b44be2462d ('usb: gadget: gadgetfs: Free memory allocated by memdup_user()')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-09 18:15:11 -06:00
John W. Linville f26d29e34e usb: gadget: udc: avoid dereference before NULL check in ep_queue
Coverity: CID 1260069

Signed-off-by: John W. Linville <linville@tuxdriver.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-09 10:01:46 -08:00
Christoph Jaeger 6341e62b21 kconfig: use bool instead of boolean for type definition attributes
Support for keyword 'boolean' will be dropped later on.

No functional change.

Reference: http://lkml.kernel.org/r/cover.1418003065.git.cj@linux.com
Signed-off-by: Christoph Jaeger <cj@linux.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-01-07 13:08:04 +01:00
Bo Shen 6785a10344 usb: gadget: udc: atmel: fix possible IN hang issue
When receive data, the RXRDY in status register set by hardware
after a new packet has been stored in the endpoint FIFO. When it
is copied from FIFO, this bit is cleared which make the FIFO can
be accessed again.

In the receive_data() function, this bit RXRDY has been cleared.
So, after the receive_data() function return, this bit should
not be cleared again, or else it may cause the accessing FIFO
corrupt, which will make the data loss.

Fixes: 914a3f3b37 (USB: add atmel_usba_udc driver)
Cc: <stable@vger.kernel.org> # 2.6.24+
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Bo Shen <voice.shen@atmel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-12-22 10:41:15 -06:00
Bo Shen f40afdddeb usb: gadget: udc: atmel: change setting for DMA
According to the datasheet, when transfer using DMA, the control
setting for IN packet only need END_BUF_EN, END_BUF_IE, CH_EN,
while for OUT packet, need more two bits END_TR_EN and END_TR_IE
to be configured.

Fixes: 914a3f3b37 (USB: add atmel_usba_udc driver)
Cc: <stable@vger.kernel.org> # 2.6.24+
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Bo Shen <voice.shen@atmel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-12-22 10:41:05 -06:00
Mario Schuknecht b44be2462d usb: gadget: gadgetfs: Free memory allocated by memdup_user()
Commit 3b74c73f8d switched over to memdup_user()
in ep_write() function and removed kfree (kbuf).
memdup_user() function allocates memory which is never freed.

Fixes: 3b74c73 (usb: gadget: inode: switch over to memdup_user())
Cc: <stable@vger.kernel.org> # v3.15+
Signed-off-by: Mario Schuknecht <mario.schuknecht@dresearch-fe.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-12-22 10:37:15 -06:00
Julia Lawall c9b3bde03b usb: gadget: fix misspelling of current function in string
Replace a misspelled function name by %s and then __func__.

This was done using Coccinelle, including the use of Levenshtein distance,
as proposed by Rasmus Villemoes.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-12-22 10:27:34 -06:00
Peter Chen 4fde6204df usb: gadget: f_uac1: access freed memory at f_audio_free_inst
At f_audio_free_inst, it tries to access struct gaudio *card which is
freed at f_audio_free, it causes below oops if the audio device is not
there (do unload module may trigger the same problem). The gaudio_cleanup
is related to function, so it is better move to f_audio_free.

root@freescale ~$ modprobe g_audio
[  751.968931] g_audio gadget: unable to open sound control device file: /dev/snd/controlC0
[  751.977134] g_audio gadget: we need at least one control device
[  751.988633] Unable to handle kernel paging request at virtual address 455f448e
[  751.995963] pgd = bd42c000
[  751.998681] [455f448e] *pgd=00000000
[  752.002383] Internal error: Oops: 5 [#1] SMP ARM
[  752.007008] Modules linked in: usb_f_uac1 g_audio(+) usb_f_mass_storage libcomposite configfs [last unloaded: g_mass_storage]
[  752.018427] CPU: 0 PID: 692 Comm: modprobe Not tainted 3.18.0-rc4-00345-g842f57b #10
[  752.026176] task: bdb3ba80 ti: bd41a000 task.ti: bd41a000
[  752.031590] PC is at filp_close+0xc/0x84
[  752.035530] LR is at gaudio_cleanup+0x28/0x54 [usb_f_uac1]
[  752.041023] pc : [<800ec94c>]    lr : [<7f03c63c>]    psr: 20000013
[  752.041023] sp : bd41bcc8  ip : bd41bce8  fp : bd41bce4
[  752.052504] r10: 7f036234  r9 : 7f036220  r8 : 7f036500
[  752.057732] r7 : bd456480  r6 : 7f036500  r5 : 7f03626c  r4 : bd441000
[  752.064264] r3 : 7f03b3dc  r2 : 7f03cab0  r1 : 00000000  r0 : 455f4456
[  752.070798] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[  752.077938] Control: 10c5387d  Table: bd42c04a  DAC: 00000015
[  752.083688] Process modprobe (pid: 692, stack limit = 0xbd41a240)
[  752.089786] Stack: (0xbd41bcc8 to 0xbd41c000)
[  752.094152] bcc0:                   7f03b3dc bd441000 7f03626c 7f036500 bd41bcfc bd41bce8
[  752.102337] bce0: 7f03c63c 800ec94c 7f03b3dc bdaa6b00 bd41bd14 bd41bd00 7f03b3f4 7f03c620
[  752.110521] bd00: 7f03b3dc 7f03cbd4 bd41bd2c bd41bd18 7f00f88c 7f03b3e8 00000000 fffffffe
[  752.118705] bd20: bd41bd5c bd41bd30 7f0380d8 7f00f874 7f038000 bd456480 7f036364 be392240
[  752.126889] bd40: 00000000 7f00f620 7f00f638 bd41a008 bd41bd94 bd41bd60 7f00f6d4 7f03800c
[  752.135073] bd60: 00000001 00000000 8047438c be3a4000 7f036364 7f036364 7f00db28 7f00f620
[  752.143257] bd80: 7f00f638 bd41a008 bd41bdb4 bd41bd98 804742ac 7f00f644 00000000 809adde0
[  752.151442] bda0: 7f036364 7f036364 bd41bdcc bd41bdb8 804743c8 80474284 7f03633c 7f036200
[  752.159626] bdc0: bd41bdf4 bd41bdd0 7f00d5b4 8047435c bd41a000 80974060 7f038158 00000000
[  752.167811] bde0: 80974060 bdaa9940 bd41be04 bd41bdf8 7f03816c 7f00d518 bd41be8c bd41be08
[  752.175995] be00: 80008a5c 7f038164 be001f00 7f0363c4 bd41bf48 00000000 bd41be54 bd41be28
[  752.184179] be20: 800e9498 800e8e74 00000002 00000003 bd4129c0 c0a07000 00000001 7f0363c4
[  752.192363] be40: bd41bf48 00000000 bd41be74 bd41be58 800de780 800e9320 bd41a000 7f0363d0
[  752.200547] be60: 00000000 bd41a000 7f0363d0 00000000 bd41beec 7f0363c4 bd41bf48 00000000
[  752.208731] be80: bd41bf44 bd41be90 80093e54 800089e0 ffff8000 00007fff 80091390 0000065f
[  752.216915] bea0: 00000000 c0a0834c bd41bf7c 00000086 bd41bf50 00000000 7f03651c 00000086
[  752.225099] bec0: bd41a010 00c28758 800ddcc4 800ddae0 000000d2 bd412a00 bd41bf24 00000000
[  752.233283] bee0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  752.241467] bf00: 00000000 00000000 00000000 00000000 00000000 00000000 bd41bf44 000025b0
[  752.249651] bf20: 00c28a08 00c28758 00000080 8000edc4 bd41a000 00000000 bd41bfa4 bd41bf48
[  752.257835] bf40: 800943e4 800932ec c0a07000 000025b0 c0a07f8c c0a07ea4 c0a08e5c 0000051c
[  752.266019] bf60: 0000088c 00000000 00000000 00000000 00000018 00000019 00000010 0000000b
[  752.274203] bf80: 00000009 00000000 00000000 000025b0 00000000 00c28758 00000000 bd41bfa8
[  752.282387] bfa0: 8000ec00 8009430c 000025b0 00000000 00c28a08 000025b0 00c28758 00c28980
[  752.290571] bfc0: 000025b0 00000000 00c28758 00000080 000a6a78 00000007 00c28718 00c28980
[  752.298756] bfe0: 7ebc1af0 7ebc1ae0 0001a32c 76e9c490 60000010 00c28a08 22013510 ecebffff
[  752.306933] Backtrace:
[  752.309414] [<800ec940>] (filp_close) from [<7f03c63c>] (gaudio_cleanup+0x28/0x54 [usb_f_uac1])
[  752.318115]  r6:7f036500 r5:7f03626c r4:bd441000 r3:7f03b3dc
[  752.323851] [<7f03c614>] (gaudio_cleanup [usb_f_uac1]) from [<7f03b3f4>] (f_audio_free_inst+0x18/0x68 [usb_f_uac1])
[  752.334288]  r4:bdaa6b00 r3:7f03b3dc
[  752.337931] [<7f03b3dc>] (f_audio_free_inst [usb_f_uac1]) from [<7f00f88c>] (usb_put_function_instance+0x24/0x30 [libcomposite])
[  752.349498]  r4:7f03cbd4 r3:7f03b3dc
[  752.353127] [<7f00f868>] (usb_put_function_instance [libcomposite]) from [<7f0380d8>] (audio_bind+0xd8/0xfc [g_audio])
[  752.363824]  r4:fffffffe r3:00000000
[  752.367456] [<7f038000>] (audio_bind [g_audio]) from [<7f00f6d4>] (composite_bind+0x9c/0x1e8 [libcomposite])
[  752.377284]  r10:bd41a008 r9:7f00f638 r8:7f00f620 r7:00000000 r6:be392240 r5:7f036364
[  752.385193]  r4:bd456480 r3:7f038000
[  752.388825] [<7f00f638>] (composite_bind [libcomposite]) from [<804742ac>] (udc_bind_to_driver+0x34/0xd8)
[  752.398394]  r10:bd41a008 r9:7f00f638 r8:7f00f620 r7:7f00db28 r6:7f036364 r5:7f036364
[  752.406302]  r4:be3a4000
[  752.408860] [<80474278>] (udc_bind_to_driver) from [<804743c8>] (usb_gadget_probe_driver+0x78/0xa8)
[  752.417908]  r6:7f036364 r5:7f036364 r4:809adde0 r3:00000000
[  752.423649] [<80474350>] (usb_gadget_probe_driver) from [<7f00d5b4>] (usb_composite_probe+0xa8/0xd4 [libcomposite])
[  752.434086]  r5:7f036200 r4:7f03633c
[  752.437713] [<7f00d50c>] (usb_composite_probe [libcomposite]) from [<7f03816c>] (audio_driver_init+0x14/0x1c [g_audio])
[  752.448498]  r9:bdaa9940 r8:80974060 r7:00000000 r6:7f038158 r5:80974060 r4:bd41a000
[  752.456330] [<7f038158>] (audio_driver_init [g_audio]) from [<80008a5c>] (do_one_initcall+0x88/0x1d4)
[  752.465564] [<800089d4>] (do_one_initcall) from [<80093e54>] (load_module+0xb74/0x1020)
[  752.473571]  r10:00000000 r9:bd41bf48 r8:7f0363c4 r7:bd41beec r6:00000000 r5:7f0363d0
[  752.481478]  r4:bd41a000
[  752.484037] [<800932e0>] (load_module) from [<800943e4>] (SyS_init_module+0xe4/0xf8)
[  752.491781]  r10:00000000 r9:bd41a000 r8:8000edc4 r7:00000080 r6:00c28758 r5:00c28a08
[  752.499689]  r4:000025b0
[  752.502252] [<80094300>] (SyS_init_module) from [<8000ec00>] (ret_fast_syscall+0x0/0x48)
[  752.510345]  r6:00c28758 r5:00000000 r4:000025b0
[  752.515013] Code: 808475b4 e1a0c00d e92dd878 e24cb004 (e5904038)
[  752.521223] ---[ end trace 70babe34de4ab99b ]---
Segmentation fault

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-12-22 10:26:04 -06:00
James Bottomley e617457691 Merge remote-tracking branch 'scsi-queue/drivers-for-3.19' into for-linus 2014-12-18 05:56:29 -08:00
Linus Torvalds e6b5be2be4 Driver core patches for 3.19-rc1
Here's the set of driver core patches for 3.19-rc1.
 
 They are dominated by the removal of the .owner field in platform
 drivers.  They touch a lot of files, but they are "simple" changes, just
 removing a line in a structure.
 
 Other than that, a few minor driver core and debugfs changes.  There are
 some ath9k patches coming in through this tree that have been acked by
 the wireless maintainers as they relied on the debugfs changes.
 
 Everything has been in linux-next for a while.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iEYEABECAAYFAlSOD20ACgkQMUfUDdst+ylLPACg2QrW1oHhdTMT9WI8jihlHVRM
 53kAoLeteByQ3iVwWurwwseRPiWa8+MI
 =OVRS
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core update from Greg KH:
 "Here's the set of driver core patches for 3.19-rc1.

  They are dominated by the removal of the .owner field in platform
  drivers.  They touch a lot of files, but they are "simple" changes,
  just removing a line in a structure.

  Other than that, a few minor driver core and debugfs changes.  There
  are some ath9k patches coming in through this tree that have been
  acked by the wireless maintainers as they relied on the debugfs
  changes.

  Everything has been in linux-next for a while"

* tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (324 commits)
  Revert "ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries"
  fs: debugfs: add forward declaration for struct device type
  firmware class: Deletion of an unnecessary check before the function call "vunmap"
  firmware loader: fix hung task warning dump
  devcoredump: provide a one-way disable function
  device: Add dev_<level>_once variants
  ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries
  ath: use seq_file api for ath9k debugfs files
  debugfs: add helper function to create device related seq_file
  drivers/base: cacheinfo: remove noisy error boot message
  Revert "core: platform: add warning if driver has no owner"
  drivers: base: support cpu cache information interface to userspace via sysfs
  drivers: base: add cpu_device_create to support per-cpu devices
  topology: replace custom attribute macros with standard DEVICE_ATTR*
  cpumask: factor out show_cpumap into separate helper function
  driver core: Fix unbalanced device reference in drivers_probe
  driver core: fix race with userland in device_add()
  sysfs/kernfs: make read requests on pre-alloc files use the buffer.
  sysfs/kernfs: allow attributes to request write buffer be pre-allocated.
  fs: sysfs: return EGBIG on write if offset is larger than file size
  ...
2014-12-14 16:10:09 -08:00
Linus Torvalds e7cf773d43 USB patches for 3.19-rc1
Here's the big set of USB and PHY patches for 3.19-rc1.
 
 The normal churn in the USB gadget area is in here, as well as xhci and
 other individual USB driver updates.  The PHY tree is also in here, as
 there were dependancies on the USB tree.
 
 All of these have been in linux-next.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iEYEABECAAYFAlSOEHcACgkQMUfUDdst+ykziQCgsm1D/af2nac6CTF2pov8VMIY
 ywgAnRi8LtZ2WassrwTNxY86Avaqryis
 =UVp8
 -----END PGP SIGNATURE-----

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

Pull USB updates from Greg KH:
 "Here's the big set of USB and PHY patches for 3.19-rc1.

  The normal churn in the USB gadget area is in here, as well as xhci
  and other individual USB driver updates.  The PHY tree is also in
  here, as there were dependancies on the USB tree.

  All of these have been in linux-next"

* tag 'usb-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (351 commits)
  arm: omap3: twl: remove usb phy init data
  usbip: fix error handling in stub_probe()
  usb: gadget: udc: missing curly braces
  USB: mos7720: delete some unneeded code
  wusb: replace memset by memzero_explicit
  usbip: remove unneeded structure
  usb: xhci: fix comment for PORT_DEV_REMOVE
  xhci: don't use the same variable for stopped and halted rings current TD
  xhci: clear extra bits from slot context when setting max exit latency
  xhci: cleanup finish_td function
  USB: adutux: NULL dereferences on disconnect
  usb: chipidea: fix platform_no_drv_owner.cocci warnings
  usb: chipidea: Fixed a few typos in comments
  Documentation: bindings: add doc for the USB2 ChipIdea USB driver
  usb: chipidea: add a usb2 driver for ci13xxx
  usb: chipidea: fix phy handling
  usb: chipidea: remove duplicate dev_set_drvdata for host_start
  usb: chipidea: parameter 'mode' isn't needed for hw_device_reset
  usb: chipidea: add controller reset API
  usb: chipidea: remove flag CI_HDRC_REQUIRE_TRANSCEIVER
  ...
2014-12-14 14:57:16 -08:00
Linus Torvalds a7cb7bb664 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Pull trivial tree update from Jiri Kosina:
 "Usual stuff: documentation updates, printk() fixes, etc"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (24 commits)
  intel_ips: fix a type in error message
  cpufreq: cpufreq-dt: Move newline to end of error message
  ps3rom: fix error return code
  treewide: fix typo in printk and Kconfig
  ARM: dts: bcm63138: change "interupts" to "interrupts"
  Replace mentions of "list_struct" to "list_head"
  kernel: trace: fix printk message
  scsi: mpt2sas: fix ioctl in comment
  zbud, zswap: change module author email
  clocksource: Fix 'clcoksource' typo in comment
  arm: fix wording of "Crotex" in CONFIG_ARCH_EXYNOS3 help
  gpio: msm-v1: make boolean argument more obvious
  usb: Fix typo in usb-serial-simple.c
  PCI: Fix comment typo 'COMFIG_PM_OPS'
  powerpc: Fix comment typo 'CONIFG_8xx'
  powerpc: Fix comment typos 'CONFiG_ALTIVEC'
  clk: st: Spelling s/stucture/structure/
  isci: Spelling s/stucture/structure/
  usb: gadget: zero: Spelling s/infrastucture/infrastructure/
  treewide: Fix company name in module descriptions
  ...
2014-12-12 10:08:06 -08:00
Linus Torvalds 70e71ca0af Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller:

 1) New offloading infrastructure and example 'rocker' driver for
    offloading of switching and routing to hardware.

    This work was done by a large group of dedicated individuals, not
    limited to: Scott Feldman, Jiri Pirko, Thomas Graf, John Fastabend,
    Jamal Hadi Salim, Andy Gospodarek, Florian Fainelli, Roopa Prabhu

 2) Start making the networking operate on IOV iterators instead of
    modifying iov objects in-situ during transfers.  Thanks to Al Viro
    and Herbert Xu.

 3) A set of new netlink interfaces for the TIPC stack, from Richard
    Alpe.

 4) Remove unnecessary looping during ipv6 routing lookups, from Martin
    KaFai Lau.

 5) Add PAUSE frame generation support to gianfar driver, from Matei
    Pavaluca.

 6) Allow for larger reordering levels in TCP, which are easily
    achievable in the real world right now, from Eric Dumazet.

 7) Add a variable of napi_schedule that doesn't need to disable cpu
    interrupts, from Eric Dumazet.

 8) Use a doubly linked list to optimize neigh_parms_release(), from
    Nicolas Dichtel.

 9) Various enhancements to the kernel BPF verifier, and allow eBPF
    programs to actually be attached to sockets.  From Alexei
    Starovoitov.

10) Support TSO/LSO in sunvnet driver, from David L Stevens.

11) Allow controlling ECN usage via routing metrics, from Florian
    Westphal.

12) Remote checksum offload, from Tom Herbert.

13) Add split-header receive, BQL, and xmit_more support to amd-xgbe
    driver, from Thomas Lendacky.

14) Add MPLS support to openvswitch, from Simon Horman.

15) Support wildcard tunnel endpoints in ipv6 tunnels, from Steffen
    Klassert.

16) Do gro flushes on a per-device basis using a timer, from Eric
    Dumazet.  This tries to resolve the conflicting goals between the
    desired handling of bulk vs.  RPC-like traffic.

17) Allow userspace to ask for the CPU upon what a packet was
    received/steered, via SO_INCOMING_CPU.  From Eric Dumazet.

18) Limit GSO packets to half the current congestion window, from Eric
    Dumazet.

19) Add a generic helper so that all drivers set their RSS keys in a
    consistent way, from Eric Dumazet.

20) Add xmit_more support to enic driver, from Govindarajulu
    Varadarajan.

21) Add VLAN packet scheduler action, from Jiri Pirko.

22) Support configurable RSS hash functions via ethtool, from Eyal
    Perry.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1820 commits)
  Fix race condition between vxlan_sock_add and vxlan_sock_release
  net/macb: fix compilation warning for print_hex_dump() called with skb->mac_header
  net/mlx4: Add support for A0 steering
  net/mlx4: Refactor QUERY_PORT
  net/mlx4_core: Add explicit error message when rule doesn't meet configuration
  net/mlx4: Add A0 hybrid steering
  net/mlx4: Add mlx4_bitmap zone allocator
  net/mlx4: Add a check if there are too many reserved QPs
  net/mlx4: Change QP allocation scheme
  net/mlx4_core: Use tasklet for user-space CQ completion events
  net/mlx4_core: Mask out host side virtualization features for guests
  net/mlx4_en: Set csum level for encapsulated packets
  be2net: Export tunnel offloads only when a VxLAN tunnel is created
  gianfar: Fix dma check map error when DMA_API_DEBUG is enabled
  cxgb4/csiostor: Don't use MASTER_MUST for fw_hello call
  net: fec: only enable mdio interrupt before phy device link up
  net: fec: clear all interrupt events to support i.MX6SX
  net: fec: reset fep link status in suspend function
  net: sock: fix access via invalid file descriptor
  net: introduce helper macro for_each_cmsghdr
  ...
2014-12-11 14:27:06 -08:00
Christoph Hellwig 68d81f4004 scsi: remove MSG_*_TAG defines
For SPI drivers use the message definitions from scsi.h, and for target
drivers introduce a new TCM_*_TAG namespace.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com
2014-12-04 09:58:33 +01:00
Dan Carpenter 016040268c usb: gadget: udc: missing curly braces
There were curly braces intended here.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-12-02 16:15:02 -08:00
Felipe Balbi 4db9917b64 usb: gadget: udc: pxa25x: remove unnecessary NULL check
debugfs_remove() is safe against NULL pointers, so
let's remove the unnecessary NULL check before
calling it.

Reviewed-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-25 08:47:04 -06:00
Felipe Balbi 23fba80a9b usb: gadget: udc: lpc32xx: remove unnecessary NULL check
debugfs_remove() is safe against NULL pointers, so
let's remove the unnecessary NULL check before
calling it.

Acked-by: Peter Chen <peter.chen@freeescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-25 08:46:53 -06:00
Hannes Reinecke eb846d9f14 scsi: rename SERVICE_ACTION_IN to SERVICE_ACTION_IN_16
SPC-3 defines SERVICE ACTION IN(12) and SERVICE ACTION IN(16).
So rename SERVICE_ACTION_IN to SERVICE_ACTION_IN_16 to be
consistent with SPC and to allow for better distinction.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Tested-by: Robert Elliott <elliott@hp.com>
Reviewed-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-11-24 20:01:40 +01:00
kbuild test robot ef24d749f2 usb: gadget: ss_ep_in_comp_desc can be static
drivers/usb/gadget/legacy/printer.c:222:34: sparse: symbol 'ss_ep_in_comp_desc' was not declared. Should it be static?
drivers/usb/gadget/legacy/printer.c:234:34: sparse: symbol 'ss_ep_out_comp_desc' was not declared. Should it be static?

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-24 08:33:23 -06:00
Markus Elfring 7b0f000b2f usb: gadget: function: delete an unnecessary check before rndis_add_hdr()
The rndis_add_hdr() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-21 09:08:12 -06:00
Mario Schuknecht 18a4e65f22 usb: gadget: net2280: Fix superspeed dma_done()
Parameter three in function call dma_done() is incorrect.
Move use of variable 'tmp' after if-condition.

Signed-off-by: Mario Schuknecht <mario.schuknecht@dresearch-fe.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-20 13:51:25 -06:00
Ronald Wahl b2ba27a5c5 usb: gadget: at91_udc: move prepare clk into process context
Commit 7628083227 (usb: gadget: at91_udc:
prepare clk before calling enable) added clock preparation in interrupt
context. This is not allowed as it might sleep. Also setting the clock
rate is unsafe to call from there for the same reason. Move clock
preparation and setting clock rate into process context (at91udc_probe).

Signed-off-by: Ronald Wahl <ronald.wahl@raritan.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: <stable@vger.kernel.org> # v3.17+
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-20 13:50:17 -06:00
Bo Shen cf0b1d1309 usb: gadget: atmel_usba_udc: remove release function
As the driver call usb_add_gadget_udc --> usb_add_gadget_udc_release
with NULL as release parameter, so it will use usb_udc_no_release.
So, the release in driver won't used, remove it.

And at the same time, in the usb_add_gadget_udc_release will set the
gadget name, so remove it also in driver.

Signed-off-by: Bo Shen <voice.shen@atmel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-20 13:49:30 -06:00
Bo Shen ba7cc772e7 usb: gadget: at91_udc: remove unused release function
As the driver call usb_add_gadget_udc --> usb_add_gadget_udc_release
with NULL as release parameter, so it will use usb_udc_no_release.
So, the release in driver won't used, remove it.

And at the same time, in the usb_add_gadget_udc_release will set the
gadget name, so remove it also in driver.

Signed-off-by: Bo Shen <voice.shen@atmel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-20 13:49:25 -06:00
Jorge Ramirez-Ortiz 74df41b40a usb: gadget: add USB3 support to the printer driver
Add SS descriptors to support the capabilities provided by USB3 controller
drivers; unit tests run using a PLX 3380 [max transfer speed measured of 1Gbps]

This driver shall fallback to lower operating modes when the higher ones are
not available.

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-20 13:47:08 -06:00
Masanari Iida 6774def642 treewide: fix typo in printk and Kconfig
This patch fix spelling typo in printk and Kconfig within
various part of kernel sources.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-11-20 14:56:11 +01:00
Jiri Kosina a02001086b Merge Linus' tree to be be to apply submitted patches to newer code than
current trivial.git base
2014-11-20 14:42:02 +01:00
Dan Carpenter 0448d38c1e usb: gadget: f_hid: fix error handling in ghid_setup()
There were a two issues here.

1) We returned PTR_ERR(NULL) which means success if class_create()
   failed.
2) If alloc_chrdev_region() failed then we should clean up before
   returning.

Also kernel style is to have "error handling" as opposed to "success
handling".  In the original code checking for "if (!status) " is
confusing and this bad style is what lead to bug #2.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-18 08:47:44 -06:00
Dan Carpenter 828f6148e8 usb: gadget: f_hid: use after free in hidg_alloc_inst()
We free "opts" on the error path and then dereference it.

Fixes: 21a9476a7b ('usb: gadget: hid: add configfs support')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-18 08:47:44 -06:00
Ashwini Pahuja efed421a94 usb: gadget: Add UDC driver for Broadcom USB3.0 device controller IP BDC
This patch adds a UDC driver for Broadcom's USB3.0 Peripheral core named BDC.
BDC supports control traffic on ep0 and bulk/Int/Isoch traffic on all other
endpoints.

[ balbi@ti.com : fix build error on randconfig due to lack of
	<linux/dmapool.h> ]

Signed-off-by: Ashwini Pahuja <ashwini.linux@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-18 08:47:23 -06:00
David S. Miller 076ce44825 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts:
	drivers/net/ethernet/chelsio/cxgb4vf/sge.c
	drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c

sge.c was overlapping two changes, one to use the new
__dev_alloc_page() in net-next, and one to use s->fl_pg_order in net.

ixgbe_phy.c was a set of overlapping whitespace changes.

Signed-off-by: David S. Miller <davem@davemloft.net>
2014-11-14 01:01:12 -05:00
Fengguang Wu f509fee81f usb: gadget: midi: f_midi_alloc() can be static
drivers/usb/gadget/function/f_midi.c:1072:21: sparse: symbol 'f_midi_alloc' was not declared. Should it be static?
drivers/usb/gadget/legacy/gmidi.c:118:30: sparse: symbol 'fi_midi' was not declared. Should it be static?
drivers/usb/gadget/legacy/gmidi.c:119:21: sparse: symbol 'f_midi' was not declared. Should it be static?

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-12 09:01:03 -06:00
Fengguang Wu 0fc57ea059 usb: gadget: f_hid: hidg_alloc() can be static
drivers/usb/gadget/function/f_hid.c:852:21: sparse: symbol 'hidg_alloc' was not declared. Should it be static?

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-12 08:59:24 -06:00
Alexander Duyck 5693d284dd phonet: Replace calls to __skb_alloc_page with __dev_alloc_page
Replace the calls to __skb_alloc_page that are passed NULL with calls to
__dev_alloc_page.

In addition remove __GFP_COLD flag from allocations as we only want it for
the Rx buffer which is taken care of by __dev_alloc_skb, not for any
secondary allocations such as the queue element transmit descriptors.

Cc: Oliver Neukum <oliver@neukum.org>
Cc: Felipe Balbi <balbi@ti.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2014-11-12 00:00:14 -05:00
Peter Chen 39dd96d6c5 usb: gadget: atmel_usba_udc: use udc-core's reset notifier
Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-10 17:19:38 -06:00
Peter Chen 4f6bd9fd4a usb: gadget: bcm63xx_udc: use udc-core's reset notifier
Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-10 17:19:38 -06:00
Peter Chen 5443a7915f usb: gadget: r8a66597-udc: use udc-core's reset notifier
Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-10 17:19:38 -06:00
Peter Chen 107d13c76f usb: gadget: amd5536udc: use udc-core's reset notifier
Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-10 17:19:37 -06:00
Peter Chen 7918d8c56a usb: gadget: pch_udc: use udc-core's reset notifier
Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-10 17:19:37 -06:00
Peter Chen fba45ceac4 usb: gadget: fsl_qe_udc: use udc-core's reset notifier
Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-10 17:19:37 -06:00
Peter Chen 69aa1f9f5e usb: gadget: mv_udc_core: use udc-core's reset notifier
Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-10 17:19:37 -06:00
Peter Chen 236e5064fc usb: gadget: at91_udc: use udc-core's reset notifier
Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-10 17:19:36 -06:00
Peter Chen 363ea206ef usb: gadget: fsl_udc_core: use udc-core's reset notifier
Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-10 17:19:36 -06:00
Peter Chen 373ef692e0 usb: gadget: m66592-udc: use udc-core's reset notifier
Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-10 17:19:36 -06:00
Peter Chen 90834d3ecb usb: gadget: pxa25x_udc: use udc-core's reset notifier
Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-10 17:19:36 -06:00
Alan Stern 5ca1ccdaa8 usb: gadget: net2272: use udc-core's reset notifier
This patch adds support for the new udc-core reset notifier to the
net2272 driver.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-10 17:19:35 -06:00
Alan Stern b611e424f1 usb: gadget: net2280: use udc-core's reset notifier
This patch adds support for the new udc-core reset notifier to the
net2280 driver.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-10 17:19:35 -06:00
Alan Stern 8480484d6f usb: gadget: dummy-hcd: use udc-core's reset notifier
Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Peter chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-10 17:19:35 -06:00
Kyösti Mälkki 6876d58f2f usb: gadget: dbgp: Fix endpoint config after USB disconnect
SET_FEATURE request with DEBUG_MODE only worked the first time after module
initialisation. Per the USB 2.0 debug device specification, said request
is to be treated as if it were a SET_CONFIGURATION request, i.e. endpoint
must be re-configured.

As configure_endpoints() may now get called multiple times, move it outside
__init and move serial_alloc_tty() call into __init.

Code has assumption that endpoint mapping remains unchanged with consecutive
calls of configure_endpoints().

Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-10 17:19:34 -06:00
Robert Jarzmik 004f7d457e usb: gadget: pxa27x_udc: fix warning in non device-tree build
The recent change bringing device-tree support triggers a warning in a
non device-tree build :
  drivers/usb/gadget/udc/pxa27x_udc.c:2405:28: warning: 'udc_pxa_dt_ids'
  defined but not used [-Wunused-variable]

Fix the warning with a preprocessor condition.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-10 17:19:33 -06:00
Andrzej Pietrasiewicz 21a9476a7b usb: gadget: hid: add configfs support
Make the hid function available for gadgets composed with configfs.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-06 16:18:19 -06:00
Andrzej Pietrasiewicz 5ca8d3ec99 usb: gadget: f_hid: use usb_gstrings_attach
Before configfs is integrated the usb_gstrings_attach() interface
must be used.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-06 16:18:18 -06:00
Andrzej Pietrasiewicz 5d66a39102 usb: gadget: f_hid: remove compatibility layer
There are no old function interface users left, so remove it.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-06 16:18:18 -06:00
Andrzej Pietrasiewicz 4bc8a33f24 usb: gadget: hid: convert to new interface of f_hid
Use the new f_hid interface in order for the old to be removed.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-06 16:18:18 -06:00
Andrzej Pietrasiewicz cb38253605 usb: gadget: f_hid: convert to new function interface with backward compatibility
Converting hid to the new function interface requires converting
the USB hid's function code and its users.

This patch converts the f_hid.c to the new function interface.

The file can now be compiled into a separate usb_f_hid.ko module.

The old function interface is provided by means of a preprocessor
conditional directives. After all users are converted, the old interface
can be removed.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-06 16:18:18 -06:00
Andrzej Pietrasiewicz 00896f66f5 usb: gadget: hid: mirror init operations in module cleanup
So far platform driver has been unregistered first,
so just after that the usb composite is still available,
but there is no hid data any more.

Reverse the order so that first the usb composite becomes
unavailable and second the hid data goes away.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-06 16:18:17 -06:00
Andrzej Pietrasiewicz 634060870a usb: gadget: f_hid: check return value of device_create
device_create() might fail, so check its return value and react
appropriately.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-06 16:18:17 -06:00
Andrzej Pietrasiewicz 0652940732 usb: gadget: f_hid: check return value of class_create
class_create() might fail, so check its return value and react
appropriately.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-06 16:18:17 -06:00
Andrzej Pietrasiewicz 6f1de34455 usb: gadget: f_midi: add configfs support
Make the midi function available for gadgets composed with configfs.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-05 13:37:17 -06:00
Andrzej Pietrasiewicz 9caa0d77f7 usb: gadget: f_midi: use usb_gstrings_attach
In order to add configfs support the usb_gstrings_attach must be used.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-05 13:36:20 -06:00
Andrzej Pietrasiewicz 33cfad66ef usb: gadget: f_midi: remove compatibility layer
There are no old f_midi interface users left, so remove it.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-05 13:36:17 -06:00
Andrzej Pietrasiewicz 32522a51c7 usb: gadget: midi: convert to new interface of f_midi
Use the new f_midi interface so that the old can be removed.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-05 13:36:13 -06:00
Andrzej Pietrasiewicz b85e9de9e8 usb: gadget: f_midi: convert to new function interface with backward compatibility
Converting midi to the new function interface requires converting
the USB midi's function code and its users.

This patch converts the f_midi.c to the new function interface.
The file can now be compiled into a separate usb_f_midi.ko module.

The old function interface is provided by means of a preprocessor
conditional directives. After all users are converted, the old interface
can be removed.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-05 13:36:09 -06:00
Andrzej Pietrasiewicz d23b4c3ee2 usb: gadget: f_midi: check kstrdup() return value
kstrdup() might fail, so check its return value and react appropriately.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-05 13:36:05 -06:00
Andrzej Pietrasiewicz 6e58ed578e usb: gadget: f_midi: enable use of the index parameter
The soundcard index to use for the ALSA device creation is passed as a
parameter to f_midi_bind_config(), but is assigned to midi->index only
after the call to f_midi_register_card(midi). So no matter what is passed
to f_midi_bind_config(), the actual index for snd_card_new() is always 0.
This probably works ok if at the moment of f_midi's bind there are no
other snd_cards, but if there are, it is not possible to bind f_midi.

This patch moves the assignment to a place before the call to
f_midi_register_card(midi).

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-05 13:36:02 -06:00
Andrzej Pietrasiewicz cb0a59f541 usb: gadget: Kconfig: enable separate compilation of uac1/uac2 functions
uac1 and uac2 functions are available through the configfs interface
and it should be possible to build them without building their legacy
gadgets.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-05 13:35:57 -06:00
Greg Kroah-Hartman a8a93c6f99 Merge branch 'platform/remove_owner' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux into driver-core-next
Remove all .owner fields from platform drivers
2014-11-03 19:53:56 -08:00
Fengguang Wu a2655e4a8e usb: gadget: fix ptr_ret.cocci warnings
drivers/usb/gadget/udc/r8a66597-udc.c:1849:1-3: WARNING: PTR_ERR_OR_ZERO can be used

 Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:24 -06:00
Pavitrakumar Managutte 8b920f16e6 usb: gadget: function: Added usb_assign_descriptors failure check
Added failure check for usb_assign_descriptors call in bind function.

Acked-By: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Pavitrakumar Managutte <pavitra1729@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:24 -06:00
Felipe Balbi 76bfa95eab usb: gadget: udc: pxa27x: do not call usb_gadget_unregister_driver()
that call is completely unnecessary because
usb_del_gadget_udc() already makes sure the
gadget driver is properly unregistered from
the UDC.

Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:19 -06:00
Felipe Balbi 7fd1f9d666 usb: gadget: udc: net2272: do not call usb_gadget_unregister_driver()
that call is completely unnecessary because
usb_del_gadget_udc() already makes sure the
gadget driver is properly unregistered from
the UDC.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:19 -06:00
Felipe Balbi c77f570fe2 usb: gadget: udc: dummy: do not call usb_gadget_unregister_driver()
that call is completely unnecessary because
usb_del_gadget_udc() already makes sure the
gadget driver is properly unregistered from
the UDC.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:18 -06:00
Robert Jarzmik f4fd094cdf usb: gadget: pxa27x_udc: fix clock prepare and enable
As the udc clock controls both the output signals and the internal IP,
it must be enabled before any UDC register is touched.

The bug is revealed when the clock framework disables the clock for a
couple of milliseconds during the boot sequence, and the endpoint
configuration is lost. The bug is hidden when clock framework is not
used, because no "unused clocks disable" occurs.

This patch fixes the wrong behaviour by ensuring that :
 - whenever a UDC register is read or written, the clock is enabled
 - reworks the endpoints programming to have it done under running clock
 - reworks suspend/resume to ensure the same thing

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:18 -06:00
Robert Jarzmik 95fcc6a901 usb: gadget: pxa27x_udc: use devm_* helpers
Use devm_* helpers in the probe function to simplify the error path and
the remove path.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:17 -06:00
Felipe Balbi 02e8c96627 usb: gadget: udc: core: prepend udc_attach_driver with usb_
No functional changes, just adding a prefix
which should have been there from the start.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:16 -06:00
Felipe Balbi 22835b807e usb: gadget: remove unnecessary 'driver' argument
now that no UDC driver relies on the extra
'driver' argument to ->udc_stop(), we can
safely remove it.

This commit is based on previous work by
Robert Baldyga <r.baldyga@samsung.com> which
can be found at [1]; however that patch turned
out to have a high probability of regressing
many UDC drivers because of a blind search & replace
s/driver/$udc->driver/ which caused the 'driver'
argument to stop_activity() to be a valid non-NULL
pointer when it should be NULL, thus causing UDCs
to mistakenly call gadget driver's ->disconnect()
callback.

[1] http://markmail.org/message/x5zneg4xea4zntab

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:16 -06:00
Felipe Balbi 8da9fe8af8 usb: gadget: udc: core: fix unregistering message
Currently, we're printing gadget driver name when
registering and UDC name when unregistering. Standardize
on always printing gadget driver name.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:16 -06:00
Felipe Balbi 6ce372fed2 usb: gadget: udc: s3c-hsudc: remove bind/unbind messages
now that we provide generic register/unregister
debugging messages from udc-core, we can remove
the same messages from this driver.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:15 -06:00
Felipe Balbi 1ca12b2408 usb: gadget: udc: net2280: remove bind/unbind messages
now that we provide generic register/unregister
debugging messages from udc-core, we can remove
the same messages from this driver.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:15 -06:00
Felipe Balbi 812a40bee7 usb: gadget: udc: net2272: remove bind/unbind messages
now that we provide generic register/unregister
debugging messages from udc-core, we can remove
the same messages from this driver.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:14 -06:00
Felipe Balbi 70bbd56b7d usb: gadget: udc: gr_udc: remove bind/unbind messages
now that we provide generic register/unregister
debugging messages from udc-core, we can remove
the same messages from this driver.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:14 -06:00
Felipe Balbi 703584768a usb: gadget: udc: fsl_qe: remove bind/unbind messages
now that we provide generic register/unregister
debugging messages from udc-core, we can remove
the same messages from this driver.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:14 -06:00
Felipe Balbi dd7e6dd546 usb: gadget: udc: dummy: remove bind/unbind messages
now that we provide generic register/unregister
debugging messages from udc-core, we can remove
the same messages from this driver.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:13 -06:00
Felipe Balbi 3364aecc8c usb: gadget: udc: atmel_usba: remove bind/unbind messages
now that we provide generic register/unregister
debugging messages from udc-core, we can remove
the same messages from this driver.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:13 -06:00
Felipe Balbi dea87f9d13 usb: gadget: udc: at91: remove bind/unbind messages
now that we provide generic register/unregister
debugging messages from udc-core, we can remove
the same messages from this driver.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:13 -06:00
Felipe Balbi 2c683347f5 usb: gadget: udc: pass a single argument to usb_gadget_udc_start/stop
We know that our udc points to our gadget and our
gadget_driver, simplify the interface by passing
a single argument.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:12 -06:00
Felipe Balbi 82891b959c usb: gadget: udc: s3c-hsudc: do not rely on 'driver' argument
future patches will remove the extra 'driver'
argument to ->udc_stop(), in order to do that,
we must make sure that our UDC does not rely
on it first.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:11 -06:00
Felipe Balbi c3d84dfb7f usb: gadget: udc: pxa27x: do not rely on 'driver' argument
future patches will remove the extra 'driver'
argument to ->udc_stop(), in order to do that,
we must make sure that our UDC does not rely
on it first.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:11 -06:00
Felipe Balbi d7343161fd usb: gadget: udc: pxa25x: do not rely on 'driver' argument
future patches will remove the extra 'driver'
argument to ->udc_stop(), in order to do that,
we must make sure that our UDC does not rely
on it first.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:11 -06:00
Felipe Balbi bfd0ed576d usb: gadget: udc: net2280: do not rely on 'driver' argument
future patches will remove the extra 'driver'
argument to ->udc_stop(), in order to do that,
we must make sure that our UDC does not rely
on it first.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:10 -06:00
Felipe Balbi 5baca5cf25 usb: gadget: udc: net2272: do not rely on 'driver' argument
future patches will remove the extra 'driver'
argument to ->udc_stop(), in order to do that,
we must make sure that our UDC does not rely
on it first.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:10 -06:00
Felipe Balbi 2f1ae50108 usb: gadget: udc: mv_udc: do not rely on 'driver' argument
future patches will remove the extra 'driver'
argument to ->udc_stop(), in order to do that,
we must make sure that our UDC does not rely
on it first.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:10 -06:00
Felipe Balbi a19f378772 usb: gadget: udc: mv_u3d: do not rely on 'driver' argument
future patches will remove the extra 'driver'
argument to ->udc_stop(), in order to do that,
we must make sure that our UDC does not rely
on it first.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:09 -06:00
Felipe Balbi d3cb25bfcd usb: gadget: udc: lpc32xx: do not rely on 'driver' argument
future patches will remove the extra 'driver'
argument to ->udc_stop(), in order to do that,
we must make sure that our UDC does not rely
on it first.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:09 -06:00
Felipe Balbi 5d82ff915f usb: gadget: udc: fsl_qe: do not rely on 'driver' argument
future patches will remove the extra 'driver'
argument to ->udc_stop(), in order to do that,
we must make sure that our UDC does not rely
on it first.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:09 -06:00
Felipe Balbi 96a5361aab usb: gadget: udc: dummy: do not rely on 'driver' argument
future patches will remove the extra 'driver'
argument to ->udc_stop(), in order to do that,
we must make sure that our UDC does not rely
on it first.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:08 -06:00
Felipe Balbi af9501f656 usb: gadget: udc: at91: do not rely on 'driver' argument
future patches will remove the extra 'driver'
argument to ->udc_stop(), in order to do that,
we must make sure that our UDC does not rely
on it first.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:08 -06:00
Felipe Balbi 21090f06f0 usb: gadget: udc: amd5536: do not rely on 'driver' argument
future patches will remove the extra 'driver'
argument to ->udc_stop(), in order to do that,
we must make sure that our UDC does not rely
on it first.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:07 -06:00
Peter Chen 3dc3b4e15e usb: gadget: s3c-hsudc: delete unnecessary 'out of memory' messages
The memory subsystem has already had similar message for it.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:02 -06:00
Peter Chen 0590c4bf4b usb: gadget: bcm63xx_udc: delete unnecessary 'out of memory' messages
The memory subsystem has already had similar message for it.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:01 -06:00
Peter Chen 3efe90e995 usb: gadget: fsl_qe_udc: delete unnecessary 'out of memory' messages
The memory subsystem has already had similar message for it.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:01 -06:00
Peter Chen d6163f2ca5 usb: gadget: mv_udc_core: delete unnecessary 'out of memory' messages
The memory subsystem has already had similar message for it.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:01 -06:00
Andrzej Pietrasiewicz 3a57187085 usb: gadget: configfs: add suspend/resume
USB gadgets composed with configfs lack suspend and resume
methods. This patch uses composite_suspend()/composite_resume()
the same way e.g. composite_setup() or composite_disconnect()
are used in a configfs-based gadget.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:00:59 -06:00
Dan Carpenter 60b388befb usb: gadget: f_uac1: remove an unneeded NULL check
This NULL check sets off a static checker warning because we already
dereferenced "card" earlier in the function.  However, since "card" is
never NULL so we can just remove the check.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:00:59 -06:00
Felipe Balbi 0abd069698 usb: gadget: udc-core: call ->disconnect() when soft disconnecting
when disconnecting from host using our soft_connect
sysfs interface, also let the gadget driver know about
it by calling the gadget driver's ->disconnect()
method.

No problems have been found while not calling ->disconnect()
so far, it's just good convention.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:00:58 -06:00
Robert Jarzmik 1803fe15ad usb: gadget: pxa27x_udc: add devicetree support
Add support for device-tree device discovery. If devicetree is not
provided, fallback to legacy platform data "discovery".

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: devicetree@vger.kernel.org
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:00:57 -06:00
Robert Jarzmik 3ec8347bfa usb: gadget: pxa27x_udc: transfer mach_info into pxa_udc
Convert the mach info, and store the udc_command in the pxa_udc control
structure.

It is to be noticed that the udc_is_connected() in mach info is not
transfered. This was not used, as mioa701 machine doesn't need it,
balloon3 doesn't really use it, and most importantly the current driver
never uses it.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:00:57 -06:00
Robert Jarzmik 2db88a7696 usb: gadget: pxa27x_udc: prepare device-tree support
For this preparation, a preliminary cleanup is done :
  - convert the probing of pxa27x_udc to gpio_desc.
    The conversion is partial because :
     - the platform data still provides a gpio number, not a gpio desc

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:00:57 -06:00
Felipe Balbi a7c12eaf2e usb: gadget: composite: conditionally dequeue os_desc and setup requests
In case we unload a gadget driver while any of
os_desc_req or req are still pending, we need
to make sure to dequeue them.

By using our setup_pending and os_desc_pending
flags we achieve that in a way that doesn't
cause any regressions because we won't dequeue
a request which was already completed.

The original idea came from Li Jun's commit
f2267089ea
(usb: gadget: composite: dequeue cdev->req
before free it in composite_dev_cleanup) which,
unfortunately, caused two regressions (kfree()
being called before usb_ep_dequeue() and calling
usb_ep_dequeue() when the request was already
completed). That commit also didn't take care
of os_desc_req which can fall into the same
situation so we must care for that one too.

Note that in order to make code slightly easier
to read, we introduce composite_ep_queue() which
hides details about how to fiddle with our pending
flags.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:00:55 -06:00
Felipe Balbi 57943716ff usb: gadget: composite: set our req->context to cdev
by doing that we will be able to match our
requests against req and os_desc_req and also
clear our pending flags from complete callback.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:00:55 -06:00
Geert Uytterhoeven b8bcf32af9 usb: gadget: zero: Spelling s/infrastucture/infrastructure/
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Felipe Balbi <balbi@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-10-29 14:38:13 +01:00
Pavitrakumar Managutte 9b1763553a usb: gadget: function: Fixed the return value on error path
Fixed the return value on failure. status variable
is set to 0 at usb_assign_descriptors call and the same is
returned on error which is incorrect.

Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Pavitrakumar Managutte <pavitra1729@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-10-23 14:49:35 -05:00
Pavitrakumar Managutte d12a872717 usb: gadget: function: Remove redundant usb_free_all_descriptors
Removed usb_free_all_descriptors in the bind functions, which
results in double-free corruption of the descriptors on error path.
The usb descriptors are allocated by usb_assign_descriptors.

Signed-off-by: Pavitrakumar Managutte <pavitra1729@gmail.com>
Reviewed-by: Robert Baldyga <r.baldyga@samsung.com>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-10-23 13:57:24 -05:00
Felipe Balbi bfa6b18c68 usb: gadget: udc: core: fix kernel oops with soft-connect
Currently, there's no guarantee that udc->driver
will be valid when using soft_connect sysfs
interface. In fact, we can very easily trigger
a NULL pointer dereference by trying to disconnect
when a gadget driver isn't loaded.

Fix this bug:

~# echo disconnect > soft_connect
[   33.685743] Unable to handle kernel NULL pointer dereference at virtual address 00000014
[   33.694221] pgd = ed0cc000
[   33.697174] [00000014] *pgd=ae351831, *pte=00000000, *ppte=00000000
[   33.703766] Internal error: Oops: 17 [#1] SMP ARM
[   33.708697] Modules linked in: xhci_plat_hcd xhci_hcd snd_soc_davinci_mcasp snd_soc_tlv320aic3x snd_soc_edma snd_soc_omap snd_soc_evm snd_soc_core dwc3 snd_compress snd_pcm_dmaengine snd_pcm snd_timer snd lis3lv02d_i2c matrix_keypad lis3lv02d dwc3_omap input_polldev soundcore
[   33.734372] CPU: 0 PID: 1457 Comm: bash Not tainted 3.17.0-09740-ga93416e-dirty #345
[   33.742457] task: ee71ce00 ti: ee68a000 task.ti: ee68a000
[   33.748116] PC is at usb_udc_softconn_store+0xa4/0xec
[   33.753416] LR is at mark_held_locks+0x78/0x90
[   33.758057] pc : [<c04df128>]    lr : [<c00896a4>]    psr: 20000013
[   33.758057] sp : ee68bec8  ip : c0c00008  fp : ee68bee4
[   33.770050] r10: ee6b394c  r9 : ee68bf80  r8 : ee6062c0
[   33.775508] r7 : 00000000  r6 : ee6062c0  r5 : 0000000b  r4 : ee739408
[   33.782346] r3 : 00000000  r2 : 00000000  r1 : ee71d390  r0 : ee664170
[   33.789168] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[   33.796636] Control: 10c5387d  Table: ad0cc059  DAC: 00000015
[   33.802638] Process bash (pid: 1457, stack limit = 0xee68a248)
[   33.808740] Stack: (0xee68bec8 to 0xee68c000)
[   33.813299] bec0:                   0000000b c0411284 ee6062c0 00000000 ee68bef4 ee68bee8
[   33.821862] bee0: c04112ac c04df090 ee68bf14 ee68bef8 c01c2868 c0411290 0000000b ee6b3940
[   33.830419] bf00: 00000000 00000000 ee68bf4c ee68bf18 c01c1a24 c01c2818 00000000 00000000
[   33.838990] bf20: ee61b940 ee2f47c0 0000000b 000ce408 ee68bf80 c000f304 ee68a000 00000000
[   33.847544] bf40: ee68bf7c ee68bf50 c0152dd8 c01c1960 ee68bf7c c0170af8 ee68bf7c ee2f47c0
[   33.856099] bf60: ee2f47c0 000ce408 0000000b c000f304 ee68bfa4 ee68bf80 c0153330 c0152d34
[   33.864653] bf80: 00000000 00000000 0000000b 000ce408 b6e7fb50 00000004 00000000 ee68bfa8
[   33.873204] bfa0: c000f080 c01532e8 0000000b 000ce408 00000001 000ce408 0000000b 00000000
[   33.881763] bfc0: 0000000b 000ce408 b6e7fb50 00000004 0000000b 00000000 000c5758 00000000
[   33.890319] bfe0: 00000000 bec2c924 b6de422d b6e1d226 40000030 00000001 75716d2f 00657565
[   33.898890] [<c04df128>] (usb_udc_softconn_store) from [<c04112ac>] (dev_attr_store+0x28/0x34)
[   33.907920] [<c04112ac>] (dev_attr_store) from [<c01c2868>] (sysfs_kf_write+0x5c/0x60)
[   33.916200] [<c01c2868>] (sysfs_kf_write) from [<c01c1a24>] (kernfs_fop_write+0xd0/0x194)
[   33.924773] [<c01c1a24>] (kernfs_fop_write) from [<c0152dd8>] (vfs_write+0xb0/0x1bc)
[   33.932874] [<c0152dd8>] (vfs_write) from [<c0153330>] (SyS_write+0x54/0xb0)
[   33.940247] [<c0153330>] (SyS_write) from [<c000f080>] (ret_fast_syscall+0x0/0x48)
[   33.948160] Code: e1a01007 e12fff33 e5140004 e5143008 (e5933014)
[   33.954625] ---[ end trace f849bead94eab7ea ]---

Fixes: 2ccea03 (usb: gadget: introduce UDC Class)
Cc: <stable@vger.kernel.org> # v3.1+
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-10-23 09:55:43 -05:00
Felipe Balbi e0857ce58e usb: gadget: loopback: don't queue requests to bogus endpoints
A request allocated from e.g. ep1out cannot
be queued to any other endpoint. This bug has
been in f_loopback at least since mid-2011 and
since nobody has really screamed about it, we're
not backporting to any stable kernels.

Debugged with MUSB since that's the only controller
which complains about this case.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-10-23 09:55:42 -05:00
David Cohen c0d31b3c3d usb: ffs: fix regression when quirk_ep_out_aligned_size flag is set
The commit '2e4c7553cd usb: gadget: f_fs: add aio support' broke the
quirk implemented to align buffer size to maxpacketsize on out endpoint.
As result, functionfs does not work on Intel platforms using dwc3 driver
(i.e. Bay Trail and Merrifield). This patch fixes the issue.

This code is based on a previous Qiuxu's patch.

Fixes: 2e4c7553cd (usb: gadget: f_fs: add aio support)
Cc: <stable@vger.kernel.org> # v3.16+
Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-10-23 09:55:42 -05:00
Robert Baldyga a3058a5d82 usb: gadget: f_fs: remove redundant ffs_data_get()
During FunctionFS bind, ffs_data_get() function was called twice
(in functionfs_bind() and in ffs_do_functionfs_bind()), while on unbind
ffs_data_put() was called once (in functionfs_unbind() function).
In result refcount never reached value 0, and ffs memory resources has
been never released.

Since ffs_data_get() call in ffs_do_functionfs_bind() is redundant
and not neccessary, we remove it to have equal number of gets ans puts,
and free allocated memory after refcount reach 0.

Fixes: 5920cda (usb: gadget: FunctionFS: convert to new function
	interface with backward compatibility)
Cc: <stable@vger.kernel.org> # v3.14+
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-10-23 09:55:42 -05:00
Geert Uytterhoeven f1113be1bf usb: gadget: udc: USB_GADGET_XILINX should depend on HAS_DMA
If NO_DMA=y:

drivers/built-in.o: In function `xudc_done':
udc-xilinx.c:(.text+0x54f4d2): undefined reference to `usb_gadget_unmap_request'
drivers/built-in.o: In function `xudc_dma_send':
udc-xilinx.c:(.text+0x54f9f8): undefined reference to `dma_sync_single_for_cpu'
drivers/built-in.o: In function `xudc_read_fifo':
udc-xilinx.c:(.text+0x54ff4a): undefined reference to `dma_sync_single_for_cpu'
drivers/built-in.o: In function `xudc_ep_queue':
udc-xilinx.c:(.text+0x550e7c): undefined reference to `usb_gadget_map_request'

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-10-23 09:55:41 -05:00
Felipe Balbi a6615937bc usb: gadget: composite: enable BESL support
According to USB 2.0 ECN Errata for Link Power
Management (USB2-LPM-Errata-final.pdf), BESL
must be enabled if LPM is enabled.

This helps with USB30CV TD 9.21 LPM L1
Suspend Resume Test.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-10-23 09:55:41 -05:00
Felipe Balbi 3985f3ab08 usb: gadget: function: f_obex: fix Interface Descriptor Test
On USB20CV's Interface Descriptor Test, a series
of SetInterface/GetInterface requests are issued
and gadget driver is required to always return
correct alternate setting.

In one step of the test, g_serial with f_obex
was returning the wrong value (1 instead of 0).

In order to fix this, we will now hold currently
selected alternate setting inside our struct f_obex
and just return that from our ->get_alt()
implementation.

Note that his also simplifies the code a bit.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-10-20 15:58:49 -05:00
Felipe Balbi de1e6e799f usb: gadget: function: uac2: add a release method
devices are required to provide a release method. This
patch fixes the following WARN():

[   42.611159] ------------[ cut here ]------------
[   42.616025] WARNING: CPU: 0 PID: 1453 at drivers/base/core.c:250 device_release+0x94/0xa0()
[   42.624820] Device 'snd_uac2.0' does not have a release() function, it is broken and must be fixed.
[   42.634328] Modules linked in: usb_f_uac2 g_audio(-) libcomposite configfs xhci_hcd snd_soc_davinci_mcasp snd_soc_edma snd_soc_tlv320aic3x snd_soc_omap snd_soc_evm snd_soc_core dwc3 snd_compress omapdrm snd_pcm_dmaengine snd_pcm snd_timer snd fb_sys_fops lis3lv02d_i2c matrix_keypad dwc3_omap lis3lv02d panel_dpi input_polldev soundcore
[   42.665687] CPU: 0 PID: 1453 Comm: modprobe Tainted: G      D        3.17.0-rc6-00448-g9f3d0ec-dirty #188
[   42.675756] [<c0017338>] (unwind_backtrace) from [<c0012fdc>] (show_stack+0x20/0x24)
[   42.683911] [<c0012fdc>] (show_stack) from [<c0647fbc>] (dump_stack+0x8c/0xa4)
[   42.691526] [<c0647fbc>] (dump_stack) from [<c0049950>] (warn_slowpath_common+0x7c/0xa0)
[   42.700004] [<c0049950>] (warn_slowpath_common) from [<c00499b4>] (warn_slowpath_fmt+0x40/0x48)
[   42.709194] [<c00499b4>] (warn_slowpath_fmt) from [<c0405f7c>] (device_release+0x94/0xa0)
[   42.717794] [<c0405f7c>] (device_release) from [<c032e8e8>] (kobject_cleanup+0x4c/0x7c)
[   42.726189] [<c032e8e8>] (kobject_cleanup) from [<c032e7c8>] (kobject_put+0x60/0x90)
[   42.734316] [<c032e7c8>] (kobject_put) from [<c0406320>] (put_device+0x24/0x28)
[   42.741995] [<c0406320>] (put_device) from [<c040c008>] (platform_device_unregister+0x2c/0x30)
[   42.751061] [<c040c008>] (platform_device_unregister) from [<bf2b6b70>] (afunc_unbind+0x2c/0x68 [usb_f_uac2])
[   42.761523] [<bf2b6b70>] (afunc_unbind [usb_f_uac2]) from [<bf29dbec>] (remove_config.isra.8+0xe8/0x100 [libcomposite])
[   42.772868] [<bf29dbec>] (remove_config.isra.8 [libcomposite]) from [<bf29f9a4>] (__composite_unbind+0x48/0xb0 [libcomposite])
[   42.784855] [<bf29f9a4>] (__composite_unbind [libcomposite]) from [<bf29fa28>] (composite_unbind+0x1c/0x20 [libcomposite])
[   42.796446] [<bf29fa28>] (composite_unbind [libcomposite]) from [<c04d229c>] (usb_gadget_remove_driver+0x78/0xb0)
[   42.807224] [<c04d229c>] (usb_gadget_remove_driver) from [<c04d2348>] (usb_gadget_unregister_driver+0x74/0xb8)
[   42.817742] [<c04d2348>] (usb_gadget_unregister_driver) from [<bf29db00>] (usb_composite_unregister+0x1c/0x20 [libcomposite])
[   42.829632] [<bf29db00>] (usb_composite_unregister [libcomposite]) from [<bf2b1084>] (audio_driver_exit+0x14/0x1c [g_audio])
[   42.841430] [<bf2b1084>] (audio_driver_exit [g_audio]) from [<c00c0fe0>] (SyS_delete_module+0x120/0x1b0)
[   42.851415] [<c00c0fe0>] (SyS_delete_module) from [<c000ed40>] (ret_fast_syscall+0x0/0x48)
[   42.860075] ---[ end trace bb22e678d8d6db7b ]---
root@saruman:~#

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-10-20 15:58:49 -05:00
Felipe Balbi f3bb7b2981 usb: gadget: function: uac2: prevent double ep disable
without this check, f_uac2 would try to disable
the same endpoint twice. Fix that.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-10-20 15:58:49 -05:00
Felipe Balbi 703a303c18 usb: gadget: function: uac2: add wMaxPacketSize to ep desc
Endpoint descriptors should pass wMaxPacketSize. Note
that this also fixes USB20CV Other Speed Endpoint
Descriptor Tests.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-10-20 15:58:49 -05:00
Felipe Balbi e3122f5fed usb: gadget: function: uvc: disable endpoints on ->disable()
when our ->disable() method is called, we must
make sure to teardown all our resources, including
endpoints.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-10-20 15:58:48 -05:00
Felipe Balbi 62e370785c usb: gadget: function: uvc: manage our video control endpoint
just like any other endpoint, we must enable/disable
our video control endpoint based on calls to our
->set_alt() method.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-10-20 15:58:48 -05:00
Felipe Balbi 52ec49a5e5 usb: gadget: function: acm: make f_acm pass USB20CV Chapter9
During Halt Endpoint Test, our interrupt endpoint
will be disabled, which will clear out ep->desc
to NULL. Unless we call config_ep_by_speed() again,
we will not be able to enable this endpoint which
will make us fail that test.

Fixes: f9c56cd (usb: gadget: Clear usb_endpoint_descriptor
	inside the struct usb_ep on disable)
Cc: <stable@vger.kernel.org> # v3.4+
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-10-20 15:58:48 -05:00
Felipe Balbi e975be287b usb: gadget: function: uvc: return correct alt-setting
If our alternate setting has been selected, we must
return that on a subsequent Get Interface request
even if we're not streaming.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-10-20 15:58:48 -05:00
Felipe Balbi c92bae7537 usb: gadget: function: uvc: make sure to balance ep enable/disable
If a set_alt() to the same alternate setting that's
already selected is received, functions are required
to reset the interface state, this means we must disable
all endpoints and reenable them again.

This is also documented on our kdoc for struct usb_function

* @set_alt: (REQUIRED) Reconfigures altsettings; function drivers may
*	initialize usb_ep.driver data at this time (when it is used).
*	Note that setting an interface to its current altsetting resets
*	interface state, and that all interfaces have a disabled state.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-10-20 15:58:48 -05:00
Felipe Balbi d7577b3892 usb: gadget: function: uvc: conditionally dequeue
We shouldn't try to dequeue a NULL pointer.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-10-20 15:58:48 -05:00
Wolfram Sang 6d3f5f2d89 usb: gadget: udc: drop owner assignment from platform_drivers
A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-10-20 16:21:48 +02:00
Wolfram Sang e55a013716 usb: gadget: legacy: drop owner assignment from platform_drivers
A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-10-20 16:21:48 +02:00
Linus Torvalds 77c688ac87 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs updates from Al Viro:
 "The big thing in this pile is Eric's unmount-on-rmdir series; we
  finally have everything we need for that.  The final piece of prereqs
  is delayed mntput() - now filesystem shutdown always happens on
  shallow stack.

  Other than that, we have several new primitives for iov_iter (Matt
  Wilcox, culled from his XIP-related series) pushing the conversion to
  ->read_iter()/ ->write_iter() a bit more, a bunch of fs/dcache.c
  cleanups and fixes (including the external name refcounting, which
  gives consistent behaviour of d_move() wrt procfs symlinks for long
  and short names alike) and assorted cleanups and fixes all over the
  place.

  This is just the first pile; there's a lot of stuff from various
  people that ought to go in this window.  Starting with
  unionmount/overlayfs mess...  ;-/"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (60 commits)
  fs/file_table.c: Update alloc_file() comment
  vfs: Deduplicate code shared by xattr system calls operating on paths
  reiserfs: remove pointless forward declaration of struct nameidata
  don't need that forward declaration of struct nameidata in dcache.h anymore
  take dname_external() into fs/dcache.c
  let path_init() failures treated the same way as subsequent link_path_walk()
  fix misuses of f_count() in ppp and netlink
  ncpfs: use list_for_each_entry() for d_subdirs walk
  vfs: move getname() from callers to do_mount()
  gfs2_atomic_open(): skip lookups on hashed dentry
  [infiniband] remove pointless assignments
  gadgetfs: saner API for gadgetfs_create_file()
  f_fs: saner API for ffs_sb_create_file()
  jfs: don't hash direct inode
  [s390] remove pointless assignment of ->f_op in vmlogrdr ->open()
  ecryptfs: ->f_op is never NULL
  android: ->f_op is never NULL
  nouveau: __iomem misannotations
  missing annotation in fs/file.c
  fs: namespace: suppress 'may be used uninitialized' warnings
  ...
2014-10-13 11:28:42 +02:00
Al Viro fb6c3225b4 gadgetfs: saner API for gadgetfs_create_file()
return dentry, not inode.  dev->inode is never used by anything,
don't bother with storing it.

Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2014-10-09 02:39:14 -04:00
Al Viro 1bb27cacf4 f_fs: saner API for ffs_sb_create_file()
make it return dentry instead of inode

Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2014-10-09 02:39:14 -04:00
Linus Torvalds 35a9ad8af0 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller:
 "Most notable changes in here:

   1) By far the biggest accomplishment, thanks to a large range of
      contributors, is the addition of multi-send for transmit.  This is
      the result of discussions back in Chicago, and the hard work of
      several individuals.

      Now, when the ->ndo_start_xmit() method of a driver sees
      skb->xmit_more as true, it can choose to defer the doorbell
      telling the driver to start processing the new TX queue entires.

      skb->xmit_more means that the generic networking is guaranteed to
      call the driver immediately with another SKB to send.

      There is logic added to the qdisc layer to dequeue multiple
      packets at a time, and the handling mis-predicted offloads in
      software is now done with no locks held.

      Finally, pktgen is extended to have a "burst" parameter that can
      be used to test a multi-send implementation.

      Several drivers have xmit_more support: i40e, igb, ixgbe, mlx4,
      virtio_net

      Adding support is almost trivial, so export more drivers to
      support this optimization soon.

      I want to thank, in no particular or implied order, Jesper
      Dangaard Brouer, Eric Dumazet, Alexander Duyck, Tom Herbert, Jamal
      Hadi Salim, John Fastabend, Florian Westphal, Daniel Borkmann,
      David Tat, Hannes Frederic Sowa, and Rusty Russell.

   2) PTP and timestamping support in bnx2x, from Michal Kalderon.

   3) Allow adjusting the rx_copybreak threshold for a driver via
      ethtool, and add rx_copybreak support to enic driver.  From
      Govindarajulu Varadarajan.

   4) Significant enhancements to the generic PHY layer and the bcm7xxx
      driver in particular (EEE support, auto power down, etc.) from
      Florian Fainelli.

   5) Allow raw buffers to be used for flow dissection, allowing drivers
      to determine the optimal "linear pull" size for devices that DMA
      into pools of pages.  The objective is to get exactly the
      necessary amount of headers into the linear SKB area pre-pulled,
      but no more.  The new interface drivers use is eth_get_headlen().
      From WANG Cong, with driver conversions (several had their own
      by-hand duplicated implementations) by Alexander Duyck and Eric
      Dumazet.

   6) Support checksumming more smoothly and efficiently for
      encapsulations, and add "foo over UDP" facility.  From Tom
      Herbert.

   7) Add Broadcom SF2 switch driver to DSA layer, from Florian
      Fainelli.

   8) eBPF now can load programs via a system call and has an extensive
      testsuite.  Alexei Starovoitov and Daniel Borkmann.

   9) Major overhaul of the packet scheduler to use RCU in several major
      areas such as the classifiers and rate estimators.  From John
      Fastabend.

  10) Add driver for Intel FM10000 Ethernet Switch, from Alexander
      Duyck.

  11) Rearrange TCP_SKB_CB() to reduce cache line misses, from Eric
      Dumazet.

  12) Add Datacenter TCP congestion control algorithm support, From
      Florian Westphal.

  13) Reorganize sk_buff so that __copy_skb_header() is significantly
      faster.  From Eric Dumazet"

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1558 commits)
  netlabel: directly return netlbl_unlabel_genl_init()
  net: add netdev_txq_bql_{enqueue, complete}_prefetchw() helpers
  net: description of dma_cookie cause make xmldocs warning
  cxgb4: clean up a type issue
  cxgb4: potential shift wrapping bug
  i40e: skb->xmit_more support
  net: fs_enet: Add NAPI TX
  net: fs_enet: Remove non NAPI RX
  r8169:add support for RTL8168EP
  net_sched: copy exts->type in tcf_exts_change()
  wimax: convert printk to pr_foo()
  af_unix: remove 0 assignment on static
  ipv6: Do not warn for informational ICMP messages, regardless of type.
  Update Intel Ethernet Driver maintainers list
  bridge: Save frag_max_size between PRE_ROUTING and POST_ROUTING
  tipc: fix bug in multicast congestion handling
  net: better IFF_XMIT_DST_RELEASE support
  net/mlx4_en: remove NETDEV_TX_BUSY
  3c59x: fix bad split of cpu_to_le32(pci_map_single())
  net: bcmgenet: fix Tx ring priority programming
  ...
2014-10-08 21:40:54 -04:00
Arnd Bergmann a173dc447d usb: gadget: uvc: fix up uvcg_v4l2_get_unmapped_area typo
Patch "usb: gadget: uvc: rename functions to avoid conflicts with host uvc"
renamed a lot of symbols but missed one references that was inside of
an #ifdef:

drivers/usb/gadget/function/uvc_v4l2.c:363:23: error: 'uvcg_v4l2_get_unmapped_area' undeclared here (not in a function)
  .get_unmapped_area = uvcg_v4l2_get_unmapped_area,
                       ^
drivers/usb/gadget/function/uvc_v4l2.c:344:22: warning: 'uvc_v4l2_get_unmapped_area' defined but not used [-Wunused-function]
 static unsigned long uvc_v4l2_get_unmapped_area(struct file *file,
                      ^

This renames the reference according the changed function name.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 7ea95b1108 ("usb: gadget: uvc: rename functions to avoid conflicts with host uvc")
Cc: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Cc: Michael Grzeschik <m.grzeschik@pengutronix.de>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-29 11:51:54 -04:00
Michal Sojka 0cfbd328d6 usb: Add LED triggers for USB activity
With this patch, USB activity can be signaled by blinking a LED. There
are two triggers, one for activity on USB host and one for USB gadget.

Both triggers should work with all host/device controllers. Tested only
with musb.

Performace: I measured performance overheads on ARM Cortex-A8 (TI
AM335x) running on 600 MHz.

Duration of usb_led_activity():
- with no LED attached to the trigger:        2 ± 1 µs
- with one GPIO LED attached to the trigger:  2 ± 1 µs or 8 ± 2 µs (two peaks in histogram)

Duration of functions calling usb_led_activity() (with this patch
applied and no LED attached to the trigger):
- __usb_hcd_giveback_urb():    10 - 25 µs
- usb_gadget_giveback_request(): 2 - 6 µs

Signed-off-by: Michal Sojka <sojka@merica.cz>
Acked-by: Felipe Balbi <balbi@ti.com>
Tested-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-25 17:05:12 +02:00
Michal Sojka 304f7e5e1d usb: gadget: Refactor request completion
Use the recently introduced usb_gadget_giveback_request() in favor of
direct invocation of the completion routine.

All places in drivers/usb/ matching "[-.]complete(" were replaced with a
call to usb_gadget_giveback_request(). This was compile-tested with all
ARM drivers enabled and runtime-tested for musb.

Signed-off-by: Michal Sojka <sojka@merica.cz>
Acked-by: Felipe Balbi <balbi@ti.com>
Tested-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-25 16:58:50 +02:00
Michal Sojka 3fc2aa5522 usb: gadget: Introduce usb_gadget_giveback_request()
All USB peripheral controller drivers call completion routines directly.
This patch adds usb_gadget_giveback_request() which will be used instead
of direct invocation in the next patch. The goal here is to have a place
where common functionality can be added.

Signed-off-by: Michal Sojka <sojka@merica.cz>
Acked-by: Felipe Balbi <balbi@ti.com>
Tested-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-25 16:58:17 +02:00
David S. Miller 1f6d80358d Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts:
	arch/mips/net/bpf_jit.c
	drivers/net/can/flexcan.c

Both the flexcan and MIPS bpf_jit conflicts were cases of simple
overlapping changes.

Signed-off-by: David S. Miller <davem@davemloft.net>
2014-09-23 12:09:27 -04:00
Felipe Balbi bf17eba7ae Revert "usb: gadget: composite: dequeue cdev->req before free it in composite_dev_cleanup"
This reverts commit f2267089ea.

That commit causes more problem than fixes. Firstly, kfree()
should be called after usb_ep_dequeue() and secondly, the way
things are, we will try to dequeue a request that has already
completed much more frequently than one which is pending.

Cc: Li Jun <b47624@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Cc: stable <stable@vger.kernel.org> # 3.17
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23 07:56:21 -07:00
Felipe Balbi 72a65a0d19 Revert "usb: gadget: composite: dequeue cdev->req before free its buffer"
This reverts commit be0a8887bb.

The original commit f2267089ea
(usb: gadget: composite: dequeue cdev->req before free it in
composite_dev_cleanup) ended up being reverted because it caused
more issues then fixed. We will also revert this counter part
commit so we start clean to properly add that idea back.

Cc: Li Jun <b47624@freescale.com>
Signed-of-by: Felipe Balbi <balbi@ti.com>
2014-09-18 09:42:49 -05:00
Andreas Larsson 5b484989a9 usb: gadget: gr_udc: Add bounce buffer to handle odd sized OUT requests
This adds a bounce buffer that handles the end of OUT requests where
req.length is not divisible by ep->ep.maxpacket.

Before this, such requests were rejected as the DMA engine cannot
restrict itself to buffers that are smaller than ep->ep.maxpacket.

Signed-off-by: Andreas Larsson <andreas@gaisler.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-16 10:01:45 -05:00
Andreas Larsson af54954ad0 usb: gadget: udc_core: Use right kobj when calling sysfs_notify
The state attribute is connected to the kobj of the udc, not the gadget.

Signed-off-by: Andreas Larsson <andreas@gaisler.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-16 10:01:45 -05:00
Laurent Pinchart 6dd5b021bd usb: gadget: uvc: Simplify uvcg_video_pump by using local variable
Use the local queue variable instead of computing it every time.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-16 09:59:54 -05:00
Laurent Pinchart e102609f10 usb: gadget: uvc: Fix endianness mismatches
The struct usb_endpoint_descriptor wMaxPacketSize field the struct
usb_ss_ep_comp_descriptor wBytesPerInterval field are stored in
little-endian format. Convert the values from CPU order to little endian
before storing the values.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-16 09:59:47 -05:00
Fengguang Wu 4a6698b80c usb: gadget: uvc: uvc_alloc() can be static
The function isn't called from outside of its compilation unit, make it
static.

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-16 09:58:52 -05:00
Robert Baldyga 1b0bf88fd8 usb: gadget: f_fs: virtual endpoint address mapping
This patch introduces virtual endpoint address mapping. It separates
function logic form physical endpoint addresses making it more hardware
independent.

Following modifications changes user space API, so to enable them user
have to switch on the FUNCTIONFS_VIRTUAL_ADDR flag in descriptors.

Endpoints are now refered using virtual endpoint addresses chosen by
user in endpoint descpriptors. This applies to each context when endpoint
address can be used:
- when accessing endpoint files in FunctionFS filesystemi (in file name),
- in setup requests directed to specific endpoint (in wIndex field),
- in descriptors returned by FUNCTIONFS_ENDPOINT_DESC ioctl.

In endpoint file names the endpoint address number is formatted as
double-digit hexadecimal value ("ep%02x") which has few advantages -
it is easy to parse, allows to easly recognize endpoint direction basing
on its name (IN endpoint number starts with digit 8, and OUT with 0)
which can be useful for debugging purpose, and it makes easier to introduce
further features allowing to use each endpoint number in both directions
to have more endpoints available for function if hardware supports this
(for example we could have ep01 which is endpoint 1 with OUT direction,
and ep81 which is endpoint 1 with IN direction).

Physical endpoint address can be still obtained using ioctl named
FUNCTIONFS_ENDPOINT_REVMAP, but now it's not neccesary to handle
USB transactions properly.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-16 09:58:21 -05:00
Felipe Balbi 4cd41ffd27 Linux 3.17-rc5
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJUFjfVAAoJEHm+PkMAQRiGANkIAIU3PNrAz9dIItq8a/rEAhnx
 l2shHoOyEmyNR2apholM3BPUNX50cbsc/HGdi7lZKLkA/ifAj6B9nFD2NzVsIChD
 1QWVcvdkKlVuxXCDd26qbijlfmbTOAWrLw9ntvM+J6ZtECM6zCAZF4MAV/FwogPq
 ETGKD76AxJtVIhBMS99troAiC1YxmQ7DKgEr8CraTOR1qwXEonnPCmN/IZA6x2/G
 EXiihOuQB5me1X7k4PI0V8CDscQOn+3B2CQHIrjRB+KiTF+iKIuI8n6ORC6bpFh+
 U8UZP9wLlIG1BrUHG83pIndglIHotqPcjmtfl1WGrRr2hn7abzVSfV+g5Syo3Vg=
 =Ep+s
 -----END PGP SIGNATURE-----

Merge tag 'v3.17-rc5' into next

Linux 3.17-rc5

Signed-off-by: Felipe Balbi <balbi@ti.com>

Conflicts:
	Documentation/devicetree/bindings/usb/mxs-phy.txt
	drivers/usb/phy/phy-mxs-usb.c
2014-09-16 09:53:59 -05:00
Peter Chen 974a70bdec usb: gadget: udc-core: add utility for bus reset
The udc driver can notify the udc core that bus reset occurs by
calling this utility, the core will notify gadget driver this
information and update gadget state accordingly.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-12 09:12:51 -05:00
Subbaraya Sundeep Bhatta 1f7c516600 usb: gadget: Add xilinx usb2 device support
Xilinx USB2 device is a soft IP which supports both full
and high speed USB 2.0 data transfers. This patch adds
xilinx usb2 device driver support.

Signed-off-by: Subbaraya Sundeep Bhatta <sbhatta@xilinx.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-12 09:12:49 -05:00
Michal Nazarewicz fe00bcbf8a usb: f_fs: replace BUG in dead-code with less serious WARN_ON
Even though the BUG() in __ffs_event_add is a dead-code, it is still
better to warn rather then crash the system if that code ever gets
executed.

Reported-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-11 12:15:54 -05:00
Robert Baldyga c559a35341 usb: gadget: f_fs: add ioctl returning ep descriptor
This patch introduces ioctl named FUNCTIONFS_ENDPOINT_DESC, which
returns endpoint descriptor to userspace. It works only if function
is active.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-09 10:04:45 -05:00
Peter Chen e45cfa2051 usb: gadget: dbgp: add reset API at usb_gadget_driver
Add reset API at usb_gadget_driver, it calls disconnect handler currently,
but may do different things in future.

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-09 10:00:15 -05:00
Peter Chen 0eba4550fc usb: gadget: gadgetfs: add reset API at usb_gadget_driver
Add reset API at usb_gadget_driver, it calls disconnect handler currently,
but may do different things in future.

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-09 10:00:06 -05:00
Peter Chen 02f751b43f usb: gadget: configfs: add reset API at usb_gadget_driver
Add reset API at usb_gadget_driver, it calls disconnect handler currently,
but may do different things in future.

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-09 09:59:50 -05:00
Peter Chen d8a816fc6f usb: gadget: composite: add reset API at usb_gadget_driver
Add reset API at usb_gadget_driver, it calls disconnect handler currently,
but may do different things in future.

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-09 09:58:54 -05:00
Dan Carpenter 85b06f5e53 usb: gadget: f_fs: signedness bug in __ffs_func_bind_do_descs()
We need "idx" to be signed for the error handling to work.

Fixes: 6d5c1c77bb ('usb: gadget: f_fs: fix the redundant ep files problem')
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-09 09:51:21 -05:00
Andrzej Pietrasiewicz 13443799b5 usb: gadget: f_uvc: use usb_gstrings_attach
Attach strings to gadget with usb_strings_attach.
It is required for correct instantiation of functions more than once:
instead of modifying the local uvc_en_us_strings a function instance
specific copy is created with usb_gstrings_attach.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Tested-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-09 09:49:44 -05:00
Andrzej Pietrasiewicz cb47d889e6 usb: gadget: f_uvc: remove compatibility layer
There are no users of the old interface left. Remove it.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Tested-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-09 09:49:41 -05:00