Commit graph

2319 commits

Author SHA1 Message Date
Felipe Balbi c139e1425f Linux 3.13-rc4
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.15 (GNU/Linux)
 
 iQEcBAABAgAGBQJSrhGrAAoJEHm+PkMAQRiGsNoH/jIK3CsQ2lbW7yRLXmfgtbzz
 i2Kep6D4SDvmaLpLYOVC8xNYTiE8jtTbSXHomwP5wMZ63MQDhBfnEWsEWqeZ9+D9
 3Q46p0QWuoBgYu2VGkoxTfygkT6hhSpwWIi3SeImbY4fg57OHiUil/+YGhORM4Qc
 K4549OCTY3sIrgmWL77gzqjRUo+pQ4C73NKqZ3+5nlOmYBZC1yugk8mFwEpQkwhK
 4NRNU760Fo+XIht/bINqRiPMddzC15p0mxvJy3cDW8bZa1tFSS9SB7AQUULBbcHL
 +2dFlFOEb5SV1sNiNPrJ0W+h2qUh2e7kPB0F8epaBppgbwVdyQoC2u4uuLV2ZN0=
 =lI2r
 -----END PGP SIGNATURE-----

Merge tag 'v3.13-rc4' into next

Linux 3.13-rc4

* tag 'v3.13-rc4': (1001 commits)
  Linux 3.13-rc4
  null_blk: mem garbage on NUMA systems during init
  radeon_pm: fix oops in hwmon_attributes_visible() and radeon_hwmon_show_temp_thresh()
  Revert "selinux: consider filesystem subtype in policies"
  igb: Fix for issue where values could be too high for udelay function.
  i40e: fix null dereference
  ARM: fix asm/memory.h build error
  dm array: fix a reference counting bug in shadow_ablock
  dm space map: disallow decrementing a reference count below zero
  mm: memcg: do not allow task about to OOM kill to bypass the limit
  mm: memcg: fix race condition between memcg teardown and swapin
  thp: move preallocated PTE page table on move_huge_pmd()
  mfd/rtc: s5m: fix register updating by adding regmap for RTC
  rtc: s5m: enable IRQ wake during suspend
  rtc: s5m: limit endless loop waiting for register update
  rtc: s5m: fix unsuccesful IRQ request during probe
  drivers/rtc/rtc-s5m.c: fix info->rtc assignment
  include/linux/kernel.h: make might_fault() a nop for !MMU
  drivers/rtc/rtc-at91rm9200.c: correct alarm over day/month wrap
  procfs: also fix proc_reg_get_unmapped_area() for !MMU case
  ...

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-19 09:18:53 -06:00
Jingoo Han 4a5ee77caa usb: gadget: f_sourcesink: Fix sparse warning
Make local symbols static in order to fix the following sparse
warnings.

drivers/usb/gadget/f_sourcesink.c:205:34: warning: symbol 'ss_source_comp_desc' was not declared. Should it be static?
drivers/usb/gadget/f_sourcesink.c:222:34: warning: symbol 'ss_sink_comp_desc' was not declared. Should it be static?
drivers/usb/gadget/f_sourcesink.c:240:34: warning: symbol 'ss_iso_source_comp_desc' was not declared. Should it be static?
drivers/usb/gadget/f_sourcesink.c:258:34: warning: symbol 'ss_iso_sink_comp_desc' was not declared. Should it be static?

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-17 13:17:44 -06:00
Jingoo Han b3d589f279 usb: gadget: f_serial: Fix sparse warning
Make local symbol static in order to fix the following sparse
warning.

drivers/usb/gadget/f_serial.c:357:21: warning: symbol 'gser_alloc' was not declared. Should it be static?

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-17 13:17:44 -06:00
Jingoo Han c3af8223d5 usb: gadget: f_phonet: Fix sparse warning
Make local symbol static in order to fix the following sparse
warning.

drivers/usb/gadget/f_phonet.c:692:21: warning: symbol 'phonet_alloc' was not declared. Should it be static?

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-17 13:17:44 -06:00
Jingoo Han 9272fe5a99 usb: gadget: f_obex: Fix sparse warning
Make local symbol static in order to fix the following sparse
warning.

