platform/kernel/linux-3.10.git
10 years agousb: gadget: f_ncm: Fix sparse warning
Jingoo Han [Mon, 16 Dec 2013 09:43:32 +0000 (18:43 +0900)]
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>
10 years agousb: gadget: f_mass_storage: Fix sparse warning
Jingoo Han [Mon, 16 Dec 2013 09:42:48 +0000 (18:42 +0900)]
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>
10 years agousb: gadget: f_loopback: Fix sparse warning
Jingoo Han [Mon, 16 Dec 2013 09:40:49 +0000 (18:40 +0900)]
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>
10 years agousb: gadget: nokia: fix error recovery path for optional functions
Andrzej Pietrasiewicz [Fri, 13 Dec 2013 13:46:40 +0000 (14:46 +0100)]
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>
10 years agousb: gadget: f_fs: fix sparse warning
Felipe Balbi [Thu, 12 Dec 2013 18:15:43 +0000 (12:15 -0600)]
usb: gadget: f_fs: fix sparse warning

use NULL when returning NULL pointers, not 0.

Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: FunctionFS: add configfs support
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:36 +0000 (15:15 +0100)]
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>
10 years agousb: gadget: FunctionFS: Remove compatibility layer
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:35 +0000 (15:15 +0100)]
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>
10 years agousb: gadget: g_ffs: convert to new interface of f_fs
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:34 +0000 (15:15 +0100)]
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>
10 years agousb: gadget: FunctionFS: convert to new function interface with backward compatibility
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:33 +0000 (15:15 +0100)]
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>
10 years agousb: gadget: FunctionFS: add devices management code
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:32 +0000 (15:15 +0100)]
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>
10 years agousb: gadget: FunctionFS: create utility file
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:31 +0000 (15:15 +0100)]
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>
10 years agousb: gadget: FunctionFS: Remove VLAIS usage from gadget code
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:30 +0000 (15:15 +0100)]
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>
10 years agousb: gadget: rndis: merge u_rndis.ko with usb_f_rndis.ko
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:29 +0000 (15:15 +0100)]
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>
10 years agousb: gadget: f_rndis: remove compatibility layer
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:28 +0000 (15:15 +0100)]
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>
10 years agousb: gadget: g_ffs: convert to new interface of f_rndis
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:27 +0000 (15:15 +0100)]
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>
10 years agousb: gadget: f_subset: remove compatibility layer
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:26 +0000 (15:15 +0100)]
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>
10 years agousb: gadget: g_ffs: convert to new interface of f_subset
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:25 +0000 (15:15 +0100)]
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>
10 years agousb: gadget: f_ecm: remove compatibility layer
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:24 +0000 (15:15 +0100)]
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>
10 years agousb: gadget: g_ffs: convert to new interface of f_ecm
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:23 +0000 (15:15 +0100)]
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>
10 years agousb: gadget: g_ffs: remove a reduntant gfs_ether_setup variable
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:22 +0000 (15:15 +0100)]
usb: gadget: g_ffs: remove a reduntant gfs_ether_setup variable

Since d6a0143985489e470a118605352f4b18df0ce142
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>
10 years agousb: gadget: configfs: allow setting function instance's name
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:21 +0000 (15:15 +0100)]
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>
10 years agousb: f_fs: check quirk to pad epout buf size when not aligned to maxpacketsize
Michal Nazarewicz [Mon, 9 Dec 2013 23:55:37 +0000 (15:55 -0800)]
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>
10 years agousb: gadget: f_fs: remove loop from I/O function
Michal Nazarewicz [Mon, 9 Dec 2013 23:55:36 +0000 (15:55 -0800)]
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>
10 years agousb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget
David Cohen [Mon, 9 Dec 2013 23:55:35 +0000 (00:55 +0100)]
usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget

Due to USB controllers may have different restrictions, usb gadget layer
needs to provide a generic way to inform gadget functions to complain
with non-standard requirements.

This patch adds 'quirk_ep_out_aligned_size' field to struct usb_gadget
to inform when controller's epout requires buffer size to be aligned to
MaxPacketSize. A helper is also provided to align buffer size when
necessary.

Cc: Alan Stern <stern@rowland.harvard.edu>
Acked-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>
[backport from mainline]
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
10 years agousb: gadget: move bitflags to the end of usb_gadget struct
David Cohen [Mon, 9 Dec 2013 23:55:34 +0000 (00:55 +0100)]
usb: gadget: move bitflags to the end of usb_gadget struct

