platform/kernel/linux-3.10.git
9 years agodma: pl330: use dma_addr_t for describing bus addresses
Will Deacon [Mon, 10 Jun 2013 18:34:38 +0000 (19:34 +0100)]
dma: pl330: use dma_addr_t for describing bus addresses

The microcode bus address (pl330_dmac.mcode_bus) is currently a u32,
which fails to compile when building on a system with 64-bit bus
addresses.

This patch uses dma_addr_t to represent the address instead.

Cc: Jassi Brar <jaswinder.singh@linaro.org>
Cc: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Acked-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
9 years agodma: pl330: rip out broken, redundant ID probing
Will Deacon [Mon, 10 Jun 2013 18:34:37 +0000 (19:34 +0100)]
dma: pl330: rip out broken, redundant ID probing

The PL330 driver probes the peripheral and primecell IDs of the device to
make sure that it is indeed an AMBA PL330. However, it does this by
making byte accesses to a device mapping of the word-aligned ID
registers, which is either UNPREDICTABLE or generates an alignment fault
(depending on the presence of the virtualisation extensions).

Rather than fix this code, we can actually rip most of it out and let
the AMBA bus driver correctly do the probing for us.

Cc: Jassi Brar <jaswinder.singh@linaro.org>
Cc: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Acked-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
9 years ago[media] V4L: s5c73m3: Add format propagation for TRY formats
Andrzej Hajda [Wed, 24 Jul 2013 13:57:32 +0000 (10:57 -0300)]
[media] V4L: s5c73m3: Add format propagation for TRY formats

Resolution set on ISP pad of S5C73M3-OIF subdev should be
propagated to source pad for TRY and ACTIVE formats.
The patch adds missing propagation for TRY format.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years ago[media] exynos4-is: Ensure the FIMC gate clock is disabled at driver remove()
Andrzej Hajda [Fri, 19 Jul 2013 10:39:53 +0000 (07:39 -0300)]
[media] exynos4-is: Ensure the FIMC gate clock is disabled at driver remove()

The patch fixes following warning:
[ 9664.460000] WARNING: CPU: 0 PID: 2880 at drivers/clk/clk.c:695 __clk_unprepare+0x8c/0xa4()
[ 9664.470000] Modules linked in: m5mols s5k5baf s5p_fimc(-) ipv6 s5p_csis v4l2_mem2mem videobuf2_dma_contig videobuf2_memops exynos4_is_common videobuf2_core [last unloaded: m5mols]
[ 9664.485000] CPU: 0 PID: 2880 Comm: rmmod Tainted: G        W    3.11.0-rc1-00070-ga94e22f-dirty #1558
[ 9664.495000] [<c0014aec>] (unwind_backtrace+0x0/0xf8) from [<c0011574>] (show_stack+0x10/0x14)
[ 9664.505000] [<c0011574>] (show_stack+0x10/0x14) from [<c038b248>] (dump_stack+0x6c/0xac)
[ 9664.510000] [<c038b248>] (dump_stack+0x6c/0xac) from [<c001d824>] (warn_slowpath_common+0x64/0x88)
[ 9664.520000] [<c001d824>] (warn_slowpath_common+0x64/0x88) from [<c001d864>] (warn_slowpath_null+0x1c/0x24)
[ 9664.530000] [<c001d864>] (warn_slowpath_null+0x1c/0x24) from [<c02f0b9c>] (__clk_unprepare+0x8c/0xa4)
[ 9664.540000] [<c02f0b9c>] (__clk_unprepare+0x8c/0xa4) from [<c02f0bc8>] (clk_unprepare+0x14/0x1c)
[ 9664.550000] [<c02f0bc8>] (clk_unprepare+0x14/0x1c) from [<bf191344>] (fimc_clk_put+0x3c/0x5c [s5p_fimc])
[ 9664.560000] [<bf191344>] (fimc_clk_put+0x3c/0x5c [s5p_fimc]) from [<bf1913c0>] (fimc_remove+0x5c/0x90 [s5p_fimc])
[ 9664.570000] [<bf1913c0>] (fimc_remove+0x5c/0x90 [s5p_fimc]) from [<c0219ca0>] (platform_drv_remove+0x18/0x1c)
[ 9664.580000] [<c0219ca0>] (platform_drv_remove+0x18/0x1c) from [<c021856c>] (__device_release_driver+0x70/0xcc)
[ 9664.590000] [<c021856c>] (__device_release_driver+0x70/0xcc) from [<c0218d54>] (driver_detach+0xac/0xb0)
[ 9664.595000] [<c0218d54>] (driver_detach+0xac/0xb0) from [<c021839c>] (bus_remove_driver+0x7c/0xc0)
[ 9664.605000] [<c021839c>] (bus_remove_driver+0x7c/0xc0) from [<c00659d8>] (SyS_delete_module+0x11c/0x204)
[ 9664.615000] [<c00659d8>] (SyS_delete_module+0x11c/0x204) from [<c000e360>] (ret_fast_syscall+0x0/0x30)
[ 9664.625000] ---[ end trace 662c092cce432c8d ]---

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years ago[media] exynos4-is: Print error message on timeout
Dan Carpenter [Fri, 23 Aug 2013 08:36:56 +0000 (05:36 -0300)]
[media] exynos4-is: Print error message on timeout

There is a stray '!' character so the error message never gets printed.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years ago[media] exynos4-is: Annotate unused functions
Sachin Kamat [Fri, 2 Aug 2013 05:32:13 +0000 (02:32 -0300)]
[media] exynos4-is: Annotate unused functions