drivers/usb/gadget/f_obex.c:502:21: warning: symbol 'obex_alloc' was not declared. Should it be static?

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-17 13:17:43 -06:00
Jingoo Han 36a6112548 usb: gadget: f_ncm: Fix sparse warning
Make local symbol static in order to fix the following sparse
warning.

drivers/usb/gadget/f_ncm.c:1389:21: warning: symbol 'ncm_alloc' was not declared. Should it be static?

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-17 13:17:43 -06:00
Jingoo Han 6195174ef4 usb: gadget: f_mass_storage: Fix sparse warning
Use NULL instead of 0 when returning pointer, to fix the following
sparse warnings.

drivers/usb/gadget/f_mass_storage.c:3114:60: warning: Using plain integer as NULL pointer
drivers/usb/gadget/f_mass_storage.c:3114:63: warning: Using plain integer as NULL pointer

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-17 13:17:43 -06:00
Jingoo Han 8002418dff usb: gadget: f_loopback: Fix sparse warning
Make local symbols static in order to fix the following sparse
warnings.

drivers/usb/gadget/f_loopback.c:123:34: warning: symbol 'ss_loop_source_comp_desc' was not declared. Should it be static?
drivers/usb/gadget/f_loopback.c:139:34: warning: symbol 'ss_loop_sink_comp_desc' was not declared. Should it be static?

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-17 13:17:42 -06:00
Jingoo Han 5056ee83e8 usb: gadget: atmel_usba: Fix sparse warning
'usba_gadget_template' is used only in this file. Thus, make
'usba_gadget_template' static, in order to fix the following
sparse warning.

warning: symbol 'usba_gadget_template' was not declared. Should it be static?

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-17 13:17:42 -06:00
Jingoo Han 40a8fb2a67 usb: gadget: atmel_usba: Use devm_*() functions
Use devm_*() functions to make cleanup paths simpler.

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-17 13:17:42 -06:00
Andrzej Pietrasiewicz 45ab460975 usb: gadget: nokia: fix error recovery path for optional functions
In the nokia gadget some USB functions (obex 1 and 2, phonet) are optional.

If at the start of nokia_bind_config e.g. fi_phonet is an error pointer,
which can happen because we don't fail the bind process if
usb_get_function_instance() fails for fi_phonet, then f_phonet is NULL, and

phonet_stat = usb_add_function(c, f_phonet);

is never called and phonet_stat remains 0.

If, in these circumstances, we hit the err_conf label then !phonet_stat
evaluates to true and we try usb_remove_function() with its second
parameter being f_phonet which is NULL and it causes NULL pointer
dereference.

This patch changes the initial values of (obex1|obex2|phonet)_stat to a
nonzero value so that if the err_conf label is hit while the respective
functions have not been acquired the usb_remove_function() is not called
for those functions.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-17 13:17:41 -06:00
Robert Baldyga e117e742d3 usb: gadget: add "maxpacket_limit" field to struct usb_ep
This patch adds "maxpacket_limit" to struct usb_ep. This field contains
maximum value of maxpacket supported by driver, and is set in driver probe.
This value should be used by autoconfig() function, because value of field
"maxpacket" is set to value from endpoint descriptor when endpoint becomes
enabled. So when autoconfig() function will be called again for this endpoint,
"maxpacket" value will contain wMaxPacketSize from descriptior instead of
maximum packet size for this endpoint.

For this reason this patch adds new field "maxpacket_limit" which contains
value of maximum packet size (which defines maximum endpoint capabilities).
This value is used in ep_matches() function used by autoconfig().

Value of "maxpacket_limit" should be set in UDC driver probe function, using
usb_ep_set_maxpacket_limit() function, defined in gadget.h. This function
set choosen value to both "maxpacket_limit" and "maxpacket" fields.

This patch modifies UDC drivers by adding support for maxpacket_limit.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-17 13:17:41 -06:00
Felipe Balbi f8800d47bc usb: gadget: f_fs: fix sparse warning
use NULL when returning NULL pointers, not 0.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-12 13:43:40 -06:00
Andrzej Pietrasiewicz b658499f0f usb: gadget: FunctionFS: add configfs support
Add support for using FunctionFS in configfs-based USB gadgets.