This patch moves all bitflags to the end of usb_gadget struct in order
to improve readability.

Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[backport from mainline]
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
10 years agousb: gadget: f_sourcesink: add configfs support
Andrzej Pietrasiewicz [Thu, 7 Nov 2013 07:41:28 +0000 (08:41 +0100)]
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>
10 years agousb: gadget: f_loopback: add configfs support
Andrzej Pietrasiewicz [Thu, 7 Nov 2013 07:41:27 +0000 (08:41 +0100)]
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>
10 years agousb: gadget: factor out alloc_ep_req
Andrzej Pietrasiewicz [Thu, 7 Nov 2013 07:41:26 +0000 (08:41 +0100)]
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>
10 years agousb: gadget: composite: redirect setup requests
Andrzej Pietrasiewicz [Thu, 7 Nov 2013 07:41:25 +0000 (08:41 +0100)]
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>
10 years agousb: gadget: update some out of date comments
Dan Carpenter [Thu, 14 Nov 2013 08:42:11 +0000 (11:42 +0300)]
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>
10 years agousb/gadget: f_mass_storage: use string literal as format in dev_set_name
Andrzej Pietrasiewicz [Fri, 25 Oct 2013 07:09:27 +0000 (09:09 +0200)]
usb/gadget: f_mass_storage: use string literal as format in dev_set_name

Fix commit b27c08c953e994f792a03d9b7cbc5cf3f9844135 where dev_set_name()
is used without a string literal as format.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
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>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agousb: gadget: f_mass_storage: style corrections, cleanup & simplification
Andrzej Pietrasiewicz [Wed, 16 Oct 2013 06:34:51 +0000 (08:34 +0200)]
usb: gadget: f_mass_storage: style corrections, cleanup & simplification

Fix spacing, improve error code returned, remove unused #define,
use strtobool() instead of kstrtou8().

Acked-by: Michal Nazarewicz <mina86@mina86.com>
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>
10 years agousb: gadget: storage_common: pass filesem to fsg_store_cdrom
Andrzej Pietrasiewicz [Tue, 15 Oct 2013 06:33:13 +0000 (08:33 +0200)]
usb: gadget: storage_common: pass filesem to fsg_store_cdrom

If cdrom flag is set ro flag is implied. Try setting the ro first, and
only if it succeeds set the cdrom flag.

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>
10 years agousb: gadget: storage_common: use strtobool instead of kstrtouint
Andrzej Pietrasiewicz [Tue, 15 Oct 2013 06:33:12 +0000 (08:33 +0200)]
usb: gadget: storage_common: use strtobool instead of kstrtouint

strtobool is more flexible for the user and is more appropriate in the
context.

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>
10 years agousb: gadget: mass_storage: merge usb_f_mass_storage module with u_ms module
Andrzej Pietrasiewicz [Wed, 9 Oct 2013 08:08:29 +0000 (10:08 +0200)]
usb: gadget: mass_storage: merge usb_f_mass_storage module with u_ms module

u_ms.ko is needed only together with usb_f_mass_storage.ko. Merge them.

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>
10 years agousb: gadget: f_mass_storage: remove compatibility layer
Andrzej Pietrasiewicz [Wed, 9 Oct 2013 08:08:28 +0000 (10:08 +0200)]
usb: gadget: f_mass_storage: remove compatibility layer

There are no more old interface users left. Remove it.

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>
10 years agousb: gadget: multi: convert to new interface of f_mass_storage
Andrzej Pietrasiewicz [Wed, 9 Oct 2013 08:08:27 +0000 (10:08 +0200)]
usb: gadget: multi: convert to new interface of f_mass_storage

Convert the legacy multi gadget to the new interface of f_mass_storage,
so that later the compatibility layer in f_mass_storage can be removed.

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>
10 years agousb: gadget: multi: convert to new interface of f_rndis
Andrzej Pietrasiewicz [Wed, 9 Oct 2013 08:08:26 +0000 (10:08 +0200)]
usb: gadget: multi: convert to new interface of f_rndis

Convert the legacy multi gadget to the new interface of f_rndis,
so that later the compatibility layer in f_rndis can be removed.

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>
10 years agousb: gadget: multi: convert to new interface of f_ecm
Andrzej Pietrasiewicz [Wed, 9 Oct 2013 08:08:25 +0000 (10:08 +0200)]
usb: gadget: multi: convert to new interface of f_ecm

Convert the legacy multi gadget to the new interface of f_ecm,
so that later the compatibility layer in f_ecm can be removed.

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>
10 years agousb: gadget: acm_ms: convert to new interface of f_mass_storage
Andrzej Pietrasiewicz [Wed, 9 Oct 2013 08:07:29 +0000 (10:07 +0200)]
usb: gadget: acm_ms: convert to new interface of f_mass_storage

Convert the legacy acm_ms gadget to use the new function interface
of f_mass_storage, so that later the compatibility layer in
f_mass_storage can be removed.

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>
10 years agousb: gadget: f_mass_storage: add configfs support
Andrzej Pietrasiewicz [Wed, 9 Oct 2013 08:06:05 +0000 (10:06 +0200)]
usb: gadget: f_mass_storage: add configfs support

