platform/kernel/linux-3.10.git
9 years agoarm: dts: exynos4: add HDMI devices
Tomasz Stanislawski [Thu, 17 Oct 2013 11:56:04 +0000 (13:56 +0200)]
arm: dts: exynos4: add HDMI devices

This patch adds DT nodes for HDMI related devices on SoCs from Exynos4 family.

Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
Change-Id: I92462470abd05ce14635b33a37b3f1e50e463085

9 years agoarm: dts: exynos4: add i2c controller for HDMIPHY
Tomasz Stanislawski [Thu, 17 Oct 2013 11:56:04 +0000 (13:56 +0200)]
arm: dts: exynos4: add i2c controller for HDMIPHY

This patch adds DT nodes for I2C controller dedicated for HDMIPHY.

Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
Change-Id: Ia45c9fc0594b534036175deaee5562ca66dcbcc0

9 years agodrm: exynos: hdmi: add support for pixel clock limitation
Tomasz Stanislawski [Thu, 19 Dec 2013 15:24:07 +0000 (16:24 +0100)]
drm: exynos: hdmi: add support for pixel clock limitation

Adds support for limitation of maximal pixel clock of HDMI
signal. This feature is needed on boards that contains
lines or bridges with frequency limitations.

Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
Change-Id: I4cc38e995feeaca77b73e9ea0197d67f99d57715

9 years agodrm: exynos: add compatibles for HDMI and Mixer chips and exynos4210 SoC
Tomasz Stanislawski [Wed, 16 Oct 2013 11:41:14 +0000 (13:41 +0200)]
drm: exynos: add compatibles for HDMI and Mixer chips and exynos4210 SoC

This patch add proper compatibles for Mixer and HDMI chip
available on exynos4210 SoCs.

Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
Change-Id: I5ca49ea9f95b139834de9ed8bba79b37b685bf3a

9 years agodrm: exynos: migrate to Common Clock Framework
Tomasz Stanislawski [Wed, 9 Oct 2013 13:51:00 +0000 (15:51 +0200)]
drm: exynos: migrate to Common Clock Framework

Transform all clk_enable() to clk_prepare_enable() and
all clk_disable() to clk_disable_unprepare().

Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
Change-Id: Iaf66f2229677234273c7b66f6d9f0f17c74bf2ff

9 years agodrm: exynos: hdmi: simplify extracting hpd-gpio from DT
Tomasz Stanislawski [Tue, 15 Oct 2013 14:40:07 +0000 (16:40 +0200)]
drm: exynos: hdmi: simplify extracting hpd-gpio from DT

This patch eliminates redundant checks while retrieving HPD gpio from DT during
HDMI's probe().

Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
Change-Id: I1f2312291bd7c2334783c8067889b95db305377f

9 years agodrm: exynos: hdmi: use hdmiphy as PHY
Tomasz Stanislawski [Thu, 3 Oct 2013 14:04:53 +0000 (16:04 +0200)]
drm: exynos: hdmi: use hdmiphy as PHY

The HDMIPHY (physical interface) is controlled by a single
bit in a power controller's regiter. It was implemented
as clock. It was a simple but effective hack.

This patch makes HDMI driver to control HDMIPHY via PHY interface.

Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
Change-Id: I7e4729b61c7e71f7e411d423794420893f99f384

9 years agoclk: exynos4: enable clk_set_parent() propagation for sclk_hdmi and sclk_mixer clocks
Tomasz Stanislawski [Wed, 16 Oct 2013 11:08:55 +0000 (13:08 +0200)]
clk: exynos4: enable clk_set_parent() propagation for sclk_hdmi and sclk_mixer clocks

This patch enables clk_set_parent() propagation for clocks used
by s5p-tv and exynos-drm drivers.

Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
Change-Id: I8f91dcd73a43291297def7f69eb35950afd45c55

9 years agoclk: propagate parent change up one level
Tomasz Stanislawski [Tue, 15 Oct 2013 15:59:11 +0000 (17:59 +0200)]
clk: propagate parent change up one level

This patch adds support for propagation of setup of clock's parent one level
up.