[ balbi@ti.com : removed redefinition of VERBOSE_DEBUG and few
	trailing whitespaces ]

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-12 13:43:40 -06:00
Andrzej Pietrasiewicz 3d8d72a4c3 usb: gadget: FunctionFS: Remove compatibility layer
There are no old function interface users left, so the old interface can
be removed.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-12 13:43:40 -06:00
Andrzej Pietrasiewicz 6f823cd530 usb: gadget: g_ffs: convert to new interface of f_fs
Prepare for configfs integration. Use the new interface so that f_fs can be
made a module.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-12 13:43:39 -06:00
Andrzej Pietrasiewicz 5920cda627 usb: gadget: FunctionFS: convert to new function interface with backward compatibility
This is required in order to integrate configfs support.
f_fs needs to be a separately compiled module and so it needs to use the new
interface.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-12 13:43:39 -06:00
Andrzej Pietrasiewicz 4b187fceec usb: gadget: FunctionFS: add devices management code
This will be required in order to use the new function interface
(usb_get_function_instance/usb_put_function_instance)

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyunmgin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-12 13:43:39 -06:00
Andrzej Pietrasiewicz e72c39c069 usb: gadget: FunctionFS: create utility file
A header file to be used by f_fs.c and g_ffs.c will be required when
f_fs.c is converted into a module.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-12 13:43:38 -06:00
Andrzej Pietrasiewicz e6f3862fa1 usb: gadget: FunctionFS: Remove VLAIS usage from gadget code
The use of variable length arrays in structs (VLAIS) in the Linux Kernel code
precludes the use of compilers which don't implement VLAIS (for instance the
Clang compiler). This alternate patch calculates offsets into the kmalloc-ed
memory buffer using macros. The previous patch required multiple kmalloc and
kfree calls. This version uses "group" vs "struct" since it really is not a
struct and is essentially a group of VLA in a common allocated block. This
version also fixes the issues pointed out by Andrzej Pietrasiewicz and
Michal Nazarewicz.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Signed-off-by: Behan Webster <behanw@converseincode.com>

[elimination of miexed declaration and code, checkpatch cleanup]
[fixes after Michal's review]
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-12 13:43:38 -06:00
Andrzej Pietrasiewicz 9c2b85f4f9 usb: gadget: rndis: merge u_rndis.ko with usb_f_rndis.ko
The rndis function's users use only the new interface, so the two modules
can be merged.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-12 13:43:38 -06:00
Andrzej Pietrasiewicz 31f89db1b8 usb: gadget: f_rndis: remove compatibility layer
There are no old function interface users left, so the old interface
can be removed.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-12 13:43:37 -06:00
Andrzej Pietrasiewicz 6e257b1421 usb: gadget: g_ffs: convert to new interface of f_rndis
There is a new interface of f_rndis and g_ffs is the last to use the old one.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-12 13:43:37 -06:00
Andrzej Pietrasiewicz 05de3fe3d1 usb: gadget: f_subset: remove compatibility layer
There are no old function interface users left, so the old interface
can be removed.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-12 13:43:37 -06:00
Andrzej Pietrasiewicz 85aec59fab usb: gadget: g_ffs: convert to new interface of f_subset
There is a new function interface of f_subset and g_ffs is the last to use
the old one.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-12 13:43:37 -06:00
Andrzej Pietrasiewicz f1a2ca2e4b usb: gadget: f_ecm: remove compatibility layer
There are no old function interface users left, so the old interface
can be removed.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmim Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-12 13:43:36 -06:00
Andrzej Pietrasiewicz f212ad4e39 usb: gadget: g_ffs: convert to new interface of f_ecm
There is a new funtion interface and g_ffs is the last gadget to use the old.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-12 13:43:36 -06:00
Andrzej Pietrasiewicz 1ec8f00f34 usb: gadget: g_ffs: remove a reduntant gfs_ether_setup variable
Since d6a0143985
usb: gadget: move the global the_dev variable to their users
"the_dev" variable can be used as a "setup done" flag; non-NULL
meaning "setup done", NULL meaning "setup not done". Moreover,
gether_cleanup() can be safely called with a NULL argument.

Corrected a comment to be consistent with the code.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-12 13:43:36 -06:00
Andrzej Pietrasiewicz 1933861db4 usb: gadget: configfs: allow setting function instance's name
USB function's configfs config group is created in a generic way in
usb/gadget/configfs.c:function_make(), which in turn delegates actual
allocation and setup of the USB function instance to a particular
implementation, e.g. in f_acm.c. The said implementation does its job
in a parameter-less function e.g. acm_alloc_instance(), which results
in creating an unnamed config group, whose name is set later in
function_make(). function_make() creates the name by parsing a string
of the form:

<function name>.<instance name>

which comes from userspace as a parameter to mkdir invocation.

Up to now only <function name> has been used, while <instance name>
has been ignored. This patch adds a set_inst_name() operation to
struct usb_function_instance which allows passing the <instance name>
from function_make() so that it is not ignored. It is entirely up to the
implementor of set_inst_name() what to do with the <instance name>.

In a typical case, the struct usb_function_instance is embedded in a
larger struct which is retrieved in set_inst_name() with container_of(),
and the larger struct contains a field to store the <instance name>.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-12 13:43:35 -06:00
Robert Baldyga b963a81a48 usb: gadget: s3c-hsotg: add flush TX FIFO when kill all requests
This patch adds flushing TX FIFO in kill_all_requests() function in
dedicated-fifo mode. It's because when requests are killed (when endpoint is
disabled or in case of device reset/disconnection) in FIFO can stay some
unsent data. In the worst case FIFO can stay full, and then if endpoint will
be back enabled, sending new data will be impossible.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-12 13:43:35 -06:00
Robert Baldyga 295538ff7e usb: gadget: s3c-hsotg: fix maxpacket size in s3c_hsotg_irq_enumdone
This patch set maximum possible maxpacket value for each speed. Previous
values didn't allow to use maxpacket sizes greater than 64 in full speed
and 512 in high speed, although hardware is able to handle up to 1023 in fs
and 1024 in hs.