__is_set_init_isp_aa and fimc_is_hw_set_tune currently do not have
any callers. However these functions may be used in the future. Hence
instead of deleting them, staticize and annotate them with __maybe_unused
flag to avoid compiler warnings.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years ago[media] exynos4-is: Simplify sclk_cam clocks handling
Sylwester Nawrocki [Fri, 19 Jul 2013 13:05:17 +0000 (10:05 -0300)]
[media] exynos4-is: Simplify sclk_cam clocks handling

Use clk_prepare_enable()/clk_disable_unprepare() instead of
separately prearing/unparing the clk_cam clocks. This simplifies
the code that is now mostly not going to be used, function
__fimc_md_set_camclk() is only left for S5PV210 platform which
is not yet converted to Device Tree.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years ago[media] exynos4-is: Add missing v4l2_device_unregister() call in fimc_md_remove()
Sylwester Nawrocki [Fri, 9 Aug 2013 17:23:53 +0000 (14:23 -0300)]
[media] exynos4-is: Add missing v4l2_device_unregister() call in fimc_md_remove()

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years ago[media] exynos4-is: Add missing MODULE_LICENSE for exynos-fimc-is.ko
Sylwester Nawrocki [Wed, 31 Jul 2013 14:08:19 +0000 (11:08 -0300)]
[media] exynos4-is: Add missing MODULE_LICENSE for exynos-fimc-is.ko

This fixes compilation warning:
WARNING: modpost: missing MODULE_LICENSE() in
drivers/media/platform/exynos4-is/exynos-fimc-is.o

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years ago[media] exynos4-is: Initialize the ISP subdev sd->owner field
Sylwester Nawrocki [Mon, 5 Aug 2013 13:35:25 +0000 (10:35 -0300)]
[media] exynos4-is: Initialize the ISP subdev sd->owner field

Set the subdevs owner module so the exynos4_fimc_is module cannot
be unloaded when the FIMC-IS driver is in use.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years ago[media] exynos4-is: Fix potential NULL pointer dereference
Sachin Kamat [Fri, 2 Aug 2013 07:58:25 +0000 (04:58 -0300)]
[media] exynos4-is: Fix potential NULL pointer dereference

dev->of_node could be NULL. Hence check for the same and return before
dereferencing it in the subsequent error message.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years ago[media] media: OF: add "sync-on-green-active" property
Lad, Prabhakar [Sun, 11 Aug 2013 05:02:24 +0000 (02:02 -0300)]
[media] media: OF: add "sync-on-green-active" property

This patch adds 'sync-on-green-active' property as part
of endpoint property.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years ago[media] v4l2-async: Use proper list head for iteration over registered subdevs
Sylwester Nawrocki [Wed, 31 Jul 2013 16:10:18 +0000 (13:10 -0300)]
[media] v4l2-async: Use proper list head for iteration over registered subdevs

This fixes regression introduced in commit b426b3a660c85faf6e1ca1c92c6d
[media] V4L: Merge struct v4l2_async_subdev_list with struct v4l2_subdev

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years ago[media] v4l: async: Make it safe to unregister unregistered notifier
Laurent Pinchart [Wed, 3 Jul 2013 10:49:06 +0000 (07:49 -0300)]
[media] v4l: async: Make it safe to unregister unregistered notifier

Calling v4l2_async_notifier_unregister() on a notifier that hasn't been
registered leads to a crash. To simplify drivers, make it safe to
unregister a notifier that has not been registered.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years ago[media] v4l: of: Drop acquired reference to node when getting next endpoint
Laurent Pinchart [Wed, 3 Jul 2013 02:05:51 +0000 (23:05 -0300)]
[media] v4l: of: Drop acquired reference to node when getting next endpoint

The of_get_child_by_name() function takes a reference to the node it
returns. Make sure to drop it when looking for the ports node in
v4l2_of_get_next_endpoint().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years ago[media] v4l: of: Use of_get_child_by_name()
Laurent Pinchart [Wed, 3 Jul 2013 02:04:25 +0000 (23:04 -0300)]
[media] v4l: of: Use of_get_child_by_name()

Replace a manual loop through child nodes with a call to
of_get_child_by_name().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years ago[media] V4L: Merge struct v4l2_async_subdev_list with struct v4l2_subdev
Sylwester Nawrocki [Mon, 22 Jul 2013 11:01:33 +0000 (08:01 -0300)]
[media] V4L: Merge struct v4l2_async_subdev_list with struct v4l2_subdev

By integrating the v4l2-async API internals a bit more with
the core overall the v4l2-async code becomes a bit simpler
and easier to follow.
Acked-and-tested-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years ago[media] V4L: Rename subdev field of struct v4l2_async_notifier
Sylwester Nawrocki [Fri, 19 Jul 2013 15:31:10 +0000 (12:31 -0300)]
[media] V4L: Rename subdev field of struct v4l2_async_notifier

This is a purely cosmetic change. Since the 'subdev' member
points to an array of subdevs make it more explicit by
renaming to the plural form.

Acked-and-tested-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years ago[media] V4L: Add V4L2_ASYNC_MATCH_OF subdev matching type
Sylwester Nawrocki [Fri, 19 Jul 2013 15:21:29 +0000 (12:21 -0300)]
[media] V4L: Add V4L2_ASYNC_MATCH_OF subdev matching type

