platform/kernel/linux-3.10.git
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>
10 years agommc: dw_mmc: change the blk-setting value for eMMC
Jaehoon Chung [Mon, 20 Jan 2014 03:46:10 +0000 (12:46 +0900)]
mmc: dw_mmc: change the blk-setting value for eMMC

Change the blk-setting value.

(benchmark : iozone, tiotest)
Before applied this patch,
      Read : 17MB/s, Write : 71MB/s
After applied this patch,
      Read : 30MB/s, Write : 72MB/s

Increased the Read performance.

Change-Id: I64142e97aea3aa7ac3d1ca78726f8dd3c133692d
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
10 years agoextcon: max77693: Force using UART path for jig
Dmitry Kasatkin [Fri, 10 Jan 2014 11:13:40 +0000 (20:13 +0900)]
extcon: max77693: Force using UART path for jig

When USB cable is connected to jig, device disables console.
This patch forces using UART when jig cable is connected.
It allows to charge the device, which also prevents it from sleeping.

Change-Id: Ie0c8c29f40cdbed5cdad608950a6c5c428cd0fab
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
[Author information corrected and style fixed.]
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
10 years agoextcon: max77693: Differentiate info message for easier debugging
Dmitry Kasatkin [Fri, 10 Jan 2014 11:04:42 +0000 (20:04 +0900)]
extcon: max77693: Differentiate info message for easier debugging

Change-Id: Ie02b0c71100815601e40391c67cb176dca67e683
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
[Author information corrected]
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
10 years agodrivers: mmc: s3c-sdhci: select required sdhci platform driver
Marek Szyprowski [Mon, 13 Jan 2014 07:40:05 +0000 (08:40 +0100)]
drivers: mmc: s3c-sdhci: select required sdhci platform driver

s3c-sdhci requires sdhci platform driver, so add this dependency to
Kcofig entry.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I62c834664a154f38f19b0597673748bad98f7640

10 years agodrivers: clk: samsung: fix build dependency for exynos4 audss clocks
Marek Szyprowski [Mon, 13 Jan 2014 07:39:19 +0000 (08:39 +0100)]
drivers: clk: samsung: fix build dependency for exynos4 audss clocks

Fix build break for non-exynos Samsung builds.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ib954cffbfd249e4122598171566123b8d5f24deb

10 years agoUSB: gadget: s3c-hsotg: add flush TX FIFO when kill all requests
Robert Baldyga [Thu, 5 Dec 2013 14:04:19 +0000 (15:04 +0100)]
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>
Change-Id: Ibdb3d3f14f665d096ad944fb3ad79d25ff11625a

10 years agoUSB: gadget: s3c-hsotg: fix maxpacket size in s3c_hsotg_irq_enumdone
Robert Baldyga [Thu, 5 Dec 2013 10:32:22 +0000 (11:32 +0100)]
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.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Change-Id: I5a1b687958afb08000d3a86e68c5df7b343cc08d

10 years agousb: gadget: slp: fix wrong destory function
Seung-Woo Kim [Fri, 8 Nov 2013 11:48:18 +0000 (20:48 +0900)]
usb: gadget: slp: fix wrong destory function

The device_destroy() unregisters and destroys the struct dev
created by device_create(). But in destroy function, it calls for
each file created by device_create_file(). So this causes wrong
memory access like following.