Tested-by: Matt Porter <mporter@linaro.org>
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-12 13:43:35 -06:00
Michal Nazarewicz 219580e64f usb: f_fs: check quirk to pad epout buf size when not aligned to maxpacketsize
Check gadget.quirk_ep_out_aligned_size to decide if buffer size requires
to be aligned to maxpacketsize of an out endpoint.  ffs_epfile_io() needs
to pad epout buffer to match above condition if quirk is found.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-09 22:44:07 -06:00
Michal Nazarewicz 7fa6803483 usb: gadget: f_fs: remove loop from I/O function
When endpoint changes (due to it being disabled or alt setting changed),
mimic the action as if the change happened after the request has been
queued, instead of retrying with the new endpoint.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Cc: David Cohen <david.a.cohen@linux.intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-09 22:44:06 -06:00
Jingoo Han 9510ecee62 usb: gadget: amd5536udc: remove DEFINE_PCI_DEVICE_TABLE macro
Don't use DEFINE_PCI_DEVICE_TABLE macro, because this macro
is not preferred.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-06 13:47:04 -06:00
Jingoo Han ea25c37ea8 usb: gadget: pch_udc: remove DEFINE_PCI_DEVICE_TABLE macro
Don't use DEFINE_PCI_DEVICE_TABLE macro, because this macro
is not preferred.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-06 13:47:03 -06:00
Andrzej Pietrasiewicz 25d8015177 usb: gadget: f_sourcesink: add configfs support
Add support for using the sourcesink function in gadgets composed with
configfs.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-11-26 13:47:41 -06:00
Andrzej Pietrasiewicz c0501f47c6 usb: gadget: f_loopback: add configfs support
Add support for using the loopback USB function in gadgets composed with
configfs.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-11-26 13:46:13 -06:00
Andrzej Pietrasiewicz 1efd54eab2 usb: gadget: factor out alloc_ep_req
alloc_ep_req() is a function repeated in several modules.
Make a common implementation and use it.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-11-26 13:41:32 -06:00
Andrzej Pietrasiewicz a01091e5ce usb: gadget: composite: redirect setup requests
If there are setup requests not directed to an endpont or an interface,
current config's setup() has been attempted so far.
This patch, in case the above fails, adds code which tries the setup() of
configuration's function if there is only one function in the configuration.