Add support for matching by device_node pointer. This allows
the notifier user to simply pass a list of device_node pointers
corresponding to sub-devices.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years ago[media] V4L: Rename v4l2_async_bus_* to v4l2_async_match_*
Sylwester Nawrocki [Fri, 19 Jul 2013 15:14:46 +0000 (12:14 -0300)]
[media] V4L: Rename v4l2_async_bus_* to v4l2_async_match_*

enum v4l2_async_bus_type also selects a method subdevs are matched
in the notification handlers, rename it to v4l2_async_match_type
so V4L2_ASYNC_MATCH_OF entry can be further added for matching by
device tree node pointer.

Acked-and-tested-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years ago[media] V4L: Drop bus_type check in v4l2-async match functions
Sylwester Nawrocki [Fri, 19 Jul 2013 15:08:08 +0000 (12:08 -0300)]
[media] V4L: Drop bus_type check in v4l2-async match functions

These match_* functions are internal callbacks and are always
invoked only after checking asd->bus_type. So drop redundant
checks in match_i2c() and match_platform() functions.
Acked-and-tested-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years ago[media] V4L2: fix compilation if CONFIG_I2C is undefined
Guennadi Liakhovetski [Mon, 24 Jun 2013 08:13:51 +0000 (05:13 -0300)]
[media] V4L2: fix compilation if CONFIG_I2C is undefined

i2c_verify_client() is only available, if I2C is enabled. Fix v4l2-async.c
compilation if I2C is disabled.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
9 years ago[media] V4L2: support asynchronous subdevice registration
Guennadi Liakhovetski [Tue, 8 Jan 2013 10:06:31 +0000 (07:06 -0300)]
[media] V4L2: support asynchronous subdevice registration

Currently bridge device drivers register devices for all subdevices
synchronously, typically, during their probing. E.g. if an I2C CMOS sensor
is attached to a video bridge device, the bridge driver will create an I2C
device and wait for the respective I2C driver to probe. This makes linking
of devices straight forward, but this approach cannot be used with
intrinsically asynchronous and unordered device registration systems like
the Flattened Device Tree. To support such systems this patch adds an
asynchronous subdevice registration framework to V4L2. To use it respective
(e.g. I2C) subdevice drivers must register themselves with the framework.
A bridge driver on the other hand must register notification callbacks,
that will be called upon various related events.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
9 years ago[media] V4L2: add a device pointer to struct v4l2_subdev
Guennadi Liakhovetski [Mon, 10 Jun 2013 18:07:35 +0000 (15:07 -0300)]
[media] V4L2: add a device pointer to struct v4l2_subdev

It is often useful to have simple means to get from a subdevice to the
underlying physical device. This patch adds such a pointer to struct
v4l2_subdev and sets it accordingly in the I2C and SPI cases.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
9 years ago[media] V4L2: add temporary clock helpers
Guennadi Liakhovetski [Tue, 4 Dec 2012 10:42:15 +0000 (07:42 -0300)]
[media] V4L2: add temporary clock helpers

Typical video devices like camera sensors require an external clock source.
Many such devices cannot even access their hardware registers without a
running clock. These clock sources should be controlled by their consumers.
This should be performed, using the generic clock framework. Unfortunately
so far only very few systems have been ported to that framework. This patch
adds a set of temporary helpers, mimicking the generic clock API, to V4L2.
Platforms, adopting the clock API, should switch to using it. Eventually
this temporary API should be removed.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
9 years agoclk: Implement clk_unregister
Sylwester Nawrocki [Tue, 6 Aug 2013 10:50:03 +0000 (12:50 +0200)]
clk: Implement clk_unregister

clk_unregister() is currently not implemented and it is required when
a clock provider module needs to be unloaded.

Normally the clock supplier module is prevented to be unloaded by
taking reference on the module in clk_get().

For cases when the clock supplier module deinitializes despite the
consumers of its clocks holding a reference on the module, e.g. when
the driver is unbound through "unbind" sysfs attribute, there are
empty clock ops added. These ops are assigned temporarily to struct
clk and used until all consumers release the clock, to avoid invoking
callbacks from the module which just got removed.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
Changes since v6:
 - fixed handling of NULL clk in clk_unregister(), clk pointer checks
   done before taking prepare_lock, pr_err() replaced with WARN_ON_ONCE.

Changes since v5:
- ensure clk->kref is not referenced when the passed clk is NULL.

Changes since v4:
 - none.

Changes since v3:
 - Use WARN_ON_ONCE() rather than WARN_ON() in clk_nodrv_disable_unprepare()
   callback.

Changes since v2:
 - none.

Changes since RFC v1:
 - renamed clk_dummy_* to clk_nodrv_*.

Changes since v3 of the original patch [1]:
 - reparent all children to the orphan list instead of leaving
   the clock unregistered when it has child clocks,
 - removed unnecessary prerequisite checks in clk_debug_unregister(),
 - struct clk is now being freed only when the last clock consumer
   calls clk_put(),
 - empty clock ops are used after clk_unregister() has been called
   until all references to the clock are released and the clock
   object is freed.

[1] http://www.spinics.net/lists/arm-kernel/msg247548.html

9 years agoclk: Assign module owner of a clock being registered
Sylwester Nawrocki [Fri, 23 Aug 2013 11:04:33 +0000 (13:04 +0200)]
clk: Assign module owner of a clock being registered

Use dev->driver->owner as the owner module of a clock, it ensures
reference on the module is taken in the __clk_get(), __clk_put()
helpers.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
Changes since v5:
 - none.