This feature is helpful when a driver changes topology of its clocks using
clk_set_parent().  The problem occurs when on one platform/SoC driver's clock
is located at MUX output but on the other platform/SoC there is a gated proxy
clock between the MUX and driver's clock.  In such a case, driver's code has to
be modified to use one clock for enabling and the other clock for setup of a
parent.

The code updates are avoided by propagating setup of a parent up one level.

Additionally, this patch adds CLK_SET_PARENT_PARENT (sorry for naming) flag to
inform clk-core that clk_set_parent() should be propagated.

Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
Change-Id: I206d23fb86cc09bce943ef9971a710876e3a7744

9 years agoclk: exynos4: export sclk_hdmiphy clock
Tomasz Stanislawski [Mon, 7 Oct 2013 12:27:52 +0000 (14:27 +0200)]
clk: exynos4: export sclk_hdmiphy clock

Export sclk_hdmiphy clock to be usable from DT.

Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
Change-Id: I0d1c8d0c2e2e93bd34f9fcdf82154208c2381a73

9 years agomisc: add sii9234 driver
Tomasz Stanislawski [Fri, 20 Dec 2013 11:30:43 +0000 (12:30 +0100)]
misc: add sii9234 driver

Add driver for HDMI bridge usnig MHL connection.
Contains refactored MHL driver developed by:

Adam Hampson <ahampson@sta.samsung.com>
Erik Gilling <konkers@android.com>
Shankar Bandal <shankar.b@samsung.com>
Dharam Kumar <dharam.kr@samsung.com>

Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
Change-Id: I7fed88ab786a4fef8fb97dca6c7336d11eb806c5

9 years agophy: Add exynos-phy driver
Tomasz Stanislawski [Mon, 30 Sep 2013 15:46:53 +0000 (17:46 +0200)]
phy: Add exynos-phy driver

Add exynos-phy driver to support a single register
PHY interfaces present on Exynos4 SoC.

Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
Change-Id: I1a2eeab876507e1e427fcb26782d060a1614852a

9 years agotools: usb: aio example applications
Robert Baldyga [Tue, 11 Feb 2014 10:43:03 +0000 (11:43 +0100)]
tools: usb: aio example applications

This patch adds two example applications showing usage of Asynchronous I/O API
of FunctionFS. First one (aio_simple) is simple example of bidirectional data
transfer. Second one (aio_multibuff) shows multi-buffer data transfer, which
may to be used in high performance applications.

Both examples contains userspace applications for device and for host.
It needs libaio library on the device, and libusb library on host.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
9 years agousb: gadget: f_fs: add aio support
Robert Baldyga [Mon, 10 Feb 2014 09:42:44 +0000 (10:42 +0100)]
usb: gadget: f_fs: add aio support

This patch adds asynchronous I/O support for FunctionFS endpoint files.
It adds ffs_epfile_aio_write() and ffs_epfile_aio_read() functions responsible
for preparing AIO operations.

It also modifies ffs_epfile_io() function, adding aio handling code. Instead
of extending list of parameters of this function, there is new struct
ffs_io_data which contains all information needed to perform I/O operation.
Pointer to this struct replaces "buf" and "len" parameters of ffs_epfile_io()
function. Allocated buffer is freed immediately only after sync operation,
because in async IO it's freed in complete funcion. For each async operation
an USB request is allocated, because it allows to have more than one request
queued on single endpoint.

According to changes in ffs_epfile_io() function, functions ffs_epfile_write()
and ffs_epfile_read() are updated to use new API.

For asynchronous I/O operations there is new request complete function named
ffs_epfile_async_io_complete(), which completes AIO operation, and frees
used memory.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
9 years agousb: gadget: f_fs: add poll for endpoint 0
Robert Baldyga [Mon, 10 Feb 2014 09:42:43 +0000 (10:42 +0100)]
usb: gadget: f_fs: add poll for endpoint 0

This patch adds poll function for file representing ep0.

Ability of read from or write to ep0 file is related with actual state of ffs:
- When desctiptors or strings are not written yet, POLLOUT flag is set.
- If there is any event to read, POLLIN flag is set.
- If setup request was read, POLLIN and POLLOUT flag is set, to allow
  send response (by performing I/O operation consistent with setup request
  direction) or set stall (by performing I/O operation opposite  setup
  request direction).

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
9 years agousb: gadget: f_fs: fix setup request handling
Robert Baldyga [Mon, 10 Feb 2014 09:42:42 +0000 (10:42 +0100)]
usb: gadget: f_fs: fix setup request handling