From this commit on f_mass_storage is available through 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>
10 years agousb: gadget: storage_common: add methods to show/store 'cdrom' and 'removable'
Andrzej Pietrasiewicz [Wed, 9 Oct 2013 08:06:04 +0000 (10:06 +0200)]
usb: gadget: storage_common: add methods to show/store 'cdrom' and 'removable'

This will be required by configfs integration.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: storage_common: make attribute operations more generic
Andrzej Pietrasiewicz [Wed, 9 Oct 2013 08:06:03 +0000 (10:06 +0200)]
usb: gadget: storage_common: make attribute operations more generic

Show/store methods for sysfs attributes contain code which can be used
also by configfs. Make them abstract the source the lun and rw_semaphore
are taken from.

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>
10 years agousb: gadget: mass_storage: convert to new interface of f_mass_storage
Andrzej Pietrasiewicz [Wed, 9 Oct 2013 08:06:02 +0000 (10:06 +0200)]
usb: gadget: mass_storage: convert to new interface of f_mass_storage

Convert old mass_storage gadget to use the new interface of f_mass_storage
so that later the compatibility layer in f_mass_storage can be removed.

struct fsg_common is not known to mass_storage.c, so a setter method
is added to f_mass_storage.

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>
10 years agousb: gadget: f_mass_storage: convert to new function interface with backward compatib...
Andrzej Pietrasiewicz [Wed, 9 Oct 2013 08:06:01 +0000 (10:06 +0200)]
usb: gadget: f_mass_storage: convert to new function interface with backward compatibility

Converting mass storage to the new function interface requires converting
the USB mass storage's function code and its users.
This patch converts the f_mass_storage.c to the new function interface.
The file is now compiled into a separate usb_f_mass_storage.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: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: f_mass_storage: create fsg_common_run_thread for use in fsg_common_init
Andrzej Pietrasiewicz [Wed, 9 Oct 2013 08:06:00 +0000 (10:06 +0200)]
usb: gadget: f_mass_storage: create fsg_common_run_thread for use in fsg_common_init

fsg_common_init is a lengthy function. Factor a portion of it out.

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>
10 years agousb: gadget: f_mass_storage: create fsg_common_set_inquiry_string for use in fsg_comm...
Andrzej Pietrasiewicz [Wed, 9 Oct 2013 08:05:59 +0000 (10:05 +0200)]
usb: gadget: f_mass_storage: create fsg_common_set_inquiry_string for use in fsg_common_init

fsg_common_init is a lengthy function. Factor a portion of it out.

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>
10 years agousb: gadget: f_mass_storage: create lun creation helpers for use in fsg_common_init
Andrzej Pietrasiewicz [Wed, 9 Oct 2013 08:05:58 +0000 (10:05 +0200)]
usb: gadget: f_mass_storage: create lun creation helpers for use in fsg_common_init

fsg_common_init is a lengthy function. Factor portions of it out.

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>
10 years agousb: gadget: f_mass_storage: create fsg_common_set_cdev for use in fsg_common_init
Andrzej Pietrasiewicz [Wed, 9 Oct 2013 08:05:57 +0000 (10:05 +0200)]
usb: gadget: f_mass_storage: create fsg_common_set_cdev for use in fsg_common_init

fsg_common_init is a lengthy function. Factor a portion of it out.

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>
10 years agousb: gadget: f_mass_storage: create lun handling helpers for use in fsg_common_init
Andrzej Pietrasiewicz [Wed, 9 Oct 2013 08:05:56 +0000 (10:05 +0200)]
usb: gadget: f_mass_storage: create lun handling helpers for use in fsg_common_init

fsg_common_init is a lengthy function. Factor portions of it out.

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>
10 years agousb: gadget: f_mass_storage: create fsg_common_set_num_buffers for use in fsg_common_init
Andrzej Pietrasiewicz [Wed, 9 Oct 2013 08:05:55 +0000 (10:05 +0200)]
usb: gadget: f_mass_storage: create fsg_common_set_num_buffers for use in fsg_common_init

fsg_common_init is a lengthy function. Factor a portion of it out.

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>
10 years agousb: gadget: f_mass_storage: create fsg_common_setup for use in fsg_common_init
Andrzej Pietrasiewicz [Wed, 9 Oct 2013 08:05:54 +0000 (10:05 +0200)]
usb: gadget: f_mass_storage: create fsg_common_setup for use in fsg_common_init

fsg_common_init is a lengthy function. Factor a portion of it out.

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>
10 years agousb: gadget: f_mass_storage: make sysfs interface optional
Andrzej Pietrasiewicz [Wed, 9 Oct 2013 08:05:53 +0000 (10:05 +0200)]
usb: gadget: f_mass_storage: make sysfs interface optional

When configfs is in place, the luns will not be represented in sysfs,
so there will be no struct device associated with a lun.
In order to maintain compatibility and allow configfs adoption
sysfs is made optional in this patch.

As a consequence some debug macros need to be adjusted. Two new
fields are added to struct fsg_lun: name and name_pfx.
The "name" is for storing a string which is presented to the user
instead of the dev_name. The "name_pfx", if non-NULL, is prepended
to the "name" at printing time.