9 years agoclk: Add common __clk_get(), __clk_put() implementations
Sylwester Nawrocki [Fri, 30 Aug 2013 11:02:40 +0000 (13:02 +0200)]
clk: Add common __clk_get(), __clk_put() implementations

This patch adds common __clk_get(), __clk_put() clkdev helpers which
replace their platform specific counterparts when the common clock
API is enabled.

The owner module pointer field is added to struct clk so a reference
to the clock supplier module can be taken by the clock consumers.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
Changes since v5:
 - none.

Changes since v4:
 - dropped unnecessary struct module forward declaration from
   clk-provider.h

Changes since v3:
 - dropped exporting of __clk_get(), __clk_put().

Changes since v2:
 - fixed handling of NULL clock pointers in __clk_get(), __clk_put();

9 years agoclkdev: Fix race condition in clock lookup from device tree
Sylwester Nawrocki [Fri, 9 Aug 2013 15:33:39 +0000 (17:33 +0200)]
clkdev: Fix race condition in clock lookup from device tree

There is currently a race condition in the device tree part of clk_get()
function, since the pointer returned from of_clk_get_by_name() may become
invalid before __clk_get() call. E.g. due to the clock provider driver
remove() callback being called in between of_clk_get_by_name() and
__clk_get().

Fix this by doing both the look up and __clk_get() operations with the
clock providers list mutex held. This ensures that the clock pointer
returned from __of_clk_get_from_provider() call and passed to __clk_get()
is valid, as long as the clock supplier module first removes its clock
provider instance and then does clk_unregister() on the corresponding
clocks.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
Changes since v2:
 - none.

Changes since v1:
 - include "clk.h".

9 years agoclk: Provide not locked variant of of_clk_get_from_provider()
Sylwester Nawrocki [Fri, 9 Aug 2013 18:38:10 +0000 (20:38 +0200)]
clk: Provide not locked variant of of_clk_get_from_provider()

Add helper functions for the of_clk_providers list locking and
an unlocked variant of of_clk_get_from_provider().
These functions are intended to be used in the clkdev to avoid
race condition in the device tree based clock look up in clk_get().

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
Changes since v3:
 - none.

Changes since v2:
 - fixed typo in clk.h.

Changes since v1:
 - moved the function declaractions to a local header.