This patch fixes __ffs_ep0_queue_wait() function, which now returns number of
bytes transferred in USB request or error code in case of failure. This is
needed by ffs_ep0_read() function, when read data is copied to userspace.

It also cleans up code by removing usused variable ep0req_status.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
9 years agousb: gadget: functionfs: replace FFS_SETUP_STATUS with an inline function
Michal Nazarewicz [Mon, 10 Feb 2014 09:42:41 +0000 (10:42 +0100)]
usb: gadget: functionfs: replace FFS_SETUP_STATUS with an inline function

The FFS_SETUP_STATUS macro could be trivialy replaced with an static
inline function but more importantly its name was tad confusing.
The name suggested it was a simple accessor macro but it actually
did change the state of the ffs_data structure perfomring
a FFS_SETUP_CANCELLED -> FFS_NO_SETUP transition.  The name of the
function -- ffs_setup_state_clear_cancelled -- should better
describe what the function actually does.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
9 years agousb: gadget: functionfs: fix typo in the enum variable
Michal Nazarewicz [Mon, 10 Feb 2014 09:42:40 +0000 (10:42 +0100)]
usb: gadget: functionfs: fix typo in the enum variable

Since “cancelled” is spelled with two “l”s, rename FFS_SETUP_CANCELED
to FFS_SETUP_CANCELLED.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
9 years agocpufreq: boost: trats2: Define boost_freq attribute for cpufreq node.
Lukasz Majewski [Mon, 10 Feb 2014 14:44:31 +0000 (15:44 +0100)]
cpufreq: boost: trats2: Define boost_freq attribute for cpufreq node.

The Trats2 board (Exynos 4412 rev.1) is now able to work with 1.5 GHz
BOOST frequency.

Change-Id: Ic7da854dda7b99c9381708c54ff2528bd45a0cd9
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
9 years agocpufreq: boost: Provide support for BOOST on linux-3.10-tizen
Lukasz Majewski [Mon, 10 Feb 2014 14:42:51 +0000 (15:42 +0100)]
cpufreq: boost: Provide support for BOOST on linux-3.10-tizen

This code reads from device tree the boost_freq attribute and properly
modify the cpufreq table to support BOOST framework.

This attribute is only read when CONFIG_CPU_FREQ_BOOST_SW flag is set.

Change-Id: I16fcba69b16c29434e3ec1a8a0ef1bc8bdebc0ca
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
9 years agovideo: display: s6e8aa0: fix a erratum in gamma table
Hyungwon Hwang [Thu, 6 Feb 2014 01:22:26 +0000 (10:22 +0900)]
video: display: s6e8aa0: fix a erratum in gamma table

Fix a erratum in gamma table.

Change-Id: I88f9220de98fe34c5e47ae076f850de603dab8fe
Signed-off-by: Hyungwon Hwang <human.hwang@samsung.com>
9 years agoiio: ak8975: Add device name
Beomho Seo [Mon, 10 Feb 2014 01:01:57 +0000 (10:01 +0900)]
iio: ak8975: Add device name

This patch add device name.

Change-Id: Icda321686ee9c9809463592bddfbaa87563aeae4
Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
9 years agoiio: ak8975: Fix calculation formula for convert micro tesla to gauss unit
Beomho Seo [Mon, 10 Feb 2014 00:52:28 +0000 (09:52 +0900)]
iio: ak8975: Fix calculation formula for convert micro tesla to gauss unit

Oen micro tesla equal 0.01 gauss. So I have fixed calculation formula And add RAW_TO_GAUSS macro.
ASA is in the range of 0 to 255. If multiply 0.003, calculation result(in_magn_[*]_scale) is
always 0. So multiply 3000 and return IIO_VAL_INT_PLUS_MICRO.
As a result read_raw call back function return accurate scale value.

Change-Id: Ia00b801d4867955eef661b64add82ca634f0256c
Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
9 years agopm: exynos: Skip re-enabling L2 cache for early waking-up.
Jonghwa Lee [Mon, 3 Feb 2014 08:37:04 +0000 (17:37 +0900)]
pm: exynos: Skip re-enabling L2 cache for early waking-up.