The name_pfx is for a future lun.0, which will be a default group in
mass_storage.<name>. By design at USB function configfs group's creation
time its name is not known (but instead set a bit later in
drivers/usb/gadget/configfs.c:function_make) and it is this name that
serves the purpose of the said name prefix. So instead of copying
a yet-unknown string a pointer to it is stored in struct fsg_lun.

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>
10 years agousb: gadget: f_mass_storage: create _fsg_common_free_buffers
Andrzej Pietrasiewicz [Wed, 9 Oct 2013 08:05:52 +0000 (10:05 +0200)]
usb: gadget: f_mass_storage: create _fsg_common_free_buffers

When configfs is in place, gadgets will have to be able to free
fsg buffers. Add a helper function.

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>
10 years agousb: gadget: f_mass_storage: use usb_gstrings_attach
Andrzej Pietrasiewicz [Thu, 26 Sep 2013 12:38:19 +0000 (14:38 +0200)]
usb: gadget: f_mass_storage: use usb_gstrings_attach

Prepare for handling 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>
10 years agousb: gadget: f_mass_storage: add a level of indirection for luns storage
Andrzej Pietrasiewicz [Thu, 26 Sep 2013 12:38:18 +0000 (14:38 +0200)]
usb: gadget: f_mass_storage: add a level of indirection for luns storage

This is needed to prepare for configfs integration.

So far the luns have been allocated during gadget's initialization, based
on the nluns module parameter's value; the exact number is known when the
gadget is initialized and that number of luns is allocated in one go; they
all will be used.

When configfs is in place, the luns will be created one-by-one by the user.
Once the user is satisfied with the number of luns, they activate the
gadget. The number of luns must be <= FSG_MAX_LUN (currently 8), but other
than that it is not known up front and the user need not use contiguous
numbering (apart from the default lun #0). On the other hand, the function
code uses lun numbers to identify them and the number needs to be used
as an index into an array.

Given the above, an array needs to be allocated, but it might happen that
7 out of its 8 elements will not be used. On my machine
sizeof(struct fsg_lun) == 462, so > 3k of memory is allocated but not used
in the worst case.

By adding another level of indirection (allocating an array of pointers
to struct fsg_lun and then allocating individual luns instead of an array
of struct fsg_luns) at most 7 pointers are wasted, which is much less.

This patch also changes some for/while loops to cope with the fact
that in the luns array some entries are potentially empty.

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>
10 years agousb: gadget: f_mass_storage: factor out a header file
Andrzej Pietrasiewicz [Thu, 26 Sep 2013 12:38:17 +0000 (14:38 +0200)]
usb: gadget: f_mass_storage: factor out a header file

In order to prepare for the new function interface the f_mass_storage.c
needs to be compiled as a module, and so a header file will be required.

This patch factors out some code to a new f_mass_storage.h.

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>
10 years agousb: gadget: create a utility module for mass_storage
Andrzej Pietrasiewicz [Thu, 26 Sep 2013 12:38:16 +0000 (14:38 +0200)]
usb: gadget: create a utility module for mass_storage

Converting to configfs requires making the f_mass_storage.c a module.

But first we need to get rid of "#include "storage_common.c".

This patch makes storage_common.c a separately compiled file, which is
built as a utility module named u_ms.ko. After all mass storage users are
converted to the new function interface this module can be eliminated
by merging it with the mass storage function's module.

USB descriptors are exported so that they can be accessed from
f_mass_storage.

FSG_VENDOR_ID and FSG_PRODUCT_ID are moved to their only user.

Handling of CONFIG_USB_GADGET_DEBUG_FILES is moved to f_mass_storage.c.
The fsg_num_buffers static is moved to FSG_MODULE_PARAMETER users, so
instead of using a global variable the f_mass_storage introduces
fsg_num_buffers member in fsg_common (and fsg_config).

fsg_strings and fsg_stringtab are moved to f_mass_storage.c.

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>
10 years agousb: gadget: Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...))
Duan Jiong [Thu, 26 Sep 2013 07:55:25 +0000 (15:55 +0800)]
usb: gadget: Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...))

trivial patch converting ERR_PTR(PTR_ERR()) into ERR_CAST().
No functional changes.

Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: zero: Add flexible auto remote wakeup test method
Peter Chen [Mon, 9 Sep 2013 08:48:29 +0000 (16:48 +0800)]
usb: gadget: zero: Add flexible auto remote wakeup test method

In order to increase test coverage, we can change the interval between
two remote wakeups every time, and the interval can be any user defined
value. This change will no affect current behavior if the user does not
use two introduced module paramters.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: f_fs: fix error handling
Robert Baldyga [Fri, 27 Sep 2013 10:28:54 +0000 (12:28 +0200)]
usb: gadget: f_fs: fix error handling