9 years agousb/gadget: mass_storage: merge usb_f_mass_storage module with u_ms module
Andrzej Pietrasiewicz [Thu, 11 Jul 2013 11:24:00 +0000 (13:24 +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>
9 years agousb/gadget: f_mass_storage: remove compatibility layer
Andrzej Pietrasiewicz [Thu, 11 Jul 2013 11:20:53 +0000 (13:20 +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>
9 years agousb/gadget: multi: convert to new interface of f_mass_storage
Andrzej Pietrasiewicz [Tue, 30 Jul 2013 09:23:28 +0000 (11:23 +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>
9 years agousb/gadget: multi: convert to new interface of f_rndis
Andrzej Pietrasiewicz [Fri, 26 Jul 2013 09:15:55 +0000 (11:15 +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>
9 years agousb/gadget: multi: convert to new interface of f_ecm
Andrzej Pietrasiewicz [Fri, 26 Jul 2013 09:12:46 +0000 (11:12 +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>
9 years agousb/gadget: acm_ms: convert to new interface of f_mass_storage
Andrzej Pietrasiewicz [Tue, 30 Jul 2013 09:22:47 +0000 (11:22 +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>
9 years agousb/gadget: f_mass_storage: add configfs support
Andrzej Pietrasiewicz [Fri, 19 Jul 2013 07:14:44 +0000 (09:14 +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>
9 years agousb/gadget: storage_common: add methods to show/store 'cdrom' and 'removable'
Andrzej Pietrasiewicz [Wed, 3 Jul 2013 12:44:11 +0000 (14:44 +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>
9 years agousb/gadget: storage_common: make attribute operations more generic
Andrzej Pietrasiewicz [Wed, 3 Jul 2013 12:43:07 +0000 (14:43 +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>
9 years agousb/gadget: mass_storage: convert to new interface of f_mass_storage
Andrzej Pietrasiewicz [Tue, 30 Jul 2013 08:24:55 +0000 (10:24 +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.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
9 years agousb/gadget: f_mass_storage: convert to new function interface with backward compatibility
Andrzej Pietrasiewicz [Wed, 3 Jul 2013 12:40:41 +0000 (14:40 +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>
9 years agousb/gadget: f_mass_storage: use fsg_common_run_thread in fsg_common_init
Andrzej Pietrasiewicz [Wed, 3 Jul 2013 12:39:20 +0000 (14:39 +0200)]
usb/gadget: f_mass_storage: use fsg_common_run_thread in fsg_common_init

fsg_common_init is a lengthy function. Now there are helper functions
which cover all parts of it. Use them.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
9 years agousb/gadget: f_mass_storage: use fsg_common_set_inquiry_string in fsg_common_init
Andrzej Pietrasiewicz [Wed, 3 Jul 2013 12:38:53 +0000 (14:38 +0200)]
usb/gadget: f_mass_storage: use fsg_common_set_inquiry_string in fsg_common_init

fsg_common_init is a lengthy function. Now there are helper functions
which cover all parts of it. Use them.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
9 years agousb/gadget: f_mass_storage: use fsg_common_create_luns in fsg_common_init
Andrzej Pietrasiewicz [Fri, 26 Jul 2013 11:56:33 +0000 (13:56 +0200)]
usb/gadget: f_mass_storage: use fsg_common_create_luns in fsg_common_init

fsg_common_init is a lengthy function. Now there are helper functions
which cover all parts of it. Use them.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
9 years agousb/gadget: f_mass_storage: use fsg_common_set_cdev in fsg_common_init
Andrzej Pietrasiewicz [Fri, 21 Jun 2013 09:30:51 +0000 (11:30 +0200)]
usb/gadget: f_mass_storage: use fsg_common_set_cdev in fsg_common_init

fsg_common_init is a lengthy function. Now there are helper functions
which cover all parts of it. Use them.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
9 years agousb/gadget: f_mass_storage: use fsg_common_set_ops/_private_data in fsg_common_init
Andrzej Pietrasiewicz [Fri, 21 Jun 2013 09:29:58 +0000 (11:29 +0200)]
usb/gadget: f_mass_storage: use fsg_common_set_ops/_private_data in fsg_common_init

fsg_common_init is a lengthy function. Now there are helper functions
which cover all parts of it. Use them.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
9 years agousb/gadget: f_mass_storage: use fsg_common_set_nluns in fsg_common_init
Andrzej Pietrasiewicz [Thu, 18 Jul 2013 12:08:17 +0000 (14:08 +0200)]
usb/gadget: f_mass_storage: use fsg_common_set_nluns in fsg_common_init

fsg_common_init is a lengthy function. Now there are helper functions
which cover all parts of it. Use them.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
9 years agousb/gadget: f_mass_storage: use fsg_common_set_num_buffers in fsg_common_init
Andrzej Pietrasiewicz [Thu, 18 Jul 2013 12:02:59 +0000 (14:02 +0200)]
usb/gadget: f_mass_storage: use fsg_common_set_num_buffers in fsg_common_init

fsg_common_init is a lengthy function. Now there are helper functions
which cover all parts of it. Use them.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
9 years agousb/gadget: f_mass_storage: use fsg_common_setup in fsg_common_init
Andrzej Pietrasiewicz [Thu, 18 Jul 2013 12:02:28 +0000 (14:02 +0200)]
usb/gadget: f_mass_storage: use fsg_common_setup in fsg_common_init

fsg_common_init is a lengthy function. Now there are helper functions
which cover all parts of it. Use them.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
9 years agousb/gadget: f_mass_storage: split fsg_common initialization into a number of functions
Andrzej Pietrasiewicz [Mon, 29 Jul 2013 12:50:17 +0000 (14:50 +0200)]
usb/gadget: f_mass_storage: split fsg_common initialization into a number of functions

When configfs is in place, the things related to intialization
of struct fsg_common will be split over a number of places.
This patch adds several functions which together cover the former
intialization routine fsg_common_init.

When configfs is in place, the luns will not be represented in sysfs,
so there will be no struct device associated with a lun.
To prepare for this 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>
9 years agousb/gadget: f_mass_storage: use usb_gstrings_attach
Andrzej Pietrasiewicz [Tue, 4 Jun 2013 08:58:57 +0000 (10:58 +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>
9 years agousb/gadget: f_mass_storage: add a level of indirection for luns storage
Andrzej Pietrasiewicz [Fri, 26 Jul 2013 10:20:27 +0000 (12:20 +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>
9 years agousb/gadget: f_mass_storage: factor out a header file
Andrzej Pietrasiewicz [Thu, 6 Jun 2013 11:06:24 +0000 (13:06 +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>
9 years agousb/gadget: create a utility module for mass_storage
Andrzej Pietrasiewicz [Wed, 3 Jul 2013 12:59:48 +0000 (14:59 +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>
9 years agousb/gadget: configfs: add a method to unregister the gadget
Andrzej Pietrasiewicz [Fri, 21 Jun 2013 08:25:27 +0000 (10:25 +0200)]
usb/gadget: configfs: add a method to unregister the gadget

Add a method to unregister the gadget using its config_item.

There can be functions (e.g. mass storage), which in some circumstances
need the gadget stopped. Add a method of stopping the gadget.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
9 years agousb/gadget: configfs: keep a function if it is not successfully added
Andrzej Pietrasiewicz [Wed, 7 Aug 2013 11:58:20 +0000 (13:58 +0200)]
usb/gadget: configfs: keep a function if it is not successfully added

If usb_add_function() fails then the currently processed function
is already not in the list in struct config_usb_cfg, and neither is it
in the list in struct usb_configuration. At the err_purge_funcs label the
purge_config_funcs() is called, which iterates over all configurations,
and in each configuration it iterates over all _successfully_ added
functions, and moves them back from the list in struct usb_configuration
to the list in struct config_usb_cfg. BUT the function which has just
failed adding and caused the unwind process is not taken care of and
is effectively lost.

This patch modifies the configfs_composite_bind() function so that if
the usb_add_function() fails, then the currently processed function
is returned to the list in struct config_usb_cfg.

It would be tempting to delay the list_del() in question after
usb_add_function() invocation, but a struct list_head (&f->list) cannot be
stored in more than one list at the same time, so the list_del() must
be called before usb_add_function(). Hence, the solution is to list_add()
after usb_add_function() in case of error.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
9 years agousb/gadget: cdc2: fix conversion to new interface of f_ecm
Andrzej Pietrasiewicz [Thu, 1 Aug 2013 14:04:34 +0000 (16:04 +0200)]
usb/gadget: cdc2: fix conversion to new interface of f_ecm

This fixes commit a38a275030086d95306555e544fc7c0e65ccd00e
(usb: gadget: cdc2: convert to new interface of f_ecm)

The invocation of usb_get_function_instance() is in cdc_bind()
and should not be repeated in cdc_do_config().

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
9 years agousb: gadget: f_phonet: remove unused preprocessor conditional
Andrzej Pietrasiewicz [Fri, 26 Jul 2013 12:37:14 +0000 (14:37 +0200)]
usb: gadget: f_phonet: remove unused preprocessor conditional

The compatibility layer which the USBF_PHONET_INCLUDED was a part of
is no longer present - the USBF_PHONET_INCLUDED is not #defined by anyone
anymore, so the ifndef is always true. Removing 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>
9 years agousb: gadget: multi: fix error return code in cdc_do_config()
Andrzej Pietrasiewicz [Fri, 26 Jul 2013 12:37:13 +0000 (14:37 +0200)]
usb: gadget: multi: fix error return code in cdc_do_config()

Fix to return a negative error code from the error handling
case instead of 0, as returned elsewhere in this function.

Introduced by commit 59835a (usb: gadget: multi: use
function framework for ACM.)

Make rndis_do_config() consistent with cdc_do_config() in the way it
handles returning the PTR_ERR(f_acm_*).

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>
9 years agousb: gadget: free opts struct on error recovery
Andrzej Pietrasiewicz [Thu, 25 Jul 2013 07:13:18 +0000 (09:13 +0200)]
usb: gadget: free opts struct on error recovery

Fix memory leaks introduced in commits:

40d133d7f542616cf9538508a372306e626a16e9
usb: gadget: f_ncm: convert to new function interface with backward compatibility

fee562a6450b7806f1fbbe1469a67b5395b5c10a
usb: gadget: f_ecm: convert to new function interface with backward compatibility

fcbdf12ebef73a6069e2a1aada1e546fb578a4aa
usb: gadget: f_phonet: convert to new function interface with backward compatibility

b29002a157940752dfed2c488b2011f63f007d71
usb: gadget: f_eem: convert to new function interface with backward compatibility

8cedba7c73af1369599b1111639cfeb66fe13aaa
usb: gadget: f_subset: convert to new function interface with backward compatibility

f466c6353819326873fa48a02c6f2d7c903240d6
usb: gadget: f_rndis: convert to new function interface with backward compatibility

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>
9 years agousb: gadget: ether: put_usb_function on unbind
Andrzej Pietrasiewicz [Wed, 24 Jul 2013 10:47:46 +0000 (12:47 +0200)]
usb: gadget: ether: put_usb_function on unbind

Fix bugs introduced in

9c62ce83e4258bacc459faf57bf2ed83cce6be08
usb: gadget: ether: convert to new interface of f_ecm

94b5573e97729f0e1496d23b69cbe2c6b24ec0c3
usb: gadget: ether: convert to new interface of f_eem

8af5232d6f48896b151898ccb2e9e155481bb785
usb: gadget: ether: convert to new interface of f_subset

9bd4a10e1bf881af0b0a7c117c7092b558447047
usb: gadget: ether: convert to new interface of f_rndis

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>
9 years agousb: gadget: Kconfig: Fix configfs-based RNDIS function build
Andrzej Pietrasiewicz [Tue, 9 Jul 2013 06:14:39 +0000 (08:14 +0200)]
usb: gadget: Kconfig: Fix configfs-based RNDIS function build

USB_CONFIGFS_RNDIS depends on USB_U_RNDIS. Select it.

Acked-by: Michal Nazarewicz <mina86@mina86.com>
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>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: f_subset: fix missing unlock on error in geth_alloc()
Wei Yongjun [Tue, 18 Jun 2013 03:40:55 +0000 (11:40 +0800)]
usb: gadget: f_subset: fix missing unlock on error in geth_alloc()

Add the missing unlock before return from function geth_alloc()
in the error handling case.

Introduced by commit 02832e56f88a981474ee4c7c141f46fc1b4454f4.
(usb: gadget: f_subset: add configfs support)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: gadget: f_ncm: fix missing unlock on error in ncm_alloc()
Wei Yongjun [Tue, 18 Jun 2013 03:43:29 +0000 (11:43 +0800)]
usb: gadget: f_ncm: fix missing unlock on error in ncm_alloc()

Add the missing unlock before return from function ncm_alloc()
in the error handling case.

Introduced by commit e730660378be92b83288b59b824ccdace5cd2652.
(usb: gadget: f_ncm: add configfs support)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: gadget: f_ecm: fix missing unlock on error in ecm_alloc()
Wei Yongjun [Tue, 18 Jun 2013 04:21:21 +0000 (12:21 +0800)]
usb: gadget: f_ecm: fix missing unlock on error in ecm_alloc()

Add the missing unlock before return from function ecm_alloc()
in the error handling case.

Introduced by commit da92801c647cdebfd45001fd6aaecb8f0be7f56b.
(usb: gadget: f_ecm: add configfs support)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb/gadget: Kconfig: fix separate building of configfs-enabled functions
Andrzej Pietrasiewicz [Thu, 13 Jun 2013 08:37:24 +0000 (10:37 +0200)]
usb/gadget: Kconfig: fix separate building of configfs-enabled functions

USB_CONFGFS_ZZZZ should appear under a tristate option in order to allow
selecting more than one function without building the legacy gadgets.
Now there are two problems:

1) they can't be selected at all, because they depend on USB_CONFIGFS,
and the patch which adds USB_CONFIGFS has not been merged.
2) they don't select USB_LIBCOMPOSITE (which they need but which is
selected by USB_CONFIGFS)

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: gadget: f_mass_storage: fix default product name
Andrzej Pietrasiewicz [Tue, 4 Jun 2013 13:27:54 +0000 (15:27 +0200)]
usb: gadget: f_mass_storage: fix default product name

If cfg->product name is not set, a default name is chosen depending
on the common->luns->cdrom flag. If the flag is set the name should
be "File-CD Gadget", and if the flag is not set the name should be
"File-Stor Gadget".

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>
9 years agousb: gadget: f_rndis: add configfs support
Andrzej Pietrasiewicz [Tue, 28 May 2013 07:16:01 +0000 (09:16 +0200)]
usb: gadget: f_rndis: add configfs support

f_rndis learns about configfs so we can, eventually,
remove in-kernel gadget drivers.

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>
9 years agousb: gadget: f_rndis: use usb_gstrings_attach
Andrzej Pietrasiewicz [Tue, 28 May 2013 07:16:00 +0000 (09:16 +0200)]
usb: gadget: f_rndis: use usb_gstrings_attach

use new usb_gstrings_attach 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>
9 years agousb: gadget: rndis: init & exit rndis at module load/unload
Andrzej Pietrasiewicz [Tue, 28 May 2013 07:15:59 +0000 (09:15 +0200)]
usb: gadget: rndis: init & exit rndis at module load/unload

This is required in preparation for using usb_gstrings_attach.

The rndis initialization so far has been performed on the first
occurence of rndis_bind(), but the condition to check it (first
or not first) was "borrowed" from strings handling.

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>
9 years agousb: gadget: ether: convert to new interface of f_rndis
Andrzej Pietrasiewicz [Tue, 28 May 2013 07:15:58 +0000 (09:15 +0200)]
usb: gadget: ether: convert to new interface of f_rndis

use new interface so old one 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>
9 years agousb: gadget: f_rndis: convert to new function interface with backward compatibility
Andrzej Pietrasiewicz [Tue, 28 May 2013 07:15:57 +0000 (09:15 +0200)]
usb: gadget: f_rndis: convert to new function interface with backward compatibility

Converting rndis to the new function interface requires converting
the USB rndis' function code and its users.

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

The file is now compiled into a separate usb_f_rndis.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>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: f_subset: add configfs support
Andrzej Pietrasiewicz [Tue, 28 May 2013 07:15:56 +0000 (09:15 +0200)]
usb: gadget: f_subset: add configfs support

f_subset learns about configfs so we can, eventually,
remove in-kernel gadget drivers.

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>
9 years agousb: gadget: f_subset: use usb_gstrings_attach
Andrzej Pietrasiewicz [Tue, 28 May 2013 07:15:55 +0000 (09:15 +0200)]
usb: gadget: f_subset: use usb_gstrings_attach

use the new usb_gstrings_attach 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>
9 years agousb: gadget: ether: convert to new interface of f_subset
Andrzej Pietrasiewicz [Tue, 28 May 2013 07:15:54 +0000 (09:15 +0200)]
usb: gadget: ether: convert to new interface of f_subset

teach ethernet code about the new interface of f_subset so
the old one can eventually 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>
9 years agousb: gadget: f_subset: convert to new function interface with backward compatibility
Andrzej Pietrasiewicz [Tue, 28 May 2013 07:15:53 +0000 (09:15 +0200)]
usb: gadget: f_subset: convert to new function interface with backward compatibility

Converting ecm subset to the new function interface requires converting
the USB subset's function code and its users.

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

The file is now compiled into a separate usb_f_subset.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>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: multi: Remove unused include
Andrzej Pietrasiewicz [Tue, 28 May 2013 07:15:52 +0000 (09:15 +0200)]
usb: gadget: multi: Remove unused include

cleanup only, no functional changes.

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>
9 years agousb: gadget: f_eem: add configfs support
Andrzej Pietrasiewicz [Tue, 28 May 2013 07:15:51 +0000 (09:15 +0200)]
usb: gadget: f_eem: add configfs support

f_eem learns about our configfs interface so we
can remove in-kernel gadget drivers in future.

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>
9 years agousb: gadget: f_eem: use usb_gstrings_attach
Andrzej Pietrasiewicz [Tue, 28 May 2013 07:15:50 +0000 (09:15 +0200)]
usb: gadget: f_eem: use usb_gstrings_attach

use the new usb_gstrings_attach 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>
9 years agousb: gadget: f_eem: remove compatibility layer
Andrzej Pietrasiewicz [Tue, 28 May 2013 07:15:49 +0000 (09:15 +0200)]
usb: gadget: f_eem: 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>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: ether: convert to new interface of f_eem
Andrzej Pietrasiewicz [Tue, 28 May 2013 07:15:48 +0000 (09:15 +0200)]
usb: gadget: ether: convert to new interface of f_eem

use new interface so old one 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>
9 years agousb: gadget: f_eem: convert to new function interface with backward compatibility
Andrzej Pietrasiewicz [Tue, 28 May 2013 07:15:47 +0000 (09:15 +0200)]
usb: gadget: f_eem: convert to new function interface with backward compatibility

Converting eem to the new function interface requires converting
the USB eem's function code and its users.

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

The file is now compiled into a separate usb_f_eem.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>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: ether: convert to new interface of f_ecm
Andrzej Pietrasiewicz [Tue, 28 May 2013 07:15:46 +0000 (09:15 +0200)]
usb: gadget: ether: convert to new interface of f_ecm

moving to new interface so we can remove the older one.

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>
9 years agousb: gadget: u_ether: allow getting binary-form host address
Andrzej Pietrasiewicz [Tue, 28 May 2013 07:15:45 +0000 (09:15 +0200)]
usb: gadget: u_ether: allow getting binary-form host address

helper function to copy MAC address to proper place.

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>
9 years agousb: gadget: f_phonet: add configfs support
Andrzej Pietrasiewicz [Thu, 23 May 2013 08:51:15 +0000 (10:51 +0200)]
usb: gadget: f_phonet: add configfs support

f_phonet learns about configfs so we can remove
in-kernel gadget drivers.

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>
9 years agousb: gadget: nokia: convert to new interface of f_ecm
Andrzej Pietrasiewicz [Thu, 23 May 2013 08:51:14 +0000 (10:51 +0200)]
usb: gadget: nokia: convert to new interface of f_ecm

this will let us deprecate (and remove) the old 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>
9 years agousb: gadget: f_phonet: remove compatibility layer
Andrzej Pietrasiewicz [Thu, 23 May 2013 08:51:13 +0000 (10:51 +0200)]
usb: gadget: f_phonet: 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>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: nokia: convert to new interface of f_phonet
Andrzej Pietrasiewicz [Thu, 23 May 2013 08:51:12 +0000 (10:51 +0200)]
usb: gadget: nokia: convert to new interface of f_phonet

use the new interface which will allow us to deprecate the
legacy way of binding functions.

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>
9 years agousb: gadget: f_phonet: convert to new function interface with backward compatibility
Andrzej Pietrasiewicz [Thu, 23 May 2013 08:51:11 +0000 (10:51 +0200)]
usb: gadget: f_phonet: convert to new function interface with backward compatibility

Converting f_phonet to the new function interface requires converting
the f_phonet's function code and its users.

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

The file is now compiled into a separate usb_f_phonet.ko module.

The old function interface is provided by means of 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>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: phonet: move global dev variable to its user
Andrzej Pietrasiewicz [Thu, 23 May 2013 08:51:10 +0000 (10:51 +0200)]
usb: gadget: phonet: move global dev variable to its user

cleanup patch only in preparation for 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>
9 years agousb: gadget: f_obex: remove compatibility layer
Andrzej Pietrasiewicz [Thu, 23 May 2013 08:51:09 +0000 (10:51 +0200)]
usb: gadget: f_obex: 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>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: nokia: convert to new interface of f_obex
Andrzej Pietrasiewicz [Thu, 23 May 2013 08:51:08 +0000 (10:51 +0200)]
usb: gadget: nokia: convert to new interface of f_obex

preparation to use configfs-based approach on g_nokia.ko

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>
9 years agousb: gadget: f_obex: use usb_gstrings_attach
Andrzej Pietrasiewicz [Thu, 23 May 2013 08:51:07 +0000 (10:51 +0200)]
usb: gadget: f_obex: use usb_gstrings_attach

use the new usb_gstrings_attach 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>
9 years agousb: gadget: f_ecm: add configfs support
Andrzej Pietrasiewicz [Thu, 23 May 2013 08:32:06 +0000 (10:32 +0200)]
usb: gadget: f_ecm: add configfs support

f_ecm learns about our new configfs-based binding.

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>
9 years agousb: gadget: f_ecm: use usb_gstrings_attach
Andrzej Pietrasiewicz [Thu, 23 May 2013 08:32:05 +0000 (10:32 +0200)]
usb: gadget: f_ecm: use usb_gstrings_attach

use the new usb_gstrings_attach 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>
9 years agousb: gadget: cdc2: convert to new interface of f_ecm
Andrzej Pietrasiewicz [Thu, 23 May 2013 08:32:04 +0000 (10:32 +0200)]
usb: gadget: cdc2: convert to new interface of f_ecm

f_ecm has been converted to new configfs infrastructure,
fixing cdc2 gadget driver.

[ balbi@ti.com : fixed a bunch of errors when adding ECM function ]

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>
9 years agousb: gadget: f_ecm: convert to new function interface with backward compatibility
Andrzej Pietrasiewicz [Thu, 23 May 2013 08:32:03 +0000 (10:32 +0200)]
usb: gadget: f_ecm: convert to new function interface with backward compatibility

Converting ecm to the new function interface requires converting
the USB ecm's function code and its users.

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

The file is now compiled into a separate usb_f_ecm.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>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: add helpers for configfs support for USB Ethernet
Andrzej Pietrasiewicz [Thu, 23 May 2013 08:32:02 +0000 (10:32 +0200)]
usb: gadget: add helpers for configfs support for USB Ethernet

All USB Ethernet functions will have very similar attributes in configfs.

This patch provides helper definitions to ease writing the functions and
reduce source code duplication.

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>
9 years agousb: gadget: f_ncm: add configfs support
Andrzej Pietrasiewicz [Thu, 23 May 2013 07:22:10 +0000 (09:22 +0200)]
usb: gadget: f_ncm: add configfs support

Add configfs support to the NCM function driver so
that we can, eventually, get rid of kernel-based
gadget drivers.

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>
9 years agousb: gadget: f_ncm: use usb_gstrings_attach
Andrzej Pietrasiewicz [Thu, 23 May 2013 07:22:09 +0000 (09:22 +0200)]
usb: gadget: f_ncm: use usb_gstrings_attach

Trivial patch making use of the new usb_gstrings_attach
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>