If L2 cache is powered on, accessing L2 cache's control register is
forbidden. Ohterwise system will hang up.
So, when system fails to go to sleep, we have to avoid reset L2 cache
because it still be powered on.

Change-Id: Ie0271619116012627477e332b0cd5e60a27882ff
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
9 years agoclk: exynos4: Keep 'chipid' clock enabled
Jonghwa Lee [Mon, 3 Feb 2014 08:31:33 +0000 (17:31 +0900)]
clk: exynos4: Keep 'chipid' clock enabled

During STR, we needed to access CHIP_ID, thus its clock should be online.
It's better to keep it enabled even in runtime for later suspend.

Change-Id: I057471e0aac3a9343b0ca8a73d4c8abf0ae36812
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
9 years agoRevert "WORKAROUND: Temporary workaround for Suspend-To-Ram."
Jonghwa Lee [Mon, 3 Feb 2014 08:29:25 +0000 (17:29 +0900)]
Revert "WORKAROUND: Temporary workaround for Suspend-To-Ram."

This reverts commit 682061cb597d5174de6fee211a2ad565c33680f7.

Change-Id: I4ac3f3b86ecd6a8b15ea2d266ab84b16aeb69dda
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
9 years agospec: add missing build dependences and output packages cleanup.
Jacek Pielaszkiewicz [Mon, 27 Jan 2014 14:19:59 +0000 (15:19 +0100)]
spec: add missing build dependences and output packages cleanup.

The following changes have been implemeneted:
1. Add BuildRequires on module-init-tools
2. Cleanup  Documentation directory from *.txt files
3. Update file permisions for executable files (*.sh, *pl)

Change-Id: I06a9348f6220ce2383b6f788635acbd0fe5ef78e
Signed-off-by: Jacek Pielaszkiewicz <j.pielaszkie@samsung.com>
9 years agousb: gadget: eliminate memory leak in slp gadget
Andrzej Pietrasiewicz [Thu, 23 Jan 2014 10:18:36 +0000 (11:18 +0100)]
usb: gadget: eliminate memory leak in slp gadget

Free the allocated acm_function_config struct in case of error.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Change-Id: Ie935cf67beccc2071d1ecd74437cffbe6a6827b8

9 years agousb: gadget: adapt slp to new interface of rndis
Andrzej Pietrasiewicz [Thu, 23 Jan 2014 10:08:57 +0000 (11:08 +0100)]
usb: gadget: adapt slp to new interface of rndis

f_rndis has a new interface. Use it.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Change-Id: I4cd8baf2180cc69fb372c6cce018ecf3a5729a38

9 years agousb: gadget: temporarily turn off rndis from slp gadget
Andrzej Pietrasiewicz [Wed, 22 Jan 2014 13:58:04 +0000 (14:58 +0100)]
usb: gadget: temporarily turn off rndis from slp gadget

This fixes build break caused by recently merged removal
of compatibility layer in rndis.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Change-Id: I11c2d02e2d491f30f8c9936916f627389787a1e5

9 years agotizen: packaging: support perf build
Chanho Park [Tue, 21 Jan 2014 01:11:34 +0000 (10:11 +0900)]
tizen: packaging: support perf build

Change-Id: Idc375608e3bde344347de6ad37c434b5f16aefbc
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
9 years agoAdd dependency on kernel package in kernel-devel package.
Jacek Pielaszkiewicz [Mon, 20 Jan 2014 09:20:35 +0000 (10:20 +0100)]
Add dependency on kernel package in kernel-devel package.

Change-Id: Iba7d12ecac46b3e5985f412f4cc3f623162cf728
Signed-off-by: Jacek Pielaszkiewicz <j.pielaszkie@samsung.com>
9 years agousb: gadget: fix NULL pointer dereference
Andrzej Pietrasiewicz [Mon, 20 Jan 2014 07:32:43 +0000 (08:32 +0100)]
usb: gadget: fix NULL pointer dereference

Fix possible NULL pointer dereference introduced in