This behavior is required to provide equivalent of gadget zero with configfs.

The gadget zero has a "config driver" for sourcesink, but all it does is
delegating the request to the function proper. So when the equivalent gadget
is set up with configfs it needs to handle requests directed to
"config driver", but with configfs it is not possible to specify
"config drivers".

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-11-26 13:40:44 -06:00
Dan Carpenter 574f24f797 usb: gadget: update some out of date comments
These functions used to return negative errror codes but now they return
ERR_PTRs.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-11-26 10:58:17 -06:00
Geert Uytterhoeven 7de7174aa3 usb: gadget: remove superfluous name casts
device_driver.name is "const char *"

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-11-26 10:58:16 -06:00
Michal Nazarewicz 4fbc5566c8 usb: gadget: goku: remove unused argument
The stop_activity function never uses driver argument (even
though it modifies it) and thus it is safe to remove it.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-11-26 10:58:16 -06:00
Felipe Balbi c3505f0458 usb: gadget: epautoconf: switch over to usb_endpoint_type()
we have a helper to fetch endpoint type out of
a descriptor, let's use it.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-11-26 10:58:16 -06:00
Laurent Pinchart 989c78dd56 usb: gadget: r8a66597-udc: convert to clk_prepare/unprepare
Turn clk_enable() and clk_disable() calls into clk_prepare_enable() and
clk_disable_unprepare() to get ready for the migration to the common
clock framework.

Cc: Felipe Balbi <balbi@ti.com>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-11-26 10:35:08 -06:00
George Cherian 2cf93bea3d usb: gadget: f_mass_storage: call try_to_freeze only when its safe
Call try_to_freeze() in sleep_thread() only when it's safe to sleep.
do_read() and do_write() calls sleep_thread with lock held.
Make sure these won't call try_to_freeze() by passing can_freeze flag
to sleep_thread.

Calling try_to_freeze() with a lock hold was done since day one in
f_mass_storage but since commit 0f9548ca1 ("lockdep: check that no
locks held at freeze time") lockdep complains about it.

Signed-off-by: George Cherian <george.cherian@ti.com>
Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-11-25 11:34:09 -06:00
Felipe Balbi 3f79265c96 usb: gadget: tcm_usb_gadget: mark bot_cleanup_old_alt static
that symbol is only used inside this function driver,
we should mark it static. Fixes sparse's:

drivers/usb/gadget/tcm_usb_gadget.c:373:6: warning: symbol \
	'bot_cleanup_old_alt' was not declared. Should it \
	be static?

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-11-25 11:19:41 -06:00
Felipe Balbi 63b12e3ece usb: gadget: ffs: fix sparse warning
use NULL instead of 0 as pointer.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-11-25 11:16:49 -06:00
Fengguang Wu d07a59019d usb: gadget: zero: module parameters can be static
g_zero's module parameters can, and should, be
static. This fixes sparse warnings.

Cc: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-11-25 11:12:15 -06:00
Felipe Balbi f91d2f4337 usb: gadget: storage: fix sparse warning
fsg_common_set_inquiry_string() expects pointers
as second and third argument. Let's fix that by
passing NULL instead of plain 0 just so we silence
sparse's:

drivers/usb/gadget/f_mass_storage.c:3114:60: warning: \
	Using plain integer as NULL pointer
drivers/usb/gadget/f_mass_storage.c:3114:63: warning: \
	Using plain integer as NULL pointer

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-11-25 11:07:46 -06:00
Pratyush Anand 655403c212 usb: gadget: mass storage: fix return of delayed status
Mass storage gadget returns DELAYED_STATUS in stead of
USB_GADGET_DELAYED_STATUS while handling bulk reset request. Since
peripheral driver uses USB_GADGET_DELAYED_STATUS for delayed status
handling, therefore replace DELAYED_STATUS by USB_GADGET_DELAYED_STATUS
in mass storage driver.

Since, DELAYED_STATUS and hence EP0_BUFSIZE will no longer be used now,
so remove them.

Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
Cc: Paul Zimmerman <Paul.Zimmerman@synopsys.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-11-25 10:56:33 -06:00