This patch add missing error check in ffs_func_bind() function, after
ffs_do_descs() function call for high speed descriptors. Without this
check it's possible that the module will try dereference incorrect
pointer.

[ balbi@ti.com : removed trailing empty line ]

Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: g_ffs: fix compilation warning
David Cohen [Fri, 4 Oct 2013 22:30:21 +0000 (15:30 -0700)]
usb: g_ffs: fix compilation warning

If USB_FUNCTIONFS is selected without USB_FUNCTIONFS_ETH and
USB_FUNCTIONFS_RNIS, u_ether.h won't be included and then
USB_ETHERNET_MODULE_PARAMAETERS macro won't be available causing the
following warning compilation:

drivers/usb/gadget/g_ffs.c:81:1: warning: data definition has no type or
storage class [enabled by default]
drivers/usb/gadget/g_ffs.c:81:1: warning: type defaults to ‘int’ in
declaration of ‘USB_ETHERNET_MODULE_PARAMETERS’ [-Wimplicit-int]
drivers/usb/gadget/g_ffs.c:81:1: warning: function declaration isn’t a
prototype [-Wstrict-prototypes]

This patch fixes the warning by making USB_ETHERNET_MODULE_PARAMETERS to
be used iff u_ether.h is included, otherwise it is not needed.

Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agousb: gadget: f_mass_storage: reset endpoint driver data when disabled
Peter Oh [Mon, 16 Sep 2013 21:21:14 +0000 (14:21 -0700)]
usb: gadget: f_mass_storage: reset endpoint driver data when disabled

Gadgets endpoint driver data is a criteria to judge that
whether the endpoints are in use or not. When gadget gets
assigned an endpoint from endpoint list, they check its
driver data if the driver data is NULL.

If the driver data is not NULL then they regard it as in use.
Therefore all of gadgets should reset their endpoints driver
data to NULL as they are disabled. Otherwise it causes a leak
of endpoint resource.

Signed-off-by: Peter Oh <poh@broadcom.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: f_eem: Staticize eem_alloc
Sachin Kamat [Mon, 16 Sep 2013 06:14:46 +0000 (11:44 +0530)]
usb: gadget: f_eem: Staticize eem_alloc

'eem_alloc' is local to this file. Make it static.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: f_ecm: Staticize ecm_alloc
Sachin Kamat [Mon, 16 Sep 2013 06:14:45 +0000 (11:44 +0530)]
usb: gadget: f_ecm: Staticize ecm_alloc

'ecm_alloc' is local to this file. Make it static.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: add '__ref' for rndis_config_register() and cdc_config_register()
Chen Gang [Mon, 2 Sep 2013 10:14:42 +0000 (18:14 +0800)]
usb: gadget: add '__ref' for rndis_config_register() and cdc_config_register()

They are only called by '__ref' function multi_bind(), and they will
call '__init' functions, so recommend to let them '__ref' too.

The related warnings:

  WARNING: drivers/usb/gadget/g_multi.o(.text+0xded6): Section mismatch in reference from the variable .LM2921 to the variable .init.text:_rndis_do_config
  The function .LM2921() references
  the variable __init _rndis_do_config.
  This is often because .LM2921 lacks a __init
  annotation or the annotation of _rndis_do_config is wrong.

  WARNING: drivers/usb/gadget/g_multi.o(.text+0xdf16): Section mismatch in reference from the variable .LM2953 to the variable .init.text:_cdc_do_config
  The function .LM2953() references
  the variable __init _cdc_do_config.
  This is often because .LM2953 lacks a __init
  annotation or the annotation of _cdc_do_config is wrong.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: gadgetfs: potential use after free in unbind()
Dan Carpenter [Fri, 23 Aug 2013 08:16:15 +0000 (11:16 +0300)]
usb: gadget: gadgetfs: potential use after free in unbind()

ffs_data_put() can sometimes free "ffs" so I have moved the call down
a line below the dereference.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agoUSB: gadget: audit sysfs attribute permissions
Greg Kroah-Hartman [Fri, 23 Aug 2013 23:34:43 +0000 (16:34 -0700)]
USB: gadget: audit sysfs attribute permissions

Convert all USB gadget sysfs attributes to use the _RO or _RW variants,
to make them easier to audit and ensure that the permissions are
correct.

Note, two are left using the DEVICE_ATTR() macro, as there is no
DEVICE_ATTR_WO() in Linus's tree, that will happen after 3.12-rc1 is
out, a follow-on patch will be sent then.

Reviewed-by: Felipe Balbi <balbi@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
--
 drivers/usb/gadget/composite.c      |    8 +++-----
 drivers/usb/gadget/dummy_hcd.c      |    8 ++++----
 drivers/usb/gadget/f_mass_storage.c |   14 ++++++--------
 drivers/usb/gadget/net2272.c        |    4 ++--
 drivers/usb/gadget/net2280.c        |   18 +++++++++---------
 drivers/usb/gadget/storage_common.c |   25 ++++++++++++-------------
 drivers/usb/gadget/udc-core.c       |   14 +++++++-------
 7 files changed, 43 insertions(+), 48 deletions(-)