219580e64f035bb9018dbb08d340f90b0ac50f8c
usb: f_fs: check quirk to pad epout buf size when not aligned to
maxpacketsize

In cases we do wait with:

wait_event_interruptible(epfile->wait, (ep = epfile->ep));

for endpoint to be enabled, functionfs_bind() has not been called yet
and epfile->ffs->gadget is still NULL and the automatic variable 'gadget'
has been initialized with NULL at the point of its definition.
Later on it is used as a parameter to:

usb_ep_align_maybe(gadget, ep->ep, len)

which in turn dereferences it.

This patch fixes it by moving the actual assignment to the local 'gadget'
variable after the potential waiting has completed.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
9 years agousb: gadget: FunctionFS: use consistent naming with regard to ffs_lock
Andrzej Pietrasiewicz [Mon, 13 Jan 2014 12:48:05 +0000 (13:48 +0100)]
usb: gadget: FunctionFS: use consistent naming with regard to ffs_lock

Consistently prefix function name with underscore if the function has to
be called with ffs_lock taken.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
9 years agousb: gadget: FunctionFS: staticize functions used only in f_fs.c
Andrzej Pietrasiewicz [Mon, 13 Jan 2014 12:20:25 +0000 (13:20 +0100)]
usb: gadget: FunctionFS: staticize functions used only in f_fs.c

ffs_alloc_dev and ffs_free_dev are used only in f_fs.c,
so make them static.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
9 years agousb: gadget: code cleanup
Andrzej Pietrasiewicz [Mon, 13 Jan 2014 15:42:02 +0000 (16:42 +0100)]
usb: gadget: code cleanup

Remove trailing whitespace

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
9 years agousb: gadget: FunctionFS: dereference ffs_dev conditionally
Andrzej Pietrasiewicz [Mon, 13 Jan 2014 15:41:22 +0000 (16:41 +0100)]
usb: gadget: FunctionFS: dereference ffs_dev conditionally

ffs_dev->ffs_release_dev_callback should be accessed only if ffs_dev
is not NULL.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
9 years agousb: gadget: fix up some comments about CONFIG_USB_DEBUG
Greg Kroah-Hartman [Thu, 19 Dec 2013 23:43:10 +0000 (15:43 -0800)]
usb: gadget: fix up some comments about CONFIG_USB_DEBUG

These two gadget drivers said that their #endif was for
CONFIG_USB_DEBUG, but they really were not, so fix them up to be
correct.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: should use u16 type variable to store MaxPower
Du, ChangbinX [Tue, 17 Dec 2013 11:47:42 +0000 (11:47 +0000)]
usb: gadget: should use u16 type variable to store MaxPower

From 7e827a0d300e084f74c65122baa5e3193f9a7f18 Mon Sep 17 00:00:00 2001
From: "Du, Changbin" <changbinx.du@intel.com>
Date: Mon, 16 Dec 2013 20:32:13 +0800
Subject: [PATCH] usb/gadget: should use u16 type variable to store MaxPower

The MaxPower field is of u16 type. So using u8 type variable can break
data (high byte lost).

Signed-off-by: Du, Changbin <changbinx.du@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: configfs: include appropriate header file in configfs.c
Rashika Kheria [Thu, 19 Dec 2013 10:07:37 +0000 (15:37 +0530)]
usb: gadget: configfs: include appropriate header file in configfs.c

Include appropriate header file drivers/usb/gadget/configfs.h in
gadget/configfs.c because function unregister_gadget_item() has its
prototype declaration in gadget/configfs.h.

This eliminates the following warning in gadget/configfs.c:
drivers/usb/gadget/configfs.c:994:6: warning: no previous prototype for ‘unregister_gadget_item’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: f_mass_storage: call try_to_freeze only when its safe
George Cherian [Fri, 8 Nov 2013 05:20:52 +0000 (10:50 +0530)]
usb: gadget: f_mass_storage: call try_to_freeze only when its safe

Call try_to_freeze() in sleep_thread() only when it's safe to sleep.
do_read() and do_write() calls sleep_thread with lock held.
Make sure these won't call try_to_freeze() by passing can_freeze flag
to sleep_thread.

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