[    2.804348] usb_mode: can't probe composite
[    2.808239] Unable to handle kernel NULL pointer dereference at virtual address 00000034
[    2.816064] pgd = c0004000
[    2.818713] [00000034] *pgd=00000000
[    2.822289] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
[    2.827570] Modules linked in:
[    2.830612] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 3.10.14-g86225b5 #89
[    2.837465] task: df9f8000 ti: df9f4000 task.ti: df9f4000
[    2.842859] PC is at sysfs_find_dirent+0x8/0xf0
[    2.847358] LR is at sysfs_get_dirent+0x28/0x78
[    2.851873] pc : [<c0158ee4>]    lr : [<c01590ac>]    psr: 40000113
[    2.851873] sp : df9f5ea0  ip : 00000000  fp : 00000000
[    2.863329] r10: 00000077  r9 : c0735d90  r8 : c071bc84
[    2.868537] r7 : df209000  r6 : 00000000  r5 : c04f52d0  r4 : 00000000
[    2.875046] r3 : 00000000  r2 : c04f52d0  r1 : 00000000  r0 : 00000000
[    2.881558] Flags: nZcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
[    2.888848] Control: 10c53c7d  Table: 4000404a  DAC: 00000015
[    2.894577] Process swapper/0 (pid: 1, stack limit = 0xdf9f4238)
[    2.900568] Stack: (0xdf9f5ea0 to 0xdf9f6000)
[    2.904912] 5ea0: 00000000 c04f52d0 00000000 df209000 c071bc84 c01590ac c0783420 df209008
[    2.913069] 5ec0: c0857f34 c015a6b0 df9f8000 df209000 df209008 c02b596c df209000 df209008
[    2.921228] 5ee0: c0857f34 c078531c c071bc84 c02b491c 00000000 df209000 df209200 c02ac504
[    2.929387] 5f00: df209000 ffffffed c0857f34 c02ac668 df208e00 c071be80 c0668e70 c02af718
[    2.937546] 5f20: df9f4000 c07a4e00 c0726f18 00000000 c071bc84 c00086d4 00000000 00000000
[    2.945706] 5f40: c062bed8 c06ca4ec 00000007 00000007 c06f74d0 c0726f38 00000007 c0726f18
[    2.953864] 5f60: c07a4e00 c06f74d0 c0735d90 00000077 00000000 c06f7b98 00000007 00000007
[    2.962023] 5f80: c06f74d0 c004ed8c 00000000 c04b0f20 00000000 00000000 00000000 00000000
[    2.970183] 5fa0: 00000000 c04b0f28 00000000 c000eb28 00000000 00000000 00000000 00000000
[    2.974920] ymu831 irq_handler
[    2.974944] ymu831 irq_func
[    2.984158] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    2.992317] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000 08800040 05008140
[    3.000500] [<c0158ee4>] (sysfs_find_dirent+0x8/0xf0) from [<df209008>] (0xdf209008)
[    3.008205] Code: e5838000 eafffff6 e92d41f0 e2913000 (e1d0e3b4)
[    3.014323] ---[ end trace a753dab553aa7e18 ]---

Change-Id: I58924574a3673dc8eaaea8556cd64f453344cdf3
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
10 years agoUSB: gadget: s3c-hsotg: skip suspend and resume when usb cable wasn't inserted
Byungsoo Kim [Fri, 25 Oct 2013 12:37:19 +0000 (21:37 +0900)]
USB: gadget: s3c-hsotg: skip suspend and resume when usb cable wasn't inserted

Although we didn't insert usb cable, s3c_hsotg_suspend and s3c_hsotg_resume were always called and failed.

[  519.686485] s3c-hsotg 12480000.hsotg: Failed to get CSftRst asserted
[  519.686539] s3c-hsotg 12480000.hsotg: ep0: failed to become enabled (DxEPCTL=0x00000000)

Signed-off-by: Byungsoo Kim <bs1770.kim@samsung.com>
Change-Id: I084c0436992e5be76b0dd692da44d5a45761c934

10 years agoiio: cm36651: Rebased light/proximity sensor driver
Beomho Seo [Fri, 10 Jan 2014 08:56:22 +0000 (17:56 +0900)]
iio: cm36651: Rebased light/proximity sensor driver

This patch is rebased on mainline.

The driver exposes five channels: Red, Green, Blue, Clear and Proximity.
It also support detection proximity event.

Change-Id: Ifb152f4c3dafad2524d58396866781297346d8da
Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
10 years agoiio:st_gyro: Prevent register threshold events
Beomho Seo [Fri, 10 Jan 2014 08:32:05 +0000 (17:32 +0900)]
iio:st_gyro: Prevent register threshold events

Currently, st_gyro sensor driver doesn't support threshold events.
If event_mask is not zero, driver is register threshold events.
As a result, Null pointer dereference at iio_ev_* functions.
This patch set zero event_mask of st_gyro sensor.

Change-Id: Ie39b43624ef764d3c8626f41dc4611ad09d72302
Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
10 years agovideo: display: s6e8aa0: change power off sequence to remove noise
Donghwa Lee [Fri, 10 Jan 2014 04:19:49 +0000 (13:19 +0900)]
video: display: s6e8aa0: change power off sequence to remove noise

It is need to turn off the panel more earlier than mipi dsi
to remove noise and switch the sequence of display_off and sleep_in
command following manufacturer's instruction.