10 years agodriver core: device.h: add RW and RO attribute macros
Greg Kroah-Hartman [Sun, 14 Jul 2013 23:05:54 +0000 (16:05 -0700)]
driver core: device.h: add RW and RO attribute macros

Make it easier to create attributes without having to always audit the
mode settings.

Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agosysfs.h: add __ATTR_RW() macro
Andrzej Pietrasiewicz [Wed, 15 Jan 2014 09:45:17 +0000 (10:45 +0100)]
sysfs.h: add __ATTR_RW() macro

A number of parts of the kernel created their own version of this, might
as well have the sysfs core provide it instead.

Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[mainline backport]
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
10 years agousb: gadget: rndis: Staticize rndis_init()/rndis_exit()
Jingoo Han [Mon, 5 Aug 2013 03:12:42 +0000 (12:12 +0900)]
usb: gadget: rndis: Staticize rndis_init()/rndis_exit()

rndis_init() and rndis_exit() are used only in this file.
Fix the following sparse warnings:

drivers/usb/gadget/rndis.c:1145:5: warning: symbol 'rndis_init' was not declared. Should it be static?
drivers/usb/gadget/rndis.c:1179:6: warning: symbol 'rndis_exit' was not declared. Should it be static?

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agousb: gadget: f_mass_storage: use NULL instead of 0
Jingoo Han [Mon, 5 Aug 2013 03:11:05 +0000 (12:11 +0900)]
usb: gadget: f_mass_storage: use NULL instead of 0

The local variables such as 'filename', 'vendor_name', and
'product_name' are pointers; thus, use NULL instead of 0 to fix
the following sparse warnings

drivers/usb/gadget/f_mass_storage.c:3046:27: warning: Using plain integer as NULL pointer
drivers/usb/gadget/f_mass_storage.c:3050:28: warning: Using plain integer as NULL pointer
drivers/usb/gadget/f_mass_storage.c:3051:29: warning: Using plain integer as NULL pointer

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
10 years agoUSB: gadget: fix up comment
Greg Kroah-Hartman [Fri, 28 Jun 2013 18:32:57 +0000 (11:32 -0700)]
USB: gadget: fix up comment

This endif is for CONFIG_USB_GADGET_DEBUG_FILES, not CONFIG_USB_DEBUG,
so document it properly.

Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoRevert "usb/gadget: create a utility module for mass_storage"
Andrzej Pietrasiewicz [Tue, 14 Jan 2014 13:28:02 +0000 (14:28 +0100)]
Revert "usb/gadget: create a utility module for mass_storage"

This reverts commit 999eab4c72b5afbb59bdb5668a03118ea79e4455.

10 years agoRevert "usb/gadget: f_mass_storage: factor out a header file"
Andrzej Pietrasiewicz [Tue, 14 Jan 2014 13:27:56 +0000 (14:27 +0100)]
Revert "usb/gadget: f_mass_storage: factor out a header file"

This reverts commit aa42314c87dd9ba2b17aa1cb49d76d95d988dffe.

10 years agoRevert "usb/gadget: f_mass_storage: add a level of indirection for luns storage"
Andrzej Pietrasiewicz [Tue, 14 Jan 2014 13:27:26 +0000 (14:27 +0100)]
Revert "usb/gadget: f_mass_storage: add a level of indirection for luns storage"

This reverts commit 51717e532d24736b2813cfc49e4c48374b2fbd12.

10 years agoRevert "usb/gadget: f_mass_storage: use usb_gstrings_attach"
Andrzej Pietrasiewicz [Tue, 14 Jan 2014 13:27:23 +0000 (14:27 +0100)]
Revert "usb/gadget: f_mass_storage: use usb_gstrings_attach"

This reverts commit 2089c2070341b55b6476907100bfe2fd04467edd.

10 years agoRevert "usb/gadget: f_mass_storage: split fsg_common initialization into a number...
Andrzej Pietrasiewicz [Tue, 14 Jan 2014 13:27:20 +0000 (14:27 +0100)]
Revert "usb/gadget: f_mass_storage: split fsg_common initialization into a number of functions"

This reverts commit 4198374d675f23cc00a4ebd61f99ef2c8bb4ad82.

10 years agoRevert "usb/gadget: f_mass_storage: use fsg_common_setup in fsg_common_init"
Andrzej Pietrasiewicz [Tue, 14 Jan 2014 13:27:18 +0000 (14:27 +0100)]
Revert "usb/gadget: f_mass_storage: use fsg_common_setup in fsg_common_init"

This reverts commit 6da409d4af402599d135f22d4f0273c42aee5d9c.

