ion: make debug msg easier to read

Nearly every function has now a printk().
I am guessing i can narrow down the problem with ion a
little bit. There must be some problem with omap3_carveout.
I am assuming (according to logs) that the ion device gets
init before the hole memory gets allocated. At this stage
everything is fine, but then it waits to long to allocate
the memory for the device and thus won't work in the end.

At least something like this...

I am also assuming that the mapping to userspace is somehow wrong,
don't know if i am using the wrong libs, though. We should
port this code to the 3.0-Branch at compare the both outputs.

This commit also includes some random patches and also some
compiler fixup.

Signed-off-by: Blechd0se <alex.christ@hotmail.de>
ion: throw a error if allocation fails

If allocation fails inside of ion fails, we can throw
this nice and shiny error message.

Furthermore simplyfied the code and get rid of goto end.

Signed-off-by: Blechd0se <alex.christ@hotmail.de>
ion: bring in strlcpy for client->name

We wont use strncpy, according to the 3.4-branch
there has to be some sort of allocation for
client->name.

Signed-off-by: Blechd0se <alex.christ@hotmail.de>
ion: fix memory leak and race condition

Previous commit introduced a memory leak.
kfree(client->name) takes care of that.

Otherwise fix a race condition if there are two
threads in one client and both try to link to the
same handle.

Signed-off-by: Blechd0se <alex.christ@hotmail.de>
cpufreq: interactive: changing behavior of hispeed_freq

The current frequency will be (nearly) always lower than
hispeed_freq. So changing that to our 800 freq and pushing
cpu to max freq the first time. This should decrease frequency
jumps in theory.

Also updating suspend code a bit and change boost_duration
to 2secs. This needs confirmation, since in those 2 seconds
there shouldn't be any calculation to keep UI interactions
even smoother.

Signed-off-by: Blechd0se <alex.christ@hotmail.de>
cpufreq: interactive: small timer adjustments

Signed-off-by: Blechd0se <alex.christ@hotmail.de>
staging: sync: Add synchronization framework

Sync is a framework for synchronization between multiple
drivers. Sync implementations can take advantage of hardware
synchronization built into devices like GPUs.

Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rob Clark <robclark@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Erik Gilling <konkers@android.com>
[jstultz: Added commit message, moved to staging, squished minor fix in]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Blechd0se <alex.christ@hotmail.de>

Conflicts:
	drivers/staging/android/Makefile
defconfig: make this thing clean!

Also enable the new synchronization framework driver
from previous commit.

Signed-off-by: Blechd0se <alex.christ@hotmail.de>
staging: android: update sync to upstream

Signed-off-by: Blechd0se <alex.christ@hotmail.de>
ion: Switch ion to use dma-buf

Ion now uses dma-buf file descriptors to share
buffers with userspace.  Ion becomes a dma-buf
exporter and any driver that can import dma-bufs
can now import ion file descriptors.

Change-Id: Ia04d6d72fb301dc088eb8db6576822e9260ff332
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Signed-off-by: Blechd0se <alex.christ@hotmail.de>

Conflicts:
	drivers/gpu/ion/ion.c
	include/linux/ion.h
defconfig: disable sync driver

Signed-off-by: Blechd0se <alex.christ@hotmail.de>
cgroups: timer_slack: backport to 2.6.32

http://lwn.net/Articles/431847/

This implements the timer slack controller with all needed
patches. To make this actually work with Android
the following is needed in the ramdisk;

	mount cgroup none /dev/cpuctl cpu,timer_slack

I also recommend to set timer_slack.min_slack_ns at boot;

	write /dev/cpuctl/apps/bg_non_interactive/timer_slack.min_slack_ns 100000000

Normally you would mount the controller to change the timer slack,
unfortunately this ist broken at the moment at least for me.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Signed-off-by: Blechd0se <alex.christ@hotmail.de>

Conflicts:
	include/linux/cgroup_subsys.h
	include/linux/prctl.h
shrinker: fix those stupid warnings

We won't use the new shrinker api any time soon, so
go one step back and get rid of those warnings.

Also enable the new timer slack controller for CM10 too.

Signed-off-by: Blechd0se <alex.christ@hotmail.de>
staging: sync: fix sync driver

clean up trace dependencies. Also enable it in defconfig.

Signed-off-by: Blechd0se <alex.christ@hotmail.de>
fs: Add FITRIM ioctl

Adds an filesystem independent ioctl to allow implementation of file
system batched discard support. I takes fstrim_range structure as an
argument. fstrim_range is definec in the include/fs.h and its
definition is as follows.

struct fstrim_range {
	start;
	len;
	minlen;
}

start	- first Byte to trim
len	- number of Bytes to trim from start
minlen	- minimum extent length to trim, free extents shorter than this
	  number of Bytes will be ignored. This will be rounded up to fs
	  block size.

It is also possible to specify NULL as an argument. In this case the
arguments will set itself as follows:

start = 0;
len = ULLONG_MAX;
minlen = 0;

So it will trim the whole file system at one run.

After the FITRIM is done, the number of actually discarded Bytes is stored
in fstrim_range.len to give the user better insight on how much storage
space has been really released for wear-leveling.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
ext3: Add batched discard support for ext3

Walk through allocation groups and trim all free extents. It can be
invoked through FITRIM ioctl on the file system. The main idea is to
provide a way to trim the whole file system if needed, since some SSD's
may suffer from performance loss after the whole device was filled (it
does not mean that fs is full!).

It search for free extents in allocation groups specified by Byte range
start -> start+len. When the free extent is within this range, blocks are
marked as used and then trimmed. Afterwards these blocks are marked as
free in per-group bitmap.

[JK: Fixed up error handling and trimming of a single group]

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Jan Kara <jack@suse.cz>
ext4: Add batched discard support for ext4

Walk through allocation groups and trim all free extents. It can be
invoked through FITRIM ioctl on the file system. The main idea is to
provide a way to trim the whole file system if needed, since some SSD's
may suffer from performance loss after the whole device was filled (it
does not mean that fs is full!).

It search for free extents in allocation groups specified by Byte range
start -> start+len. When the free extent is within this range, blocks
are marked as used and then trimmed. Afterwards these blocks are marked
as free in per-group bitmap.

Since fstrim is a long operation it is good to have an ability to
interrupt it by a signal. This was added by Dmitry Monakhov.
Thanks Dimitry.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
ext4: check for negative error code from sb_issue_discard

sb_issue_discard() is returning negative error code, so check for
-EOPNOTSUPP.

Trim works! :)
/cache: 143806464 bytes was trimmed
/data: 1035509760 bytes was trimmed

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Blechd0se <alex.christ@hotmail.de>

Conflicts:
	fs/ext4/mballoc.c
omap: various cleanups in platform code

Work in progress.

Signed-off-by: Blechd0se <alex.christ@hotmail.de>
defconfig: enabling swap again (and zram)

Many users confirmed what i thought; swap and or
zram is/are not the root of this data corruption
bug.
Therefore enable it back again, also clean up
4.1's defconfig

Signed-off-by: Blechd0se <alex.christ@hotmail.de>