Change-Id: Id2e7bf63fb84a12673fa56d572ad63ae5cf80539
Signed-off-by: Donghwa Lee <dh09.lee@samsung.com>
10 years agovideo: display: s6e8aa0: remove duplicated mtp read function
Donghwa Lee [Fri, 10 Jan 2014 02:24:33 +0000 (11:24 +0900)]
video: display: s6e8aa0: remove duplicated mtp read function

There is no need to call mtp check function whenever lcd power on.
It is sufficient just called once at booting time because mtp data
is fixed values.

Change-Id: I3f37633821c83089cb516eeb9810c4ae435d5cc1
Signed-off-by: Donghwa Lee <dh09.lee@samsung.com>
10 years ago*spec file update to build output uImage and Device Tree
Jacek Pielaszkiewicz [Fri, 3 Jan 2014 11:56:59 +0000 (12:56 +0100)]
*spec file update to build output uImage and Device Tree

The following changes have been implemented:
1. A new linux-kernel-uImage package was added. The package provide kernel uImage.
2. Additional cleanup linux-kernel-sources and linux-kernel-build packages
   was added.
3. Symbolic links linux-kernel-build-current and linux-kernel-sources-current were
   added. Links points current kernel sources and build directories.

Change-Id: Ifa889d42fca69cce4d458d9ac7e0514cfdf1caef
Signed-off-by: Jacek Pielaszkiewicz <j.pielaszkie@samsung.com>
10 years agovideo: display: s6e8aa0: adjust brightness value to driver level
Donghwa Lee [Fri, 3 Jan 2014 01:03:34 +0000 (10:03 +0900)]
video: display: s6e8aa0: adjust brightness value to driver level

Nevertheless there is only support 24 brightness steps in driver,
platform brightness status bar is suitable maximum size for 100.
Operation about brightness bar on the tizen looks that there is
something wrong. So I would adjust brightness value to driver's
brightness level.

Change-Id: Ia653a127b470208b0da9bc448f58422005e05d72
Signed-off-by: Donghwa Lee <dh09.lee@samsung.com>
10 years agoRevert "linux-kernel and linux kernel modules ABI tools."
Jacek Pielaszkiewicz [Fri, 3 Jan 2014 06:22:57 +0000 (22:22 -0800)]
Revert "linux-kernel and linux kernel modules ABI tools."

This reverts commit 23b22df7b6b7d91e7c1866dc760c2586ba161c43.

Change-Id: I3ea15671a029e781a153d43201bf79118f66b148

10 years agoRevert "linux-kernel and linux kernel modules ABI - next changes"
Jacek Pielaszkiewicz [Fri, 3 Jan 2014 06:22:38 +0000 (22:22 -0800)]
Revert "linux-kernel and linux kernel modules ABI - next changes"

This reverts commit 45fe7044915b03bc6444102e55e45cccf4a4455d.

Change-Id: Ie479df1039134b1fcd89bc942c61d6669c51faf0

10 years agoRevert "abi-checker - tool directory location update."
Jacek Pielaszkiewicz [Fri, 3 Jan 2014 06:21:59 +0000 (22:21 -0800)]
Revert "abi-checker - tool directory location update."

This reverts commit 952c6d9596e18f9df43174f513ce84ebe7cd6ca2.

Change-Id: Id6f4bd3d4e76c3a07fb8cdf121745c17e59b7a2a

10 years agoSmack: change rule cap check
Casey Schaufler [Thu, 19 Dec 2013 21:23:26 +0000 (13:23 -0800)]
Smack: change rule cap check

smk_write_change_rule() is calling capable rather than
the more correct smack_privileged(). This allows for setting
rules in violation of the onlycap facility. This is the
simple repair.

Change-Id: Icb5321b5b5355d64b0b029d9131cf60b5e97d356
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
10 years agoSmack: Make the syslog control configurable
Casey Schaufler [Mon, 23 Dec 2013 19:07:10 +0000 (11:07 -0800)]
Smack: Make the syslog control configurable

The syslog control requires that the calling proccess
have the floor ("_") Smack label. Tizen does not run any
processes except for kernel helpers with the floor label.
This changes allows the admin to configure a specific
label for syslog. The default value is the star ("*")
label, effectively removing the restriction. The value
can be set using smackfs/syslog for anyone who wants
a more restrictive behavior.

Change-Id: Ia4270bf8864bd8342e585bbdd4791fb8359e8916
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>