10 years agoRevert "usb/gadget: f_mass_storage: use fsg_common_set_num_buffers in fsg_common_init"
Andrzej Pietrasiewicz [Tue, 14 Jan 2014 13:27:15 +0000 (14:27 +0100)]
Revert "usb/gadget: f_mass_storage: use fsg_common_set_num_buffers in fsg_common_init"

This reverts commit 378d601a3457e66ee10ba1770bfbe9d42d8361da.

10 years agoRevert "usb/gadget: f_mass_storage: use fsg_common_set_nluns in fsg_common_init"
Andrzej Pietrasiewicz [Tue, 14 Jan 2014 13:27:13 +0000 (14:27 +0100)]
Revert "usb/gadget: f_mass_storage: use fsg_common_set_nluns in fsg_common_init"

This reverts commit 988ececeab73edfa2e4f27ad7167034d8908aa74.

10 years agoRevert "usb/gadget: f_mass_storage: use fsg_common_set_ops/_private_data in fsg_commo...
Andrzej Pietrasiewicz [Tue, 14 Jan 2014 13:27:10 +0000 (14:27 +0100)]
Revert "usb/gadget: f_mass_storage: use fsg_common_set_ops/_private_data in fsg_common_init"

This reverts commit 51c5313aa631785326cf16c39e941edd50b2832f.

10 years agoRevert "usb/gadget: f_mass_storage: use fsg_common_set_cdev in fsg_common_init"
Andrzej Pietrasiewicz [Tue, 14 Jan 2014 13:27:07 +0000 (14:27 +0100)]
Revert "usb/gadget: f_mass_storage: use fsg_common_set_cdev in fsg_common_init"

This reverts commit 03aec556a53d26977be1c16b3307eae731960cd8.

10 years agoRevert "usb/gadget: f_mass_storage: use fsg_common_create_luns in fsg_common_init"
Andrzej Pietrasiewicz [Tue, 14 Jan 2014 13:27:04 +0000 (14:27 +0100)]
Revert "usb/gadget: f_mass_storage: use fsg_common_create_luns in fsg_common_init"

This reverts commit 681ab95e2320cb629954939a867c61de7d7b8372.

10 years agoRevert "usb/gadget: f_mass_storage: use fsg_common_set_inquiry_string in fsg_common_init"
Andrzej Pietrasiewicz [Tue, 14 Jan 2014 13:27:01 +0000 (14:27 +0100)]
Revert "usb/gadget: f_mass_storage: use fsg_common_set_inquiry_string in fsg_common_init"

This reverts commit 2e9cc80a04c3f5c46640f7a4d347ce37c6f26953.

10 years agoRevert "usb/gadget: f_mass_storage: use fsg_common_run_thread in fsg_common_init"
Andrzej Pietrasiewicz [Tue, 14 Jan 2014 13:26:58 +0000 (14:26 +0100)]
Revert "usb/gadget: f_mass_storage: use fsg_common_run_thread in fsg_common_init"

This reverts commit 9fc1ddf14878e584464ab110ee5150d6ac3151ef.

10 years agoRevert "usb/gadget: f_mass_storage: convert to new function interface with backward...
Andrzej Pietrasiewicz [Tue, 14 Jan 2014 13:26:50 +0000 (14:26 +0100)]
Revert "usb/gadget: f_mass_storage: convert to new function interface with backward compatibility"

This reverts commit 2cac3870c00b16a061c42fc4bbd2fd67e957d147.

10 years agoRevert "usb/gadget: mass_storage: convert to new interface of f_mass_storage"
Andrzej Pietrasiewicz [Tue, 14 Jan 2014 13:26:46 +0000 (14:26 +0100)]
Revert "usb/gadget: mass_storage: convert to new interface of f_mass_storage"

This reverts commit d42b40a01037255c0609cfae1607bdf7524c8c75.

10 years agoRevert "usb/gadget: storage_common: make attribute operations more generic"
Andrzej Pietrasiewicz [Tue, 14 Jan 2014 13:26:43 +0000 (14:26 +0100)]
Revert "usb/gadget: storage_common: make attribute operations more generic"

This reverts commit 724a908e741cbd713c95f2a2cedb6a4c7d97ed38.

10 years agoRevert "usb/gadget: storage_common: add methods to show/store 'cdrom' and 'removable'"
Andrzej Pietrasiewicz [Tue, 14 Jan 2014 13:26:40 +0000 (14:26 +0100)]
Revert "usb/gadget: storage_common: add methods to show/store 'cdrom' and 'removable'"

This reverts commit 80b546ca2f7a1d6714022e3c791635d7b6ba9766.

10 years agoRevert "usb/gadget: f_mass_storage: add configfs support"
Andrzej Pietrasiewicz [Tue, 14 Jan 2014 13:26:37 +0000 (14:26 +0100)]
Revert "usb/gadget: f_mass_storage: add configfs support"

This reverts commit d1e1911c9b87f7c8aa7cf22ce76dd4cb5a669cdf.