Signed-off-by: George Cherian <george.cherian@ti.com>
Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: zero: module parameters can be static
Fengguang Wu [Mon, 25 Nov 2013 17:10:59 +0000 (11:10 -0600)]
usb: gadget: zero: module parameters can be static

g_zero's module parameters can, and should, be
static. This fixes sparse warnings.

Cc: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: mass storage: fix return of delayed status
Pratyush Anand [Mon, 4 Nov 2013 16:43:54 +0000 (22:13 +0530)]
usb: gadget: mass storage: fix return of delayed status

Mass storage gadget returns DELAYED_STATUS in stead of
USB_GADGET_DELAYED_STATUS while handling bulk reset request. Since
peripheral driver uses USB_GADGET_DELAYED_STATUS for delayed status
handling, therefore replace DELAYED_STATUS by USB_GADGET_DELAYED_STATUS
in mass storage driver.

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

Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
Cc: Paul Zimmerman <Paul.Zimmerman@synopsys.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: f_mass_storage: fix mass storage dependency
Andrzej Pietrasiewicz [Mon, 4 Nov 2013 12:46:17 +0000 (13:46 +0100)]
usb: gadget: f_mass_storage: fix mass storage dependency

Legacy gadgets supporting mass storage (g_mass_storage, g_acm_ms, g_multi)
all depend on BLOCK.

Make the standalone compilation of f_mass_storage (without any legacy
gadget) dependent no BLOCK, too.

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_sourcesink: Fix sparse warning
Jingoo Han [Mon, 16 Dec 2013 09:44:43 +0000 (18:44 +0900)]
usb: gadget: f_sourcesink: Fix sparse warning

Make local symbols static in order to fix the following sparse
warnings.

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

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: f_serial: Fix sparse warning
Jingoo Han [Mon, 16 Dec 2013 09:44:25 +0000 (18:44 +0900)]
usb: gadget: f_serial: Fix sparse warning

Make local symbol static in order to fix the following sparse
warning.

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

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: f_phonet: Fix sparse warning
Jingoo Han [Mon, 16 Dec 2013 09:44:07 +0000 (18:44 +0900)]
usb: gadget: f_phonet: Fix sparse warning

Make local symbol static in order to fix the following sparse
warning.

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

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: f_obex: Fix sparse warning
Jingoo Han [Mon, 16 Dec 2013 09:43:50 +0000 (18:43 +0900)]
usb: gadget: f_obex: Fix sparse warning

Make local symbol static in order to fix the following sparse
warning.

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

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: f_ncm: Fix sparse warning
Jingoo Han [Mon, 16 Dec 2013 09:43:32 +0000 (18:43 +0900)]
usb: gadget: f_ncm: Fix sparse warning

Make local symbol static in order to fix the following sparse
warning.

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

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: f_mass_storage: Fix sparse warning
Jingoo Han [Mon, 16 Dec 2013 09:42:48 +0000 (18:42 +0900)]
usb: gadget: f_mass_storage: Fix sparse warning

Use NULL instead of 0 when returning pointer, to fix the following
sparse warnings.

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

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: f_loopback: Fix sparse warning
Jingoo Han [Mon, 16 Dec 2013 09:40:49 +0000 (18:40 +0900)]
usb: gadget: f_loopback: Fix sparse warning

Make local symbols static in order to fix the following sparse
warnings.

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

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: nokia: fix error recovery path for optional functions
Andrzej Pietrasiewicz [Fri, 13 Dec 2013 13:46:40 +0000 (14:46 +0100)]
usb: gadget: nokia: fix error recovery path for optional functions

In the nokia gadget some USB functions (obex 1 and 2, phonet) are optional.

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

phonet_stat = usb_add_function(c, f_phonet);

is never called and phonet_stat remains 0.

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

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

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: f_fs: fix sparse warning
Felipe Balbi [Thu, 12 Dec 2013 18:15:43 +0000 (12:15 -0600)]
usb: gadget: f_fs: fix sparse warning

use NULL when returning NULL pointers, not 0.

Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: FunctionFS: add configfs support
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:36 +0000 (15:15 +0100)]
usb: gadget: FunctionFS: add configfs support

Add support for using FunctionFS in configfs-based USB gadgets.

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

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: FunctionFS: Remove compatibility layer
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:35 +0000 (15:15 +0100)]
usb: gadget: FunctionFS: Remove compatibility layer