10 years agoRevert "usb/gadget: acm_ms: convert to new interface of f_mass_storage"
Andrzej Pietrasiewicz [Tue, 14 Jan 2014 13:26:29 +0000 (14:26 +0100)]
Revert "usb/gadget: acm_ms: convert to new interface of f_mass_storage"

This reverts commit 7ab27e2ab83e3d760dd4ebb8175eac0f04f776f2.

10 years agoRevert "usb/gadget: multi: convert to new interface of f_ecm"
Andrzej Pietrasiewicz [Tue, 14 Jan 2014 13:26:26 +0000 (14:26 +0100)]
Revert "usb/gadget: multi: convert to new interface of f_ecm"

This reverts commit 0f51ef4507d61692afe5de4598b8f5df82f1ada1.

10 years agoRevert "usb/gadget: multi: convert to new interface of f_rndis"
Andrzej Pietrasiewicz [Tue, 14 Jan 2014 13:26:23 +0000 (14:26 +0100)]
Revert "usb/gadget: multi: convert to new interface of f_rndis"

This reverts commit 341030a348bb6faa52e0b69a3ba17f827aae2af2.

10 years agoRevert "usb/gadget: multi: convert to new interface of f_mass_storage"
Andrzej Pietrasiewicz [Tue, 14 Jan 2014 13:26:19 +0000 (14:26 +0100)]
Revert "usb/gadget: multi: convert to new interface of f_mass_storage"

This reverts commit dd7e1f875183653d9a6c94148e19a06bfc81f4ad.

10 years agoRevert "usb/gadget: f_mass_storage: remove compatibility layer"
Andrzej Pietrasiewicz [Tue, 14 Jan 2014 13:26:14 +0000 (14:26 +0100)]
Revert "usb/gadget: f_mass_storage: remove compatibility layer"

This reverts commit 59aad79c1789c338321789307105f676b8c8b427.

10 years agoRevert "usb/gadget: mass_storage: merge usb_f_mass_storage module with u_ms module"
Andrzej Pietrasiewicz [Tue, 14 Jan 2014 13:26:04 +0000 (14:26 +0100)]
Revert "usb/gadget: mass_storage: merge usb_f_mass_storage module with u_ms module"

This reverts commit 2e3f33eddfca46f0d4909d496f6309454b8da298.

10 years agoSplit uImage on "clean" uImage and Device Tree blob.
Jacek Pielaszkiewicz [Wed, 15 Jan 2014 14:07:54 +0000 (15:07 +0100)]
Split uImage on "clean" uImage and Device Tree blob.

1. The change is due to upgrade u-boot to latest upstream version
   which support separate uImage and DTB.
   Addtionally current defult u-boot configuration for trats2 assumes
   that kernel image and DTB are delivered as separat files.

2. DTB files are located in /boot directory.

3. Together with uImage are delivered all DTBs which are compatible with
   tizen_defconfig kernel configuration.

Change-Id: I60a581edb4edccbf2ef704de525409da6572c4f8
Signed-off-by: Jacek Pielaszkiewicz <j.pielaszkie@samsung.com>
10 years agoBring kernel packaging in line with ivi's kernel.
Jacek Pielaszkiewicz [Mon, 13 Jan 2014 11:58:43 +0000 (12:58 +0100)]
Bring kernel packaging in line with ivi's kernel.

The following changes have been implemented:

1. Add provides to for linux-kernel, linux-kernel-devel packages.

  The following "Provides" have been added:
  - kernel               - package linux-kernel
  - kernel-uname-r       - package linux-kernel
  - kernel-devel         - package linux-kernel-devel
  - kernel-devel-uname-r - package linux-kernel-devel

2. Remove linux-kernel-uImage package.

3. linux-kernel package has been extended to deliver uImage and
   kernel modules (in /boot directory)

4. Rename linux-kenrel-build package to linux-kernel-devel.

4. Extend linux-kernel-devel by the content of /lib/modules/kernel
   directory.

Change-Id: I824a307327d56c63c7cfc7eb6124d4fa10e1f49a
Signed-off-by: Jacek Pielaszkiewicz <j.pielaszkie@samsung.com>
10 years ago*spec file cleanup and linux-kernel-sources package removal.
Jacek Pielaszkiewicz [Fri, 10 Jan 2014 16:25:10 +0000 (17:25 +0100)]
*spec file cleanup and linux-kernel-sources package removal.

The following changes have been implemented:
1. linux-kernel-sources package has been removed. devel package
   is enough to correctly linux-kernel-build external kernel modules.

2. Symbolic link that points pre-build kernel sources has been added.
   The link is located in /lib/modules/__kernel_version__.

3. Rename linux-kernel-headers package on linux-kernel-user-headers.

Change-Id: I6e1a4283d832a5fced7fafbb8fefc9c369364f59
Signed-off-by: Jacek Pielaszkiewicz <j.pielaszkie@samsung.com>