There are no old function interface users left, so the old interface can
be removed.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: g_ffs: convert to new interface of f_fs
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:34 +0000 (15:15 +0100)]
usb: gadget: g_ffs: convert to new interface of f_fs

Prepare for configfs integration. Use the new interface so that f_fs can be
made a module.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: FunctionFS: convert to new function interface with backward compatibility
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:33 +0000 (15:15 +0100)]
usb: gadget: FunctionFS: convert to new function interface with backward compatibility

This is required in order to integrate configfs support.
f_fs needs to be a separately compiled module and so it needs to use the new
interface.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: FunctionFS: add devices management code
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:32 +0000 (15:15 +0100)]
usb: gadget: FunctionFS: add devices management code

This will be required in order to use the new function interface
(usb_get_function_instance/usb_put_function_instance)

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyunmgin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: FunctionFS: create utility file
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:31 +0000 (15:15 +0100)]
usb: gadget: FunctionFS: create utility file

A header file to be used by f_fs.c and g_ffs.c will be required when
f_fs.c is converted into a module.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: FunctionFS: Remove VLAIS usage from gadget code
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:30 +0000 (15:15 +0100)]
usb: gadget: FunctionFS: Remove VLAIS usage from gadget code

The use of variable length arrays in structs (VLAIS) in the Linux Kernel code
precludes the use of compilers which don't implement VLAIS (for instance the
Clang compiler). This alternate patch calculates offsets into the kmalloc-ed
memory buffer using macros. The previous patch required multiple kmalloc and
kfree calls. This version uses "group" vs "struct" since it really is not a
struct and is essentially a group of VLA in a common allocated block. This
version also fixes the issues pointed out by Andrzej Pietrasiewicz and
Michal Nazarewicz.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Signed-off-by: Behan Webster <behanw@converseincode.com>
[elimination of miexed declaration and code, checkpatch cleanup]
[fixes after Michal's review]
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: rndis: merge u_rndis.ko with usb_f_rndis.ko
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:29 +0000 (15:15 +0100)]
usb: gadget: rndis: merge u_rndis.ko with usb_f_rndis.ko

The rndis function's users use only the new interface, so the two modules
can be merged.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: f_rndis: remove compatibility layer
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:28 +0000 (15:15 +0100)]
usb: gadget: f_rndis: remove compatibility layer

There are no old function interface users left, so the old interface
can be removed.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: g_ffs: convert to new interface of f_rndis
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:27 +0000 (15:15 +0100)]
usb: gadget: g_ffs: convert to new interface of f_rndis

There is a new interface of f_rndis and g_ffs is the last to use the old one.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: f_subset: remove compatibility layer
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:26 +0000 (15:15 +0100)]
usb: gadget: f_subset: remove compatibility layer

There are no old function interface users left, so the old interface
can be removed.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: g_ffs: convert to new interface of f_subset
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:25 +0000 (15:15 +0100)]
usb: gadget: g_ffs: convert to new interface of f_subset

There is a new function interface of f_subset and g_ffs is the last to use
the old one.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: f_ecm: remove compatibility layer
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:24 +0000 (15:15 +0100)]
usb: gadget: f_ecm: remove compatibility layer

There are no old function interface users left, so the old interface
can be removed.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmim Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: g_ffs: convert to new interface of f_ecm
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:23 +0000 (15:15 +0100)]
usb: gadget: g_ffs: convert to new interface of f_ecm

There is a new funtion interface and g_ffs is the last gadget to use the old.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: g_ffs: remove a reduntant gfs_ether_setup variable
Andrzej Pietrasiewicz [Tue, 3 Dec 2013 14:15:22 +0000 (15:15 +0100)]
usb: gadget: g_ffs: remove a reduntant gfs_ether_setup variable

Since d6a0143985489e470a118605352f4b18df0ce142
usb: gadget: move the global the_dev variable to their users
"the_dev" variable can be used as a "setup done" flag; non-NULL
meaning "setup done", NULL meaning "setup not done". Moreover,
gether_cleanup() can be safely called with a NULL argument.

Corrected a comment to be consistent with the code.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>