[go: nahoru, domu]

  • Home
  • History
  • Annotate
  • only in /drivers/staging/android/
History log of /drivers/staging/android/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
fbc83982bfd53d66bde7e3360edb4f8c5900de70 26-May-2015 Martijn Coenen <maco@google.com> lowmemorykiller: trace kill events.

Allows for capturing lmk kill events and
their rationale.

Change-Id: Ibe215db5bb9806fc550c72c0b9832c85cbd56bf6
Signed-off-by: Martijn Coenen <maco@google.com>
owmemorykiller.c
race/lowmemorykiller.h
ecd32842283c64b14243be9b20b60f351aea1b5d 08-Jul-2015 Vinil Cheeramvelil <vinil.cheeramvelil@intel.com> ion: Handle the memory mapping correctly on x86

This patch modifies the ion page pool code to address
limitation in x86 PAT. When one physical page is mapped
to multiple virtual pages, the same cache policy
should be used. Add set_memory_wc/uc call to avoid aliases.
If not, all mappings will be cached(write back).

Change-Id: I98ee8902df0c80135dddfa998c4ca4c2bb44e40e
Signed-off-by: Zhebin Jin <zhebin.jin@intel.com>
Signed-off-by: Vinil Cheeramvelil <vinil.cheeramvelil@intel.com>
on/Kconfig
on/ion_page_pool.c
on/ion_priv.h
on/ion_system_heap.c
7e5e463e9e621f6c96cc324a4a18ed88273b6853 26-Aug-2015 Rajmal Menariya <rajmal.menariya@spreadtrum.com> ion : In carveout heap, change minimum allocation order from 12 to PAGE_SHIFT, After this change each bit in bitmap (genalloc - General purpose special memory pool)

represents one page size memory.

Cc:sprd-ind-kernel-group@googlegroups.com
Cc:sanjeev.yadav@spreadtrum.com
Cc:Colin Cross <ccross@android.com>
cc:John Stultz <john.stultz@linaro.org>

Change-Id: I1172285dac014ecd2f1a965604b697d6739c1726
Signed-off-by: Rajmal Menariya <rajmal.menariya@spreadtrum.com>
on/ion_carveout_heap.c
7394e76edff5b834b6e189f1e05b687b70ec6061 09-Feb-2015 Tobias Lindskog <tobias.lindskog@sonymobile.com> Shrink ashmem directly through shmem_fallocate

When ashmem_shrink is called from direct reclaim on a user thread, a
call to do_fallocate will check for permissions against the security
policy of that user thread. It can thus fail by chance if called on a
thread that isn't permitted to modify the relevant ashmem areas.

Because we know that we have a shmem file underneath, call the shmem
implementation of fallocate directly instead of going through the
user-space interface for fallocate.

FIX=DMS06243560
Area: Kernel/Linux Kernel

Bug: 21951515
Change-Id: Ie98fff18a2bdeb535cd24d4fbdd13677e12681a7
Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
shmem.c
ff1aa986bb46595d01bb2148e49d942810a63090 22-Oct-2014 Rhyland Klein <rklein@nvidia.com> UPSTREAM: staging: android: Assign bool to true

high is a bool type variable.

bool variable should be assigned true, false not 1 or 0.

This patch assigns high to true, replacing 1.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 17fbab1ee9a3e5d2a070450a0c76a3434278bc96)

Change-Id: Ifd5e2160a767d59e70956eca520be323b663aebb
Signed-off-by: Rhyland Klein <rklein@nvidia.com>
on/ion_page_pool.c
9089e98641f55e06fd28e7956214a41ba12bf6fb 01-Nov-2014 Rhyland Klein <rklein@nvidia.com> UPSTREAM: Staging: android: ion: fix typos in comments

s/comming/coming/ in drivers/staging/android/ion/ion.c
s/specfic/specific/ in drivers/staging/android/ion/ion.h
s/peformance/performance/ in drivers/staging/android/ion/ion_priv.h

Signed-off-by: Tristan Lelong <tristan@lelong.xyz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit bc47e7d97666ad32993abe0ea924ffa81a8356e7)

Change-Id: If2cb57073cec9311b93a0138a39a222ec9ccec30
Signed-off-by: Rhyland Klein <rklein@nvidia.com>
on/ion.c
on/ion.h
on/ion_priv.h
9a7e2ac9a7cf827b865b9e616a9549f6972d1140 06-Oct-2014 Rhyland Klein <rklein@nvidia.com> UPSTREAM: staging: android: ion: Replace "the the " with "the"

This patch replace "the the " with "the".
The replacement couldn't be automated because sometimes
the first "the" was meant to be another word.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 8e4ec4fe040861b69fcb2c60394355f0c600e38f)

Change-Id: I159bb93a1c372535a71d865a5fe17a159fae40bd
Signed-off-by: Rhyland Klein <rklein@nvidia.com>
on/ion.c
2102d8dc92de279919386bb7f97a7bdbd4afaca8 24-Mar-2015 Alistair Strachan <alistair.strachan@imgtec.com> sync: Fix memory corruption in sync_timeline_signal().

The android_fence_release() function checks for active sync points
by calling list_empty() on the list head embedded on the sync
point. However, it is only valid to use list_empty() on nodes that
have been initialized with INIT_LIST_HEAD() or list_del_init().

Because the list entry has likely been removed from the active list
by sync_timeline_signal(), there is a good chance that this
WARN_ON_ONCE() will be hit due to dangling pointers pointing at
freed memory (even though the sync drivers did nothing wrong)
and memory corruption will ensue as the list entry is removed for
a second time, corrupting the active list.

This problem can be reproduced quite easily with CONFIG_DEBUG_LIST=y
and fences with more than one sync point.

Change-Id: Ie2a6bc1480bbcfdc14f9b385fca5a2b833effc05

Signed-off-by: Alistair Strachan <alistair.strachan@imgtec.com>
Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
ecb9f50c80f1c675cfe5fe02020a72d75c3fbbef 27-Jan-2015 John Stultz <john.stultz@linaro.org> staging: Remove logger and alarm-dev from android Makefile

My previous patches deleting logger and alarm-dev from staging
missed the android Makefile.

This patch cleans up the Makefile to remove the now non-existent
files.

Cc: Rom Lemarchand <romlem@google.com>,
Cc: Mark Salyzyn <salyzyn@google.com>,
Cc: Kees Cook <keescook@chromium.org>,
Cc: Android Kernel Team <kernel-team@android.com>,
Cc: Valentin Rothberg <valentinrothberg@gmail.com>,
Cc: Greg Hackmann <ghackmann@google.com>,
Cc: Elliott Hughes <enh@google.com>,
Cc: Todd Poynor <toddpoynor@google.com>,
Reported-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 13505761
Change-Id: Id8c027ce51a663ee2e9ea2618612921db7cf7638
akefile
a884fbbd9b1a5dd762d32375e3cbb609603c7c1e 20-Jan-2015 John Stultz <john.stultz@linaro.org> staging: Remove the Android alarm-dev driver

The functionality provided by the Android alarm-dev driver
should now be present in the timerfd interface (thanks to
Greg Hackmann and Todd Poynor).

As of Lollipop, AOSP can make use of the timerfd if
alarm-dev is not present (though a fixup for setting the
rtc time if rtc0 isn't the backing for _ALARM clockids has
been applied post-Lollipop).

Thus, we should be able to remove alarm-dev from staging.

Cc: Greg Hackmann <ghackmann@google.com>
Cc: Elliott Hughes <enh@google.com>
Cc: Todd Poynor <toddpoynor@google.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Acked-by: Mark Salyzyn <salyzyn@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Change-Id: Ia905d4b809cc1614ddde01ccb791fc56ac292faa
config
larm-dev.c
ndroid_alarm.h
api/android_alarm.h
89a57067c00fe2085e10ca97ace7cefa64acb59c 26-Jan-2015 John Stultz <john.stultz@linaro.org> staging: Remove the Android logger driver

With the relase of Lollipop, Android no longer
requires the logger driver.

There are three patches which the android dev's
still need before they drop logger on all their
devices:

[PATCH v4 1/5] pstores: use scnprintf
[PATCH v2 2/5] pstore: remove superfluous memory size check
[PATCH 3/5] pstore: handle zero-sized prz in series
[PATCH v4 4/5] pstore: add pmsg
[PATCH 5/5] pstore: selinux: add security in-core xattr support for pstore and debugfs

But these seem to have been acked and are hopefully
queued for upstream.

So this patch removes the logger driver from staging.

Cc: Rom Lemarchand <romlem@google.com>,
Cc: Mark Salyzyn <salyzyn@google.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 13505761
Change-Id: I21b6897f01871851e05b6eb53c7c08a1cb597e40
config
ogger.c
ogger.h
5542e34364514abdb27c6035380a52368776182a 25-Jan-2015 Rom Lemarchand <romlem@android.com> staging: android: ashmem: add missing include

Include <linux/types.h> into ashmem.h to ensure referenced types are defined

Signed-off-by: Rom Lemarchand <romlem@android.com>
Change-Id: Iac18ed86dd47296d02a269607b1514724aaa9958
(cherry picked from commit 0d7c7ba9f6428e694130a40e270516618f27ce14)
api/ashmem.h
63351df85f7ece011618955054c1b0d15b393691 26-Jan-2015 Ruchi Kandoi <kandoiruchi@google.com> Fix compile errors in accordance with changes from 3.14 to 3.18

Signed-off-by: Ruchi Kandoi<kandoiruchi@google.com>
iq_debugger/fiq_debugger.c
owmemorykiller.c
92ee040d9161e36196e676213222abc3b4d404e8 27-Sep-2014 Riley Andrews <riandrews@google.com> staging: binder: Change binder mutex to rtmutex.

Surfaceflinger uses binder heavily to receive/send frames from applications
while compositing the screen. Change the binder mutex to an rt mutex to minimize
instances where high priority surfaceflinger binder work is blocked by lower
priority binder ipc.

Signed-off-by: Riley Andrews <riandrews@google.com>
Change-Id: I086a715267648448f0c5f62b037a3093d1079a79
inder.c
4bd2cebc0af7771b04db9b9ebe358f8786bcf526 25-Jan-2014 Laura Abbott <lauraa@codeaurora.org> staging: android: ashmem: Avoid deadlock with mmap/shrink

Both ashmem_mmap and ashmem_shrink take the ashmem_lock. It may
be possible for ashmem_mmap to invoke ashmem_shrink:

-000|mutex_lock(lock = 0x0)
-001|ashmem_shrink(?, sc = 0x0) <--- try to take ashmem_mutex again
-002|shrink_slab(shrink = 0xDA5F1CC0, nr_pages_scanned = 0, lru_pages
-002|=
-002|124)
-003|try_to_free_pages(zonelist = 0x0, ?, ?, ?)
-004|__alloc_pages_nodemask(gfp_mask = 21200, order = 1, zonelist =
-004|0xC11D0940,
-005|new_slab(s = 0xE4841E80, ?, node = -1)
-006|__slab_alloc.isra.43.constprop.50(s = 0xE4841E80, gfpflags =
-006|2148925462, ad
-007|kmem_cache_alloc(s = 0xE4841E80, gfpflags = 208)
-008|shmem_alloc_inode(?)
-009|alloc_inode(sb = 0xE480E800)
-010|new_inode_pseudo(?)
-011|new_inode(?)
-012|shmem_get_inode(sb = 0xE480E800, dir = 0x0, ?, dev = 0, flags =
-012|187)
-013|shmem_file_setup(?, ?, flags = 187)
-014|ashmem_mmap(?, vma = 0xC5D64210) <---- Acquire ashmem_mutex
-015|mmap_region(file = 0xDF8E2C00, addr = 1772974080, len = 233472,
-015|flags = 57,
-016|sys_mmap_pgoff(addr = 0, len = 230400, prot = 3, flags = 1, fd =
-016|157, pgoff
-017|ret_fast_syscall(asm)
-->|exception
-018|NUR:0x40097508(asm)
---|end of frame

Avoid this deadlock by using mutex_trylock in ashmem_shrink; if the mutex
is already held, do not attempt to shrink.

Change-Id: I222bbf55856d5849da813b730de0636c80966c8e
Reported-by: Matt Wagantall <mattw@codeaurora.org>
Reported-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
Reported-by: Osvaldo Banuelos <osvaldob@codeaurora.org>
Reported-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
shmem.c
12a3346a22b7fdd5f7ed5fd6d09679d665cbd95f 03-May-2014 Arve Hjønnevåg <arve@android.com> fiq_debugger: Add fiq_watchdog_triggered api

Dumps registers and stacktrace into console-ramoops when called
from a watchdog fiq.

Change-Id: Ib6fab5a52f670db18e64214d5e4890e8292a749c
Signed-off-by: Arve Hjønnevåg <arve@android.com>
iq_debugger/Kconfig
iq_debugger/Makefile
iq_debugger/fiq_watchdog.c
iq_debugger/fiq_watchdog.h
73cdbd63ff1f035c55c572ad245f6a4b578011ec 03-May-2014 Arve Hjønnevåg <arve@android.com> fiq_debugger: Call fiq_debugger_printf through a function pointer from cpu specific code

This allows the output from the register and stack trace code to be
sent elsewhere.

Change-Id: I41bb0d5a25e1b9ca55feef5dbd675818b2f832d5
Signed-off-by: Arve Hjønnevåg <arve@android.com>
iq_debugger/fiq_debugger.c
iq_debugger/fiq_debugger_arm.c
iq_debugger/fiq_debugger_arm64.c
iq_debugger/fiq_debugger_priv.h
e139164eb6468f39be07f58a40b657d2e95e787d 03-Apr-2014 Colin Cross <ccross@android.com> fiq_debugger: add ARM64 support

Add fiq_debugger_arm64.c that implements the platform-specific
functions.

Change-Id: I4d8b96777bb8503a93d4eb47bbde8e018740a5bf
Signed-off-by: Colin Cross <ccross@android.com>
iq_debugger/Kconfig
iq_debugger/Makefile
iq_debugger/fiq_debugger_arm64.c
3764f68d03b78ba0239fd00f6e98e08bbe4ff2d8 03-Apr-2014 Colin Cross <ccross@android.com> fiq_debugger: split arm support into fiq_debugger_arm.c

Split arm support into a separate .c file that is only built for
CONFIG_ARM.

Change-Id: Iba16f4d51608bf9c3e5c8acefefcd38fead9797c
Signed-off-by: Colin Cross <ccross@android.com>
iq_debugger/Makefile
iq_debugger/fiq_debugger.c
iq_debugger/fiq_debugger_arm.c
iq_debugger/fiq_debugger_priv.h
be8534fa15b17b10ae1ed7a402e6f1d17c31baa0 05-Apr-2014 Colin Cross <ccross@android.com> fiq_debugger: use pt_regs for registers

IRQ mode already passes in a struct pt_regs from get_irq_regs().
FIQ mode passes in something similar but not identical to a
struct pt_regs - FIQ mode stores the spsr of the interrupted mode
in slot 17, while pt_regs expects orig_r0.

Replace the existing mixture of void *regs, unsigned *regs, and
struct pt_regs * const with const struct pt_regs *. Modify
dump_regs not to print the spsr since it won't be there in a
struct pt_regs anyways. Modify dump_allregs to highlight the
mode that was interrupted, making spsr easy to find there.

Change-Id: Ibfe1723d702306c7605fd071737d7be9ee9d8c12
Signed-off-by: Colin Cross <ccross@android.com>
iq_debugger/fiq_debugger.c
2b2a677712896a777eca73070f0879384c530ee2 03-Apr-2014 Colin Cross <ccross@android.com> fiq_debugger: allow compiling without CONFIG_FIQ_GLUE

Allow compiling fiq_debugger.c without CONFIG_FIQ_GLUE for
platforms that don't support FIQs.

Change-Id: Iabdfd790d24fa9d47b29d2f850c567af2dcad78f
Signed-off-by: Colin Cross <ccross@android.com>
iq_debugger/fiq_debugger.c
a2f861391a48af926fb3f73ba7a781fe6701bf93 05-Apr-2014 Colin Cross <ccross@android.com> fiq_debugger: rename debug->fiq_debugger

Rename variables and functions in the global namespace to avoid
future collisions.

Change-Id: Ic23a304b0f794efc94cc6d086fddd63231d99c98
Signed-off-by: Colin Cross <ccross@android.com>
iq_debugger/fiq_debugger.c
2a2f434d743209cda09c68acd63cbcae8e6d17c6 03-Apr-2014 Colin Cross <ccross@android.com> fiq_debugger: move into drivers/staging/android/fiq_debugger/

Move fiq_debugger into drivers/staging/android/fiq_debugger/ to
allow for sharing between ARM and ARM64.

Change-Id: I6ca5e8b7e3d000f57da3234260261c5592cef2a8
Signed-off-by: Colin Cross <ccross@android.com>
config
akefile
iq_debugger/Kconfig
iq_debugger/Makefile
iq_debugger/fiq_debugger.c
iq_debugger/fiq_debugger.h
iq_debugger/fiq_debugger_ringbuf.h
9b98710b14fbd720039c756637dcd5cf423b690b 14-Feb-2014 Arve Hjønnevåg <arve@android.com> Staging: android: binder: More offset validation.

Make sure offsets don't point to overlapping flat_binder_object
structs.

Change-Id: I425ab0c46fbe2b00ed679c5becf9e8140395eb40
Signed-off-by: Arve Hjønnevåg <arve@android.com>
inder.c
bad385c687f886ef7371628cb239aca6e408708c 03-May-2013 Colin Cross <ccross@android.com> lowmemorykiller: make default lowmemorykiller debug message useful

lowmemorykiller debug messages are inscrutable and mostly useful
for debugging the lowmemorykiller, not explaining why a process
was killed. Make the messages more useful by prefixing them
with "lowmemorykiller: " and explaining in more readable terms
what was killed, who it was killed for, and why it was killed.

The messages now look like:
[ 76.997631] lowmemorykiller: Killing 'droid.gallery3d' (2172), adj 1000,
[ 76.997635] to free 27436kB on behalf of 'kswapd0' (29) because
[ 76.997638] cache 122624kB is below limit 122880kB for oom_score_adj 1000
[ 76.997641] Free memory is -53356kB above reserved

A negative number for free memory above reserved means some of the
reserved memory has been used and is being regenerated by kswapd,
which is likely what called the shrinkers.

Change-Id: I1fe983381e73e124b90aa5d91cb66e55eaca390f
Signed-off-by: Colin Cross <ccross@android.com>
owmemorykiller.c
1058a5ce897324d57052c132127bf4b0ee2419ce 05-Nov-2012 Stephen Smalley <sds@tycho.nsa.gov> Add security hooks to binder and implement the hooks for SELinux.

Add security hooks to the binder and implement the hooks for SELinux.
The security hooks enable security modules such as SELinux to implement
controls over binder IPC. The security hooks include support for
controlling what process can become the binder context manager
(binder_set_context_mgr), controlling the ability of a process
to invoke a binder transaction/IPC to another process (binder_transaction),
controlling the ability a process to transfer a binder reference to
another process (binder_transfer_binder), and controlling the ability
of a process to transfer an open file to another process (binder_transfer_file).

This support is used by SE Android, http://selinuxproject.org/page/SEAndroid.

Change-Id: I9a64a87825df2e60b9c51400377af4a9cd1c4049
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
inder.c
c034ef70c63ff50b8c963c275909d2c4dd1a962e 26-Sep-2012 Arve Hjønnevåg <arve@android.com> staging: android: lowmemorykiller: Add config option to support oom_adj values

The conversion to use oom_score_adj instead of the deprecated oom_adj
values breaks existing user-space code. Add a config option to convert
oom_adj values written to oom_score_adj values if they appear to be
valid oom_adj values.

Change-Id: I68308125059b802ee2991feefb07e9703bc48549
Signed-off-by: Arve Hjønnevåg <arve@android.com>
config
owmemorykiller.c
85139a99fe48625e1e41f2aa4910f3d7c347f267 21-Oct-2010 Brian Swetland <swetland@google.com> staging: remove Greg's TODO, now obsolete.

Signed-off-by: Brian Swetland <swetland@google.com>
ODO
ae57804a6aae5fbbc5faf8cd572dcc1fff494607 07-May-2010 San Mehat <san@google.com> staging: android: lowmemorykiller: Fix task_struct leak

As it turns out, the CONFIG_PROFILING interfaces leak a
task struct if the notifier chain returns NOTIFY_OK.. doh.

This patch reworks lowmemkiller to use the new generic task
free notifier chain.

Signed-off-by: San Mehat <san@google.com>
owmemorykiller.c
2e8e5a064f245f72d9673dbc9626244fa92d8323 16-Dec-2011 John Stultz <john.stultz@linaro.org> ashmem: Add shmem_set_file to mm/shmem.c

NOT FOR STAGING
This patch re-adds the original shmem_set_file to mm/shmem.c
and converts ashmem.c back to using it.

CC: Brian Swetland <swetland@google.com>
CC: Colin Cross <ccross@android.com>
CC: Arve Hjønnevåg <arve@android.com>
CC: Dima Zavin <dima@android.com>
CC: Robert Love <rlove@google.com>
CC: Greg KH <greg@kroah.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
shmem.c
5fecf3a1e1a0af61eb34eb6976ec9f59cca65d3f 27-Oct-2014 Daniel Thompson <daniel.thompson@linaro.org> staging: android: logger: Fix log corruption regression

Since commit cd678fce4280 ("switch logger to ->write_iter()"), any
attempt to write to the log results in the log data being written over
its own metadata, thus rendering the log unreadable.

The problem was first detected when I ran an Android userspace on the
v3.18-rc1 kernel. However the issue can also be observed with a
non-Android userspace by using echo/cat to write to/from /dev/log_main .

This patch resolves the problem by using a temporary to track the status
of not-yet-committed writes to the log buffer.

Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
ogger.c
77c688ac87183537ed0fb84ec2cb8fa8ec97c458 13-Oct-2014 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull vfs updates from Al Viro:
"The big thing in this pile is Eric's unmount-on-rmdir series; we
finally have everything we need for that. The final piece of prereqs
is delayed mntput() - now filesystem shutdown always happens on
shallow stack.

Other than that, we have several new primitives for iov_iter (Matt
Wilcox, culled from his XIP-related series) pushing the conversion to
->read_iter()/ ->write_iter() a bit more, a bunch of fs/dcache.c
cleanups and fixes (including the external name refcounting, which
gives consistent behaviour of d_move() wrt procfs symlinks for long
and short names alike) and assorted cleanups and fixes all over the
place.

This is just the first pile; there's a lot of stuff from various
people that ought to go in this window. Starting with
unionmount/overlayfs mess... ;-/"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (60 commits)
fs/file_table.c: Update alloc_file() comment
vfs: Deduplicate code shared by xattr system calls operating on paths
reiserfs: remove pointless forward declaration of struct nameidata
don't need that forward declaration of struct nameidata in dcache.h anymore
take dname_external() into fs/dcache.c
let path_init() failures treated the same way as subsequent link_path_walk()
fix misuses of f_count() in ppp and netlink
ncpfs: use list_for_each_entry() for d_subdirs walk
vfs: move getname() from callers to do_mount()
gfs2_atomic_open(): skip lookups on hashed dentry
[infiniband] remove pointless assignments
gadgetfs: saner API for gadgetfs_create_file()
f_fs: saner API for ffs_sb_create_file()
jfs: don't hash direct inode
[s390] remove pointless assignment of ->f_op in vmlogrdr ->open()
ecryptfs: ->f_op is never NULL
android: ->f_op is never NULL
nouveau: __iomem misannotations
missing annotation in fs/file.c
fs: namespace: suppress 'may be used uninitialized' warnings
...
765d368217715c794f767d396d8cea16502d823f 02-Sep-2014 Al Viro <viro@zeniv.linux.org.uk> android: ->f_op is never NULL

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
on/compat_ion.c
cd678fce428018dee0c9345ed63ebf9920d9902f 23-Aug-2014 Al Viro <viro@zeniv.linux.org.uk> switch logger to ->write_iter()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
ogger.c
91360b02ab483fc96a70b8c3016838f5d3725f99 19-Aug-2014 Al Viro <viro@zeniv.linux.org.uk> ashmem: use vfs_llseek()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
shmem.c
ae66475289d13ef724cd5a523a4a5ce42e81582b 27-Sep-2014 Heinrich Schuchardt <xypron.glpk@gmx.de> staging : android : sync : get_unused_fd

sync.h recommends to use get_unused_fd which does not set
O_CLOEXEC while the rest of the android tree uses
get_unused_fd_flags and sets O_CLOEXEC.

The patch adjust the comment.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.h
50d0a21b61f22b38f881fa21d2ada6ab4a61f93f 15-Sep-2014 Purnendu Kapadia <pro8linux@gmail.com> staging: android: sw_sync: checkpatch fixes

- no space after cast
- allignment should match open parenthesis
- remove unnecessary new line

Signed-off-by: Purnendu Kapadia <pro8linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
w_sync.c
w_sync.h
caf382fe31b7327a1e4449f1c05c0cc7fb5b90be 15-Sep-2014 Greg Kroah-Hartman <gregkh@linuxfoundation.org> Merge 3.17-rc5 into staging-next.

This fixes a merge conflict in lustre, and we want the other fixes that
went into 3.17-rc5 as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3ea411c56ef58a1827cf06fdcdeb14fa9265be09 01-Sep-2014 Maarten Lankhorst <maarten.lankhorst@canonical.com> android: fix reference leak in sync_fence_create

According to the documentation sync_fence_create takes ownership of the point,
not a reference on the point.

This fixes a memory leak introduced in 3.17's android fence rework.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Colin Cross <ccross@google.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
395262a9e69042b82293f8b6bcd7a48b2fd215de 08-Sep-2014 Dmitry Voytik <voytikd@gmail.com> staging: binder: fix coding style issues

Fix coding style issues:
* put braces in all if-else branches;
* limit the length of changed lines to 80 columns.
checkpatch.pl warning count reduces by 3.

Signed-off-by: Dmitry Voytik <voytikd@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
0232a42cbe3fe18c2dda833cb8e97253240a9479 04-Sep-2014 William Panlener <wpanlener@gmail.com> staging: android: Break up a long line in binder_send_failed_reply

Kernel coding style. Breaking long lines and strings.

Signed-off-by: William Panlener <wpanlener@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
220f115e5edd2163cac6ba808588051d1dbbd62c 02-Sep-2014 Grzegorz Swirski <grzegorz@swirski.name> staging: android: use braces on all arms of if

Signed-off-by: Grzegorz Swirski <grzegorz@swirski.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
e9723bf2ad1b7384e8d475e5356f51a1f35a8934 01-Sep-2014 Greg Kroah-Hartman <gregkh@linuxfoundation.org> Merge 3.17-rc3 into staging-next

We want the staging bugfixes in this branch as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7b1046e040670ee9fb2abe110fb24b33d91ada86 19-Aug-2014 Dipak Zope <dipakzope.kernel.org@gmail.com> staging: android: sync: Fix checkpatch warning: Missing a blank line after declarations

Signed-off-by: Dipak Zope <dipakzope.kernel.org@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
2fd2914a2e456048e2a176185cb8e7576def452c 15-Aug-2014 Purnendu Kapadia <pro8linux@gmail.com> staging: android: fix attribute as suggested by checkpatch

we should use __packed attribute

Signed-off-by: Purnendu Kapadia <pro8linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
api/binder.h
eb29835fb3ae9f7a8c8a4ae92e192052c3473557 13-Aug-2014 Seunghun Lee <waydi1@gmail.com> staging: android: fix a possible memory leak

Memory allocated by kstrdup should be freed.

CC: Brian Swetland <swetland@google.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Seunghun Lee <waydi1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ogger.c
b66157f36aff92ec3d93502471a7d26f10d39436 13-Aug-2014 Phong Tran <tranmanphong@gmail.com> staging: android: ion: Remove redundant return of void function

This patch fix checkpatch.pl warning
Tested by compilation only.

Signed-off-by: Phong Tran <tranmanphong@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion_carveout_heap.c
on/ion_chunk_heap.c
on/ion_dummy_driver.c
on/ion_system_heap.c
04e14356d549fd1c5487f8a5be13eb4a59802fb3 13-Aug-2014 Phong Tran <tranmanphong@gmail.com> staging: android: ion: ion.c Add a new blank line after decleration

This patch fix checkpatch.pl warning
Tested by compilation only.

Signed-off-by: Phong Tran <tranmanphong@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
d320c455cb726cc0618ad9852982debc8af535b3 13-Aug-2014 Phong Tran <tranmanphong@gmail.com> staging: android: ion: ion_dummy_driver.c Replace kzalloc() by kcalloc()

This patch fix checkpatch.pl warning
Tested by compilation only.

Signed-off-by: Phong Tran <tranmanphong@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_dummy_driver.c
a5b4e003253a496a7414003c034ff51a365258d4 06-Aug-2014 Yee Chin, Chiam <phathetique@gmail.com> Staging: android: sw_sync.c: Fixed coding style issue.

Fixed coding style issue where blank line is missing after declaration.

Signed-off-by: Yee Chin, Chiam <phathetique@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
w_sync.c
f6f8ed47353597dcb895eb4a15a28af657392e72 07-Aug-2014 WANG Chao <chaowang@redhat.com> mm/vmalloc.c: clean up map_vm_area third argument

Currently map_vm_area() takes (struct page *** pages) as third argument,
and after mapping, it moves (*pages) to point to (*pages +
nr_mappped_pages).

It looks like this kind of increment is useless to its caller these
days. The callers don't care about the increments and actually they're
trying to avoid this by passing another copy to map_vm_area().

The caller can always guarantee all the pages can be mapped into vm_area
as specified in first argument and the caller only cares about whether
map_vm_area() fails or not.

This patch cleans up the pointer movement in map_vm_area() and updates
its callers accordingly.

Signed-off-by: WANG Chao <chaowang@redhat.com>
Cc: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
inder.c
53ee983378ff23e8f3ff95ecf99dea7c6c221900 05-Aug-2014 Linus Torvalds <torvalds@linux-foundation.org> Merge tag 'staging-3.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging driver updates from Greg KH:
"Here's the big pull request for the staging driver tree for 3.17-rc1.

Lots of things in here, over 2000 patches, but the best part is this:
1480 files changed, 39070 insertions(+), 254659 deletions(-)

Thanks to the great work of Kristina Martšenko, 14 different staging
drivers have been removed from the tree as they were obsolete and no
one was willing to work on cleaning them up. Other than the driver
removals, loads of cleanups are in here (comedi, lustre, etc.) as well
as the usual IIO driver updates and additions.

All of this has been in the linux-next tree for a while"

* tag 'staging-3.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (2199 commits)
staging: comedi: addi_apci_1564: remove diagnostic interrupt support code
staging: comedi: addi_apci_1564: add subdevice to check diagnostic status
staging: wlan-ng: coding style problem fix
staging: wlan-ng: fixing coding style problems
staging: comedi: ii_pci20kc: request and ioremap memory
staging: lustre: bitwise vs logical typo
staging: dgnc: Remove unneeded dgnc_trace.c and dgnc_trace.h
staging: dgnc: rephrase comment
staging: comedi: ni_tio: remove some dead code
staging: rtl8723au: Fix static symbol sparse warning
staging: rtl8723au: usb_dvobj_init(): Remove unused variable 'pdev_desc'
staging: rtl8723au: Do not duplicate kernel provided USB macros
staging: rtl8723au: Remove never set struct pwrctrl_priv.bHWPowerdown
staging: rtl8723au: Remove two never set variables
staging: rtl8723au: RSSI_test is never set
staging:r8190: coding style: Fixed checkpatch reported Error
staging:r8180: coding style: Fixed too long lines
staging:r8180: coding style: Fixed commenting style
staging: lustre: ptlrpc: lproc_ptlrpc.c - fix dereferenceing user space buffer
staging: lustre: ldlm: ldlm_resource.c - fix dereferenceing user space buffer
...
80039faa8809461f8e23892e14277f9f0af45505 31-Jul-2014 Murilo Opsfelder Araujo <mopsfelder@gmail.com> Staging: android: timed_gpio.c: improved logic of gpio_get_time()

This patch improves the logic of gpio_get_time() and, thereafter,
makes checkpatch.pl happy.

Signed-off-by: Murilo Opsfelder Araujo <mopsfelder@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
imed_gpio.c
6aa2621183ee0142ebbcadff59417f0f1c10ae15 29-Jul-2014 Murilo Opsfelder Araujo <mopsfelder@gmail.com> Staging: android: timed_output.c: use kstrtoint() instead of sscanf()

This patch makes checkpatch.pl happy by fixing the following warning:

WARNING: Prefer kstrto<type> to single variable sscanf

Signed-off-by: Murilo Opsfelder Araujo <mopsfelder@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
imed_output.c
80dd7052089f0ee847ba3dc7c5ad471c0ed18089 23-Jul-2014 Fabian Frederick <fabf@skynet.be> staging: ion: vm_insert_pfn and zap_page_range rely on CONFIG_MMU

Fix following sh-allmodconfig errors reported on kisskb
"
drivers/built-in.o: In function `ion_vm_fault':
ion.c:(.text+0x1f2d8f8): undefined reference to `vm_insert_pfn'
drivers/built-in.o: In function `ion_buffer_sync_for_device':
ion.c:(.text+0x1f316bc): undefined reference to `zap_page_range'
make: *** [vmlinux] Error 1
"

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/Kconfig
f0ca3e87cc132b67c40ba1161cd02c8a2985ac4c 20-Jul-2014 Phong Tran <tranmanphong@gmail.com> staging: android: ion: ion_cma_heap.c: Fix checkpatch warning

This patch fix coding style:

- Remove "fail memory allocation" waring
- Remove return of void function

Tested by compilation only

Signed-off-by: Phong Tran <tranmanphong@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_cma_heap.c
657b8dbc49bce60cc3f58c5667b731d77fa8e734 17-Jul-2014 Sachin Kamat <sachin.kamat@samsung.com> staging: ion: Remove left over comment

Commit 2bb9f5034ec7 ("gpu: ion: Remove heapmask from client")
removed the heap_type_mask parameter. Remove the associated
kernel-doc comment too.

Signed-off-by: Sachin Kamat <sachin.kamat@samsung.com>
Cc: Rebecca Schultz Zavin <rebecca@android.com>
Cc: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.h
d4ec15e16ff0d72f9a3f1909b1ed20515f1f40d0 14-Jul-2014 Lucas Tanure <tanure@linux.com> staging: android: Clean up else statement from binder_send_failed_reply

Kernel coding style. Remove useless else statement after return.

Changes from v1 and v2: Fix warning for mixed declarations and code.
Declaration of "struct binder_transaction *next" made outside of while.

Changes from v3: Removed initialization to NULL for next variable.

Signed-off-by: Lucas Tanure <tanure@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
6a44b50f9819571c2b871bffba107defec556a87 15-Jul-2014 Lucas Tanure <tanure@linux.com> staging: android: Clean up else statement from sync_fence_poll()

Kernel coding style. Remove useless else statement after return.

Signed-off-by: Lucas Tanure <tanure@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
954513551f5afb7893b7c688a67219356ab3efe6 12-Jul-2014 Peter Senna Tschudin <peter.senna@gmail.com> staging: android: Cleanup style issues

This patch fixes the following checkpatch warnings:
- Remove else after return
- Add space after declaration

Tested by compilation only.

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync_debug.c
48d5bb4403a0380613267770f9dccb73ab7f98fa 01-Jul-2014 Jerry Stralko <gerb.stralko@gmail.com> staging: android: logger: fixed checkpatch.pl warnings.

Signed-off-by: Jerry Stralko <gerb.stralko@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ogger.c
403f8af323f0b3b1893ef257be5c5a41cd213d55 07-Jul-2014 Chen Gang <gang.chen.5i5j@gmail.com> drivers: staging: android: ion: Kconfig: Let it also depend on HAS_DMA

ION need HAS_DMA (e.g. need DMA_SHARED_BUFFER), so it has to depend on
HAS_DMA, or can not pass compiling with allmodconfig under score which
NO_DMA. And the related error:

CC drivers/staging/android/ion/ion_cma_heap.o
drivers/staging/android/ion/ion_cma_heap.c: In function 'ion_cma_mmap':
drivers/staging/android/ion/ion_cma_heap.c:168:2: error: implicit declaration of function 'dma_mmap_coherent' [-Werror=implicit-function-declaration]
return dma_mmap_coherent(dev, vma, info->cpu_addr, info->handle,
^
cc1: some warnings being treated as errors
make[4]: *** [drivers/staging/android/ion/ion_cma_heap.o] Error 1
make[3]: *** [drivers/staging/android/ion] Error 2
make[2]: *** [drivers/staging/android] Error 2
make[1]: *** [drivers/staging] Error 2
make: *** [drivers] Error 2

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/Kconfig
78260ac625e91d2402d72dd2f8c7109f98c1d19a 03-Jun-2014 Tair Rzayev <tair.rzayev@gmail.com> staging: android: binder.c: binder_ioctl() cleanup

binder_ioctl() is quite huge and checkpatch dirty - mostly because of
the amount of code for the BINDER_WRITE_READ and BINDER_SET_CONTEXT_MGR.
Moved that code into the new binder_ioctl_write_read() and
binder_ioctl_set_ctx_mgr()

Signed-off-by: Tair Rzayev <tair.rzayev@gmail.com>
Cc: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
ddac7d5fba555967654bf47b7b458b050391dc1f 02-Jun-2014 Vinayak Menon <vinayakm.list@gmail.com> staging: binder: add vm_fault handler

An issue was observed when a userspace task exits.
The page which hits error here is the zero page.
In binder mmap, the whole of vma is not mapped.
On a task crash, when debuggerd reads the binder regions,
the unmapped areas fall to do_anonymous_page in handle_pte_fault,
due to the absence of a vm_fault handler. This results in
zero page being mapped. Later in zap_pte_range, vm_normal_page
returns zero page in the case of VM_MIXEDMAP and it results in the
error.

BUG: Bad page map in process mediaserver pte:9dff379f pmd:9bfbd831
page:c0ed8e60 count:1 mapcount:-1 mapping: (null) index:0x0
page flags: 0x404(referenced|reserved)
addr:40c3f000 vm_flags:10220051 anon_vma: (null) mapping:d9fe0764 index:fd
vma->vm_ops->fault: (null)
vma->vm_file->f_op->mmap: binder_mmap+0x0/0x274
CPU: 0 PID: 1463 Comm: mediaserver Tainted: G W 3.10.17+ #1
[<c001549c>] (unwind_backtrace+0x0/0x11c) from [<c001200c>] (show_stack+0x10/0x14)
[<c001200c>] (show_stack+0x10/0x14) from [<c0103d78>] (print_bad_pte+0x158/0x190)
[<c0103d78>] (print_bad_pte+0x158/0x190) from [<c01055f0>] (unmap_single_vma+0x2e4/0x598)
[<c01055f0>] (unmap_single_vma+0x2e4/0x598) from [<c010618c>] (unmap_vmas+0x34/0x50)
[<c010618c>] (unmap_vmas+0x34/0x50) from [<c010a9e4>] (exit_mmap+0xc8/0x1e8)
[<c010a9e4>] (exit_mmap+0xc8/0x1e8) from [<c00520f0>] (mmput+0x54/0xd0)
[<c00520f0>] (mmput+0x54/0xd0) from [<c005972c>] (do_exit+0x360/0x990)
[<c005972c>] (do_exit+0x360/0x990) from [<c0059ef0>] (do_group_exit+0x84/0xc0)
[<c0059ef0>] (do_group_exit+0x84/0xc0) from [<c0066de0>] (get_signal_to_deliver+0x4d4/0x548)
[<c0066de0>] (get_signal_to_deliver+0x4d4/0x548) from [<c0011500>] (do_signal+0xa8/0x3b8)

Add a vm_fault handler which returns VM_FAULT_SIGBUS, and prevents the
wrong fallback to do_anonymous_page.

Signed-off-by: Vinayak Menon <vinayakm.list@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
0f0d8406fb9c3c5ed1b1609a0f51c504c5b37aea 01-Jul-2014 Maarten Lankhorst <maarten.lankhorst@canonical.com> android: convert sync to fence api, v6

Just to show it's easy.

Android syncpoints can be mapped to a timeline. This removes the need
to maintain a separate api for synchronization. I've left the android
trace events in place, but the core fence events should already be
sufficient for debugging.

v2:
- Call fence_remove_callback in sync_fence_free if not all fences have fired.
v3:
- Merge Colin Cross' bugfixes, and the android fence merge optimization.
v4:
- Merge with the upstream fixes.
v5:
- Fix small style issues pointed out by Thomas Hellstrom.
v6:
- Fix for updates to fence api.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: John Stultz <john.stultz@linaro.org>
Acked-by: Sumit Semwal <sumit.semwal@linaro.org>
Acked-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
config
akefile
w_sync.c
ync.c
ync.h
ync_debug.c
race/sync.h
3aac4502fd3f80dcf7e65dbf6edd8676893c1f46 01-Jul-2014 Maarten Lankhorst <maarten.lankhorst@canonical.com> dma-buf: use reservation objects

This allows reservation objects to be used in dma-buf. it's required
for implementing polling support on the fences that belong to a dma-buf.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Mauro Carvalho Chehab <m.chehab@samsung.com> #drivers/media/v4l2-core/
Acked-by: Thomas Hellstrom <thellstrom@vmware.com> #drivers/gpu/drm/ttm
Acked-by: Sumit Semwal <sumit.semwal@linaro.org>
Acked-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net> #drivers/gpu/drm/armada/
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
7873311aed5436bad100ff7ed98f159e6c8c17a7 21-Jun-2014 Karthik Nayak <karthik.188@gmail.com> Staging: Android: removed an unnecessary else statement

As per checkpatch warning, removed an unnecessary else statement
proceeding an if statement with a return.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
ef7994fa2aecd8d1fb0d75034caa050ff908d26a 22-Jun-2014 Greg Kroah-Hartman <gregkh@linuxfoundation.org> Merge 3.16-rc2 into staging-next

We want the staging fixes here as well.
2a838c6484e13da6f1bfe093d7300d02daca80d1 20-Jun-2014 Pramod Gurav <pramod.gurav.etc@gmail.com> staging: alarm-dev: Set the license to GPL

Adding "GPL" license to fix a warning while compiling as
module.

CC: Brian Swetland <swetland@google.com>
Signed-off-by: Pramod Gurav <pramod.gurav.etc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm-dev.c
895ae8765726df407264dc661674e4e04eaf8664 20-Jun-2014 Heesub Shin <heesub.shin@samsung.com> staging: ion: fixup invalid kfree() calls on heap destroy

I've noticed that the last commit to ion_system_heap.c ('staging: ion:
optimize struct ion_system_heap') has an omission, so an invalid kfree()
gets called on ion_system_heap_destroy(). As ION system heap is never
destroyed until system shutdown, it may not cause any harm, but should
be fixed. I should have caught this before the merge, my bad.

Signed-off-by: Heesub Shin <heesub.shin@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
b28e7d5807051184270c40d4bc48db947189f107 03-Jun-2014 Yi Zhang <yizhang@marvell.com> staging: android: timed_output: fix use after free of dev

tdev->dev has been freed in device_destroy(), it's not right to
use dev_set_drvdata() after that;

Signed-off-by: Yi Zhang <yizhang@marvell.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
imed_output.c
32c3f470ec7e427db69d86a3061101ea4a5c681f 13-Jun-2014 Pramod Gurav <pramod.gurav.etc@gmail.com> staging: alarm-dev: Support to Compile as Module

Currently this alarm-dev can be compiles only as built in
driver. This adds support to compile it as module as well which is in
planned activity (See drivers/staging/android/TODO)

CC: Brian Swetland <swetland@google.com>
Signed-off-by: Pramod Gurav <pramod.gurav.etc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
config
69b2b20e287870441f0a8f1a1e51b94c247986ae 31-May-2014 Tair Rzayev <tair.rzayev@gmail.com> staging: android: ion: ion_chunk_heap.c: Fix checkpatch warning

Fix the over 80 character line

Signed-off-by: Tair Rzayev <tair.rzayev@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_chunk_heap.c
6944561ece14d865238d14e40da858efb29dc2e8 30-May-2014 Heesub Shin <heesub.shin@samsung.com> staging: ion: optimize struct ion_system_heap

struct ion_system_heap has an array for storing pointers to page pools
and it is allocated separately from the containing structure. There is
no point in allocating those two small objects individually, bothering
slab allocator. Using a variable length array simplifies code lines and
reduces overhead to the slab.

Signed-off-by: Heesub Shin <heesub.shin@samsung.com>
Reviewed-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
06566f5dc3f30e74de9e7bee4da6aad9ca35f287 30-May-2014 Heesub Shin <heesub.shin@samsung.com> staging: ion: remove order argument from free_buffer_page()

Now that the pages returned from the pool are compound pages, we do not
need to pass the order information to free_buffer_page().

Signed-off-by: Heesub Shin <heesub.shin@samsung.com>
Reviewed-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
7eb88bffbd883fa78944799ff3887da916159a59 30-May-2014 Heesub Shin <heesub.shin@samsung.com> staging: ion: remove struct page_info

ION system heap creates a temporary list of pages to build
scatter/gather table, introducing an internal data type, page_info. Now
that the order field has been removed from it, we do not need to depend
on such data type anymore.

Signed-off-by: Heesub Shin <heesub.shin@samsung.com>
Reviewed-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
d10e4ffd64a19d88f085e92a4b0a2470aa336915 30-May-2014 Heesub Shin <heesub.shin@samsung.com> staging: ion: remove order from struct page_info

ION system heap uses an internal data structure, struct page_info, for
tracking down the meta information of the pages allocated from the pool.
Now that the pool returns compound pages, we don't need to store page
order in struct page_info.

Signed-off-by: Heesub Shin <heesub.shin@samsung.com>
Reviewed-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
c84a1e32ee58fc1cc9d3fd42619b917cce67e30a 03-Jun-2014 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next

Pull scheduler updates from Ingo Molnar:
"The main scheduling related changes in this cycle were:

- various sched/numa updates, for better performance

- tree wide cleanup of open coded nice levels

- nohz fix related to rq->nr_running use

- cpuidle changes and continued consolidation to improve the
kernel/sched/idle.c high level idle scheduling logic. As part of
this effort I pulled cpuidle driver changes from Rafael as well.

- standardized idle polling amongst architectures

- continued work on preparing better power/energy aware scheduling

- sched/rt updates

- misc fixlets and cleanups"

* 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (49 commits)
sched/numa: Decay ->wakee_flips instead of zeroing
sched/numa: Update migrate_improves/degrades_locality()
sched/numa: Allow task switch if load imbalance improves
sched/rt: Fix 'struct sched_dl_entity' and dl_task_time() comments, to match the current upstream code
sched: Consolidate open coded implementations of nice level frobbing into nice_to_rlimit() and rlimit_to_nice()
sched: Initialize rq->age_stamp on processor start
sched, nohz: Change rq->nr_running to always use wrappers
sched: Fix the rq->next_balance logic in rebalance_domains() and idle_balance()
sched: Use clamp() and clamp_val() to make sys_nice() more readable
sched: Do not zero sg->cpumask and sg->sgp->power in build_sched_groups()
sched/numa: Fix initialization of sched_domain_topology for NUMA
sched: Call select_idle_sibling() when not affine_sd
sched: Simplify return logic in sched_read_attr()
sched: Simplify return logic in sched_copy_attr()
sched: Fix exec_start/task_hot on migrated tasks
arm64: Remove TIF_POLLING_NRFLAG
metag: Remove TIF_POLLING_NRFLAG
sched/idle: Make cpuidle_idle_call() void
sched/idle: Reflow cpuidle_idle_call()
sched/idle: Delay clearing the polling bit
...
57bab7cb353d71c10611c34571fcb3c9f38b4792 31-May-2014 Tair Rzayev <tair.rzayev@gmail.com> staging: android: binder.c: Use more appropriate functions for euid retrieval

Instead of getting the reference to whole credential structure, use
task_euid() and current_euid() to get it.

Signed-off-by: Tair Rzayev <tair.rzayev@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
0cd2dc4db3ba23ff8ab38b8ae81b126626f795d5 28-May-2014 Heesub Shin <heesub.shin@samsung.com> staging: ion: shrink highmem pages on kswapd

ION system heap keeps pages in its pool for better performance. When the
system is under memory pressure, slab shrinker calls the callback
registered and then the pages pooled get freed.

When the shrinker is called, it checks gfp_mask and determines whether
the pages from highmem need to be freed or the pages from lowmem.
Usually, slab shrinker is invoked on kswapd context which gfp_mask is
always GFP_KERNEL, so only lowmem pages are released on kswapd context.
This means that highmem pages in the pool are never reclaimed until
direct reclaim occurs. This can be problematic when the page pool holds
excessive amounts of highmem.

For now, the shrinker callback cannot know exactly which zone should be
targeted for reclamation, as enough information are not passed to. Thus,
it makes sense to shrink both lowmem and highmem zone on kswapd context.

Reported-by: Wonseo Choi <wonseo.choi@samsung.com>
Signed-off-by: Heesub Shin <heesub.shin@samsung.com>
Reviewed-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_page_pool.c
bdeb9f1c4276864e97a725c8c0a8bc9a8686edfe 28-May-2014 Heesub Shin <heesub.shin@samsung.com> staging: ion: use compound pages on high order pages for system heap

Using compound pages relieves burden on tracking the meta information
which are currently stored in page_info.

Signed-off-by: Heesub Shin <heesub.shin@samsung.com>
Reviewed-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_page_pool.c
on/ion_system_heap.c
38c003b113ceab37f80d020999d3ec2cbf784da3 28-May-2014 Heesub Shin <heesub.shin@samsung.com> staging: ion: remove struct ion_page_pool_item

The page pool uses an internal data structure, ion_page_pool_item, for
wrapping pooled pages and constructing a list. As the struct page
already provides ways for doing exactly the same thing, we do not need
to reinvent the wheel. This commit removes the data structure and slab
allocations for it.

Signed-off-by: Heesub Shin <heesub.shin@samsung.com>
Reviewed-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_page_pool.c
80cb77dc6310a72002f6cb8255316c5aaea78807 28-May-2014 Heesub Shin <heesub.shin@samsung.com> staging: ion: simplify ion_page_pool_total()

ion_page_pool_total() returns the total number of pages in the pool.
Depending on the argument passed, it counts highmem pages in or not.
This commit simplifies the code lines for better readability.

Signed-off-by: Heesub Shin <heesub.shin@samsung.com>
Reviewed-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_page_pool.c
792407484a09b455064722c5190b45e1e1f2cecd 28-May-2014 Heesub Shin <heesub.shin@samsung.com> staging: ion: tidy up a bit

For aesthetics and readability, rename goto labels, remove
useless code lines, and clarify function return type.

Signed-off-by: Heesub Shin <heesub.shin@samsung.com>
Reviewed-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_page_pool.c
on/ion_priv.h
on/ion_system_heap.c
296066093b5f5ccf30a9c3b2047eb6a8875a88f0 24-May-2014 Niv Yehezkel <executerx@gmail.com> staging: android: describe use of memory barrier on sync.c

Added comments describing the purpose of using write memory
barrier in the context of sync_timeline_destory.

Signed-off-by: Niv Yehezkel <executerx@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
22f6b9789aef2e0b0b409b1d7708cc653540248c 23-May-2014 Mitchel Humpherys <mitchelh@codeaurora.org> staging: ion: WARN when the handle kmap_cnt is going to wrap around

There are certain client bugs (double unmap, for example) that can cause
the handle->kmap_cnt (an unsigned int) to wrap around from zero. This
causes problems when the handle is destroyed because we have:

while (handle->kmap_cnt)
ion_handle_kmap_put(handle);

which takes a long time to complete when kmap_cnt starts at ~0 and can
result in a watchdog timeout.

WARN and bail when kmap_cnt is about to wrap around from zero.

Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Acked-by: Colin Cross <ccross@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
27ea2f167ba5ddd0108b61562698a756e43b0271 07-May-2014 John Church <sleeveroller@gmail.com> staging : android: Fixes a coding style issue in timed_gpio.c

This patch fixes a coding style issue for a line that was over 80 characters long.

Signed-off-by: John Church <sleeveroller@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
imed_gpio.c
7d42043f093ed83ef80f03b17087a1eaaf8d2e06 07-May-2014 Christian Engelmayer <cengelma@gmx.at> staging: binder: fix usage of uninit scalar in binder_transaction()

Fix the error path when a cookie mismatch is detected. In that case the
function jumps to the exit label without setting the uninitialized, local
variable 'return_error'. Detected by Coverity - CID 201453.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Acked-by: Arve <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
f994d8358dd4a2fed481fca42b406292c0708665 01-May-2014 Jerry Snitselaar <dev@snitselaar.org> staging: binder: cleanup dereference of noderef expressions

Clean up sparse warnings for cred struct dereference.

Signed-off-by: Jerry Snitselaar <dev@snitselaar.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
7aa2c016db2162defff77f6f5731bff3f25e5175 08-May-2014 Dongsheng Yang <yangds.fnst@cn.fujitsu.com> sched: Consolidate open coded implementations of nice level frobbing into nice_to_rlimit() and rlimit_to_nice()

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/a568a1e3cc8e78648f41b5035fa5e381d36274da.1399532322.git.yangds.fnst@cn.fujitsu.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
inder.c
2fe5de9ce7d57498abc14b375cad2fcf8c3ee6cc 07-May-2014 Ingo Molnar <mingo@kernel.org> Merge branch 'sched/urgent' into sched/core, to avoid conflicts

Signed-off-by: Ingo Molnar <mingo@kernel.org>
10f62861b4a2f22cbd6412b3c42c76f0bdfbd648 30-Apr-2014 Seunghun Lee <waydi1@gmail.com> staging: android: fix missing a blank line after declarations

This patch fixes "Missing a blank line after declarations" warnings.

Signed-off-by: Seunghun Lee <waydi1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm-dev.c
inder.c
on/ion.c
on/ion_heap.c
on/ion_priv.h
on/ion_system_heap.c
ogger.c
w_sync.c
ync.c
imed_gpio.c
b6152016003b2cc2370899558bf2e7de4ebd0b09 25-Apr-2014 Gioh Kim <gioh.kim@lge.com> Staging: android: ion: duplicated clearing of sg_table

Because sg_table is cleared in sg_alloc_table via memset we don't need to use
kzalloc to allocate sg_table.

Signed-off-by: Gioh Kim <gioh.kim@lge.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_carveout_heap.c
on/ion_chunk_heap.c
on/ion_system_heap.c
d7a33d74e9913bd4d2580aff67ed7051935f546b 22-Apr-2014 Bintian Wang <bintian.wang@huawei.com> staging/android: Remove ram_console.h

ram_console is replaced by pstore and pstore_ram drivers,
and there is no code to use this head file, so remove it.

Signed-off-by: Bintian Wang <bintian.wang@huawei.com>
Acked-by: Colin Cross <ccross@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
am_console.h
8698a745d800c59cd5a576398bdeccd578ac66f1 11-Mar-2014 Dongsheng Yang <yangds.fnst@cn.fujitsu.com> sched, treewide: Replace hardcoded nice values with MIN_NICE/MAX_NICE

Replace various -20/+19 hardcoded nice values with MIN_NICE/MAX_NICE.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/ff13819fd09b7a5dba5ab5ae797f2e7019bdfa17.1394532288.git.yangds.fnst@cn.fujitsu.com
Cc: devel@driverdev.osuosl.org
Cc: devicetree@vger.kernel.org
Cc: fcoe-devel@open-fcoe.org
Cc: linux390@de.ibm.com
Cc: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: linux-s390@vger.kernel.org
Cc: linux-scsi@vger.kernel.org
Cc: nbd-general@lists.sourceforge.net
Cc: ocfs2-devel@oss.oracle.com
Cc: openipmi-developer@lists.sourceforge.net
Cc: qla2xxx-upstream@qlogic.com
Cc: linux-arch@vger.kernel.org
[ Consolidated the patches, twiddled the changelog. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
inder.c
36c89c0a6bebafdde13099229dfe541380ce7612 15-Apr-2014 Mathieu Maret <mathieu.maret@gmail.com> staging: binder: add __user annotation in binder.c

Add __user to binder_version to correct sparse warning.
Reduce line size to fit to coding style.

Signed-off-by: Mathieu Maret <mathieu.maret@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
53d719f6a907ad7e2ca449fdaf9c9e175a623350 16-Apr-2014 Seunghun Lee <waydi1@gmail.com> staging: android: uapi: fix coding style

This patch fix checkpatch.pl warning and errors.

Signed-off-by: Seunghun Lee <waydi1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
api/ion.h
159d8133d0b54a501a41a66fe3a0e7d16405e36d 03-Apr-2014 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial

Pull trivial tree updates from Jiri Kosina:
"Usual rocket science -- mostly documentation and comment updates"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial:
sparse: fix comment
doc: fix double words
isdn: capi: fix "CAPI_VERSION" comment
doc: DocBook: Fix typos in xml and template file
Bluetooth: add module name for btwilink
driver core: unexport static function create_syslog_header
mmc: core: typo fix in printk specifier
ARM: spear: clean up editing mistake
net-sysfs: fix comment typo 'CONFIG_SYFS'
doc: Insert MODULE_ in module-signing macros
Documentation: update URL to hfsplus Technote 1150
gpio: update path to documentation
ixgbe: Fix format string in ixgbe_fcoe.
Kconfig: Remove useless "default N" lines
user_namespace.c: Remove duplicated word in comment
CREDITS: fix formatting
treewide: Fix typo in Documentation/DocBook
mm: Fix warning on make htmldocs caused by slab.c
ata: ata-samsung_cf: cleanup in header file
idr: remove unused prototype of idr_free()
3e4cb2f31401b9d867b296d7eec83b2bc36cb383 09-Mar-2014 Georgiana Rodica Chelu <georgiana.chelu93@gmail.com> staging: android: Remove whitespace issue

This patch fixes coding style issue: removing the whitespace

Signed-off-by: Georgiana Rodica Chelu <georgiana.chelu93@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
imed_gpio.c
464a5028eadef63e4b84e834eaeb782b537bf513 11-Mar-2014 Iulia Manda <iulia.manda21@gmail.com> staging: android: ion: Use ERR_CAST instead of ERR_PTR

Fix the following coccinelle warnings in ion.c:
drivers/staging/android/ion/ion.c:511:9-16: WARNING: ERR_CAST can be used with buffer
drivers/staging/android/ion/ion.c:218:9-16: WARNING: ERR_CAST can be used with table
drivers/staging/android/ion/ion.c:1150:9-16: WARNING: ERR_CAST can be used with dmabuf

Signed-off-by: Iulia Manda <iulia.manda21@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
on/ion.c
164ad86d3382de1095db97e5f566e0182d9fec4c 11-Mar-2014 Iulia Manda <iulia.manda21@gmail.com> staging: android: ion: Replace seq_printf with seq_puts

It is preferred to use seq_puts instead of seq_printf here, as it suffices string printing.

Signed-off-by: Iulia Manda <iulia.manda21@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
on/ion.c
7287bb5258800d93dc8f5eb5115025c75a69014b 11-Mar-2014 Iulia Manda <iulia.manda21@gmail.com> staging: android: ion: Fix quoted string split across lines

Join strings from two separated lines, even if this makes line longer than 80
characters.

Signed-off-by: Iulia Manda <iulia.manda21@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
on/ion.c
48be81830eb72ce95b33075cce9fdfa39443dce6 08-Mar-2014 Georgiana Rodica Chelu <georgiana.chelu93@gmail.com> staging: android: Use devm_kzalloc instead of kzalloc

Use devm_kzalloc instead of kzalloc in staging/android/timed_gpio.c

Signed-off-by: Georgiana Rodica Chelu <georgiana.chelu93@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
imed_gpio.c
f71373c06c48660fb9a52e3393f86dac3e9ffd84 07-Mar-2014 Himangi Saraogi <himangi774@gmail.com> staging:android: Introduce the use of the managed version of kzalloc

This patch moves shared private data kzalloc to managed devm_kzalloc and
cleans now unneccessary kfree in probe and remove functions.

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/tegra/tegra_ion.c
058dbde928597e7a8bd04e28e77e5cfc4270591d 26-Feb-2014 Vinayak Menon <vinayakm.list@gmail.com> staging: android: lowmemorykiller: neglect swap cached pages in other_file

With ZRAM enabled it is observed that lowmemory killer
doesn't trigger properly. swap cached pages are
accounted in NR_FILE, and lowmemorykiller considers
this as reclaimable and adds to other_file. But these
pages can't be reclaimed unless lowmemorykiller triggers.
So subtract swap pages from other_file.

Signed-off-by: Vinayak Menon <vinayakm.list@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
owmemorykiller.c
d0bdff0db809696ebc7b58234f3ff4166844c2cd 26-Feb-2014 John Stultz <john.stultz@linaro.org> staging: Fix build issues with new binder API

The new 64bit binder API causes build issues on 32bit ARM
due to the lack of 64bit __get_user_asm_* implementation.

Until that implementation is done, remove the choice for
32bit ARM, automatically enabling the old 32bit binder
protocol.

This can be reverted once a 64bit __get_user_asm_*
implementation is merged.

Cc: Colin Cross <ccross@android.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Serban Constantinescu <serban.constantinescu@arm.com>
Cc: Android Kernel Team <kernel-team@android.com>
Reported-by: Arnd Bergmann <arnd.bergmann@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
config
1acec6a28347c3e57d9f882088f92caf0f4aec94 21-Feb-2014 John Stultz <john.stultz@linaro.org> staging: binder: Improve Kconfig entry for ANDROID_BINDER_IPC_32BIT

Add a more clear explanation of the option in the prompt, and
make the config depend on ANDROID_BINDER_IPC being selected.

Also sets the default to y, which matches AOSP.

Cc: Colin Cross <ccross@android.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Serban Constantinescu <serban.constantinescu@arm.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
config
da49889deb34d351cdd113f9d1607dbb830cb5bb 21-Feb-2014 Arve Hjønnevåg <arve@android.com> staging: binder: Support concurrent 32 bit and 64 bit processes.

For 64bit systems we want to use the same binder interface for 32bit and
64bit processes. Thus the size and the layout of the structures passed
between the kernel and the userspace has to be the same for both 32 and
64bit processes.

This change replaces all the uses of void* and size_t with
binder_uintptr_t and binder_size_t. These are then typedefed to specific
sizes depending on the use of the interface, as follows:
* __u32 - on legacy 32bit only userspace
* __u64 - on mixed 32/64bit userspace where all processes use the same
interface.

This change also increments the BINDER_CURRENT_PROTOCOL_VERSION to 8 and
hooks the compat_ioctl entry for the mixed 32/64bit Android userspace.

This patch also provides a CONFIG_ANDROID_BINDER_IPC_32BIT option for
compatability, which if set which enables the old protocol, setting
BINDER_CURRENT_PROTOCOL_VERSION to 7, on 32 bit systems.

Please note that all 64bit kernels will use the 64bit Binder ABI.

Cc: Colin Cross <ccross@android.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Serban Constantinescu <serban.constantinescu@arm.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Arve Hjønnevåg <arve@android.com>
[jstultz: Merged with upstream type changes. Various whitespace fixes
and longer Kconfig description for checkpatch. Included improved commit
message from Serban (with a few tweaks).]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
config
inder.c
inder.h
inder_trace.h
api/binder.h
df24a2eaa1e2de82d3033e1f37f17ad9c9a1c58e 21-Feb-2014 Serban Constantinescu <serban.constantinescu@arm.com> staging: binder: Fix ABI for 64bit Android

BC_REQUEST_DEATH_NOTIFICATION and BC_CLEAR_DEATH_NOTIFICATION were
defined with the wrong structure that did not match the code. Since a
binder pointer and handle are the same size on 32 bit systems, this
change does not affect them. The two commands claimed they were using
struct binder_ptr_cookie but they are using a 32bit handle and a pointer.

The main purpose of this patch is to add the binder_handle_cookie
struct so the service manager does not have to define its own version
(libbinder writes one field at a time so it does not use the struct).

On 32bit systems the payload size is the same as the size of struct
binder_ptr_cookie. On 64bit systems, the size does differ, and the
ioctl number does change. However, there are no known 64bit users of
this interface, and any 64bit systems will need the following patch to
run 32 bit processes anyway, so it is not expected that anyone will
ship a 64bit system without this change, so this change should not
affect any existing systems.

Cc: Colin Cross <ccross@android.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Serban Constantinescu <serban.constantinescu@arm.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
[jstultz: Few 80+ col fixes for checkpatch, improved commit message
with help from Serban, and included rational from Arve's email]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
api/binder.h
b42060069faa0daf7915acec4f31e4a46bca3b32 24-Feb-2014 Greg Kroah-Hartman <gregkh@linuxfoundation.org> Merge 3.14-rc4 into staging-next.

We want those fixes here as well.
e194fd8a5d8e0a7eeed239a8534460724b62fe2d 17-Feb-2014 Arve Hjønnevåg <arve@android.com> staging: binder: Fix death notifications

The change (008fa749e0fe5b2fffd20b7fe4891bb80d072c6a) that moved the
node release code to a separate function broke death notifications in
some cases. When it encountered a reference without a death
notification request, it would skip looking at the remaining
references, and therefore fail to send death notifications for them.

Cc: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Cc: stable <stable@vger.kernel.org> # 3.10
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
d4263348f796f29546f90802177865dd4379dd0a 20-Feb-2014 Jiri Kosina <jkosina@suse.cz> Merge branch 'master' into for-next
c7dcec7dd463907c451048b04f30d1870fe5cacc 11-Feb-2014 Paul Bolle <pebolle@tiscali.nl> Kconfig: Remove useless "default N" lines

A number of Kconfig entries default to (uppercase) "N". It was clearly
intended to use "default n". But since (lowercase) "n" is the default
anyway, these lines might as well be removed.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
config
2a3fcc51639cb4ad1a841bc169a1ddb993455076 18-Feb-2014 Fabio Estevam <fabio.estevam@freescale.com> staging: ion: ion_cma_heap: Remove '0x' when using %pa format

%pa format already prints in hexadecimal format, so remove the '0x' annotation
to avoid a double '0x0x' pattern.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_cma_heap.c
53a91c68fa7b5f3ca45d2f1c88bf36a988b74e81 17-Feb-2014 Mitchel Humpherys <mitchelh@codeaurora.org> staging: ion: Add private buffer flag to skip page pooling on free

Currently, when we free a buffer it might actually just go back into a
heap-specific page pool rather than going back to the system. This poses
a problem because sometimes (like when we're running a shrinker in low
memory conditions) we need to force the memory associated with the
buffer to truly be relinquished to the system rather than just going
back into a page pool.

There isn't a use case for this flag by Ion clients, so make it a
private flag. The main use case right now is to provide a mechanism for
the deferred free code to force stale buffers to bypass page pooling.

Cc: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
[jstultz: Minor commit subject tweak]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_heap.c
on/ion_priv.h
on/ion_system_heap.c
b9daf0b60b8a6a5151fca0e8cbb2dab763a3e92a 17-Feb-2014 Colin Cross <ccross@android.com> staging: ion: Move shrinker out of heaps

Every heap that uses deferred frees is going to need a shrinker
to shrink the freelist under memory pressure. Rather than
requiring each heap to implement a shrinker, automatically
register a shrinker if the deferred free flag is set.
The system heap also needs to shrink its page pools, so add
a shrink function to the heap ops that will be called after
shrinking the freelists.

Cc: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Colin Cross <ccross@android.com>
[jstultz: Resolved big conflicts with the shrinker api change.
Also minor commit subject tweak.]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion_heap.c
on/ion_page_pool.c
on/ion_priv.h
on/ion_system_heap.c
2803ac7bf20129365ff7b774adf63e0fd35c4221 17-Feb-2014 Mitchel Humpherys <mitchelh@codeaurora.org> staging: ion: Make sure all clients are exposed in debugfs

Currently, if multiple Ion clients are created with the same name, only
the first one shows up in debugfs. Rectify this by adding a
monotonically-increasing serial number to the debug names of Ion
clients.

Cc: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
[jstultz: Minor commit subject tweaks]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
ae5cbf4a5a117549717d1da12ac1bd84f10dac59 17-Feb-2014 Mitchel Humpherys <mitchelh@codeaurora.org> staging: ion: Store a copy of the client name on client creation

Currently, we copy the pointer passed in to ion_client_create without
making a copy of the string itself. This approach is problematic since
it relies on the client keeping the name string in working order.

Cc: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
[jstultz: Minor commit subject tweaks]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
483ed03f5eee1d1207e8648e923d615ce0599814 17-Feb-2014 Laura Abbott <lauraa@codeaurora.org> staging: ion: Fix debugfs handling of multiple kernel clients

Currently, Ion registers all debugfs entries for clients
via pid. If there are multiple kernel clients, this means
the debugfs entry only gets created for the first one. Fix
this by creating debugfs entries by name always. When
creating user clients, specify the name via the pid.

Cc: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
[jstultz: Minor commit subject tweaks]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
b08585fb92a94eda82d868c4f9bf8ed653badbd0 17-Feb-2014 Mitchel Humpherys <mitchelh@codeaurora.org> staging: ion: Create separate heap and client debugfs directories

It can be slightly annoying to figure out which files under the ion
debugfs directory are heap debug files and which ones are client debug
files. Create separate subdirectories under ion to hold the different
types of debug files.

Cc: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
[jstultz: Minor commit subject tweaks]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
a3e9ddb77e79198bd5114552675be02136e07059 17-Feb-2014 Colin Cross <ccross@android.com> staging: android: Split uapi out of binder.h

Move the userspace interface of binder.h to
drivers/staging/android/uapi/binder.h.

Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Colin Cross <ccross@android.com>
[jstultz: Worked out the collisions from some of the type changes
made upstream. Also minor commit subject tweak]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.h
api/binder.h
64907b94dab947f3f3fc96fe1ab810cbc12ca902 17-Feb-2014 Colin Cross <ccross@android.com> staging: android: split uapi out of sync.h and sw_sync.h

Move the userspace interfaces of sync.h and sw_sync.h to
drivers/staging/android/uapi/

Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Colin Cross <ccross@android.com>
[jstultz: Fixed up some conflicts from upstream spelling fixes]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
w_sync.h
ync.h
api/sw_sync.h
api/sync.h
fe8a78e4ba7946cf04c58c99d16c73af5884b8dd 17-Feb-2014 Colin Cross <ccross@android.com> staging: android: Split uapi out of ashmem.h

Move the userspace interface of ashmem.h to
drivers/staging/android/uapi/ashmem.h

Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Colin Cross <ccross@android.com>
[jstultz: Minor commit message tweak]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
shmem.h
api/ashmem.h
a6b0961963955e575594d1150e24d1451817a334 17-Feb-2014 Colin Cross <ccross@android.com> staging: android: Split uapi out of android_alarm.h

Move the userspace interface of android_alarm.h to
drivers/staging/android/uapi/android_alarm.h

Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Colin Cross <ccross@android.com>
[jstultz: minor commit msg tweak]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ndroid_alarm.h
api/android_alarm.h
6bc2b856bb7c49f238914d965c0b1057ec78226e 14-Feb-2014 Weijie Yang <weijie.yang@samsung.com> staging: android: lowmemorykiller: set TIF_MEMDIE before send kill sig

Set TIF_MEMDIE tsk_thread flag before send kill signal to the
selected thread. This is to fit a usual code sequence and avoid
potential race issue.

Signed-off-by: Weijie Yang <weijie.yang@samsung.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
owmemorykiller.c
393f539c66a60f601effc22d9ad6c316360d791c 10-Feb-2014 Daeseok Youn <daeseok.youn@gmail.com> staging : android : sync : fix a checkpatch warning

- WARNING: missing space after return type

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.h
0204c58e27fdc20275c0652b59a53547aa1ad136 10-Feb-2014 Daeseok Youn <daeseok.youn@gmail.com> staging: android: timed_output: fix a checkpatch warning

- WARNING: Multiple spaces after return type

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
imed_output.h
51108985272c6e1d087bde0822d65921e625f268 10-Feb-2014 Daeseok Youn <daeseok.youn@gmail.com> staging : ion : Fix some checkpatch warnings and an error

Warning:
- Unnecessary space after function pointer name
- quoted string split across lines
- fix alignment issues

Error:
- return is not a function, parentheses are not required

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion_priv.h
a894c69be0566c9a7613468d833efd6303b79d95 08-Feb-2014 SeongJae Park <sj38.park@gmail.com> staging: android: binder: use whitespace consistently

Whitespace between #define keyword and BINDER_* constants are space in
some point and tab in some point. Using space or tab is just writer's
choice. But, let's use them more consistently.

Signed-off-by: SeongJae Park <sj38.park@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.h
7ca363f6872bede71e486352885de3a88f4a3967 08-Feb-2014 Greg Kroah-Hartman <gregkh@linuxfoundation.org> Merge branch 'staging-linus' into staging-work

This is to pull in the lustre fixes so that others can continue to work
on updating the lustre codebase, as well as resolve some merge issues
with the ion and ocproto drivers to keep linux-next happy.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
54de9af9f0d7a91e898b6e02199be16dc26a4870 22-Jan-2014 Dan Carpenter <dan.carpenter@oracle.com> gpu: ion: dereferencing an ERR_PTR

We dereference "heap->task" before checking if it's an ERR_PTR.

Fixes: ea313b5f88ed ('gpu: ion: Also shrink memory cached in the deferred free list')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_heap.c
630127f36784e59e995c206c37825a36a34d346c 20-Jan-2014 Dan Carpenter <dan.carpenter@oracle.com> staging: android: ion: dummy: fix an error code

We should be returning -ENOMEM here instead of zero.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_dummy_driver.c
ab0c069ab59aba0dd21b3e52e81a88f2c21e4448 26-Jan-2014 Sachin Kamat <sachin.kamat@linaro.org> staging: ion: Use PTR_ERR_OR_ZERO

PTR_RET is deprecated. Use PTR_ERR_OR_ZERO instead.
While at it also use PTR_ERR_OR_ZERO in ion.c to simplify
the code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion_heap.c
3a915dd250097ff3c6bb67a57f6b050f805ccdc2 14-Jan-2014 Wei Yongjun <yongjun_wei@trendmicro.com.cn> ion: Fix sparse non static symbol warnings

Fixes the following sparse warnings:

drivers/staging/android/ion/ion_dummy_driver.c:26:19: warning: symbol 'idev' was not declared. Should it be static?
drivers/staging/android/ion/ion_dummy_driver.c:27:17: warning: symbol 'heaps' was not declared. Should it be static?
drivers/staging/android/ion/ion_dummy_driver.c:29:6: warning: symbol 'carveout_ptr' was not declared. Should it be static?
drivers/staging/android/ion/ion_dummy_driver.c:30:6: warning: symbol 'chunk_ptr' was not declared. Should it be static?
drivers/staging/android/ion/ion_dummy_driver.c:32:26: warning: symbol 'dummy_heaps' was not declared. Should it be static?
drivers/staging/android/ion/ion_dummy_driver.c:59:26: warning: symbol 'dummy_ion_pdata' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_dummy_driver.c
ac5b705b22642208764aa784ccc47f093d0212b5 05-Feb-2014 Prakash Kamliya <pkamliya@codeaurora.org> staging: android: sync: Signal pt before sync_timeline object gets destroyed

There is a race condition

Assume we have *one* sync_fence object, with *one* sync_pt
which belongs to *one* sync_timeline, given this condition,
sync_timeline->kref will have two counts, one for sync_timeline
(implicit) and another for sync_pt.

Assume following is the situation on CPU

Theead-1 : (Thread which calls sync_timeline_destroy())
-> (some function calls)
-> sync_timeline_destory()
-> sync_timeline_signal() (CPU is inside this
function after putting reference to sync_timeline)

At this time Thread-2 comes and does following

Thread-2 : (fclose on fence fd)
> sync_fence_release() -> because of fclose() on fence object
-> sync_fence_free()
-> sync_pt_free()
-> kref_put(&pt->parent->kref, sync_timeline_free);
-> sync_timeline_free() (CPU is inside this because
this time kref will be zero after _put)

Thread-2 will free sync_timeline object before Thread-1
has finished its work inside sync_timeline_signal.

With this change we signals all sync_pt before putting
reference to sync_timeline object.

Cc: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Prakash Kamliya <pkamliya@codeaurora.org>
[jstultz: minor commit subject tweak]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
a33b2fc5a9a131eb0a82846f55d7775b28cb2fcb 05-Feb-2014 John Stultz <john.stultz@linaro.org> staging: ion: Fix build warning

Add #include <linux/device.h> to fix the following warning seen
with gcc 4.7.3:

In file included from drivers/staging/android/ion/ion_heap.c:26:0:
drivers/staging/android/ion/ion_priv.h:358:21: warning: ‘struct device’ declared inside parameter list [enabled by default]
drivers/staging/android/ion/ion_priv.h:358:21: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]

Cc: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_priv.h
8666a87611fbd8597111c96e93a2f075664ee392 05-Feb-2014 Laura Abbott <lauraa@codeaurora.org> staging: ion: Fix ION_IOC_FREE compat ioctl

The compat ioctl for ION_IOC_FREE currently passes allocation data
instead of the free data. Correct this.

Cc: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
[jstultz: Folded in a small build fix]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/compat_ion.c
c9e8440eca61298ecccbb27f53036124a7a3c6c8 05-Feb-2014 Colin Cross <ccross@android.com> staging: ion: Fix overflow and list bugs in system heap

Fix a few bugs in ion_system_heap:

Initialize the list node in the info block.

Don't store size_remaining in a signed long, allocating >2GB
could overflow, resulting in a call to sg_alloc_table with
nents=0 which panics. alloc_largest_available will never
return a block larger than size_remanining, so it can never
go negative.

Limit a single allocation to half of all memory. Prevents a
large allocation from taking down the whole system.

Cc: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Colin Cross <ccross@android.com>
[jstultz: Minor commit subject tweak]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
077f6db9731673753ca41a5c3acbb5ead142658a 05-Feb-2014 Todd Poynor <toddpoynor@google.com> staging: ashmem: Avoid deadlock between read and mmap calls

Avoid holding ashmem_mutex across code that can page fault. Page faults
grab the mmap_sem for the process, which are also held by mmap calls
prior to calling ashmem_mmap, which locks ashmem_mutex. The reversed
order of locking between the two can deadlock.

The calls that can page fault are read() and the ASHMEM_SET_NAME and
ASHMEM_GET_NAME ioctls. Move the code that accesses userspace pages
outside the ashmem_mutex.

Cc: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
[jstultz: minor commit message tweaks]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
shmem.c
5cf045f54d31894ec59ee741e01fa258be2ba0fb 05-Feb-2014 Alistair Strachan <alistair.strachan@imgtec.com> staging: sync: Fix a race condition between release_obj and print_obj

Before this change, a timeline would only be removed from the timeline
list *after* the sync driver had its release_obj() called. However, the
driver's release_obj() may free resources needed by print_obj().

Although the timeline list is locked when print_obj() is called, it is
not locked when release_obj() is called. If one CPU was in print_obj()
when another was in release_obj(), the print_obj() may make unsafe
accesses.

It is not actually necessary to hold the timeline list lock when calling
release_obj() if the call is made after the timeline is unlinked from
the list, since there is no possibility another thread could be in --
or enter -- print_obj() for that timeline.

This change moves the release_obj() call to after the timeline is
unlinked, preventing the above race from occurring.

Cc: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Alistair Strachan <alistair.strachan@imgtec.com>
[jstultz: minor commit subject tweak]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
bbd9ae8a05e05a608ff9158cf3b95be7b857a6fa 05-Feb-2014 Greg Hackmann <ghackmann@google.com> staging: sw_sync: Add stubs for kernels without CONFIG_SW_SYNC

Add stubs for kernels without CONFIG_SW_SYNC

Cc: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Greg Hackmann <ghackmann@google.com>
[jstultz: resolved minor conflict, tweaked commit message]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
w_sync.h
102f1a2a496a76f16675ee4bf13e2a5e512c447e 21-Jan-2014 Paul Gortmaker <paul.gortmaker@windriver.com> staging: don't use module_init in non-modular ion_dummy_driver.c

The ION_DUMMY option is bool, and hence this code is either
present or absent. It will never be modular, so using
module_init as an alias for __initcall is rather misleading.

Fix this up now, so that we can relocate module_init from
init.h into module.h in the future. If we don't do this, we'd
have to add module.h to obviously non-modular code, and that
would be a worse thing.

Note that direct use of __initcall is discouraged, vs. one
of the priority categorized subgroups. As __initcall gets
mapped onto device_initcall, our use of device_initcall
directly in this change means that the runtime impact is
zero -- it will remain at level 6 in initcall ordering.

Cc: Colin Cross <ccross@android.com>
Cc: Jesse Barker <jesse.barker@arm.com>
Cc: Android Kernel Team <kernel-team@android.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_dummy_driver.c
18691f53bcaab1226f22b733189ec9da190bb7a2 22-Jan-2014 Tomas Winkler <tomas.winkler@intel.com> ion: dummy driver: use ARRAY_SIZE for nr of heaps

use ARRAY_SIZE to count number of heaps in static array

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_dummy_driver.c
10f6f9c38a422451989eb4e36a14788b1799b491 18-Jan-2014 Chen Gang <gang.chen.5i5j@gmail.com> drivers: staging: android: ion: ion_dummy_driver: include "linux/io.h"

Need add "linux/io.h" to pass compiling under metag architecture with
allmodconfig (which use the default 'virt_to_phys'), the related error:

CC drivers/staging/android/ion/ion_dummy_driver.o
drivers/staging/android/ion/ion_dummy_driver.c: In function 'ion_dummy_init':
drivers/staging/android/ion/ion_dummy_driver.c:81: error: implicit declaration of function 'virt_to_phys'

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_dummy_driver.c
4c45b1a80ee9c85aee13445b85fd55541ec26d27 10-Jan-2014 John Stultz <john.stultz@linaro.org> ion: Add carveout and chunk heaps to dummy driver

Add support to the dummy driver for basic carveout and chunk heaps.

Since we're generating these heaps at module_init, and we want
this driver to be generic enough to be tested on any arch, we
don't have the ability to alloc bootmem, so both of these heaps
are conventionally allocated using alloc_pages(), which limits us
to 4M in size.

Should look into using CMA for heap allocation eventually, but
this provides enough to test the basic functionality of the
heaps.

Cc: Colin Cross <ccross@android.com>
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Jesse Barker <jesse.barker@arm.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_dummy_driver.c
1184ead84d6c1019f5c1d31a73ef3bace90fb54a 10-Jan-2014 John Stultz <john.stultz@linaro.org> ion: Add dummy driver for testing

Provide a basic dummy driver to register the ion device
and to install basic SYSTEM and SYSTEM_CONTIG heaps.

This allows for basic testing with ION without having
access to drivers or systems that have been enabled to use
ION.

Cc: Colin Cross <ccross@android.com>
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Jesse Barker <jesse.barker@arm.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/Kconfig
on/Makefile
on/ion_dummy_driver.c
07300f43d63d31294ee22b0d53091a8aec4cbc2d 20-Dec-2013 John Stultz <john.stultz@linaro.org> ion_test: Add compat_ioctl support (v2)

Prior to subitting this, Colin reworked the compat_ioctl support
for the ion_test driver, moving the structure to be the same size
on both 32 and 64 bit architectures.

Two small things were left out. The compat_ioctl ptr assignment,
and the fact that despite having uniform sized types in the
structure, the structure pads out to different sizes on different
arches.

This patch resolves this issue by adding a padding entry after
the write flag, and adding the compat_ioctl ptr.

Changes in v2:
- Add a padding int rather then making write a u64

Acked-by: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_test.c
api/ion_test.h
6a72a700f44b2fa1b1d6f3529e5d492a4f71de49 18-Dec-2013 John Stultz <john.stultz@linaro.org> staging: ion: Avoid using rt_mutexes directly

RT_MUTEXES can be configured out of the kernel, causing compile
problems with ION.

To quote Colin:
"rt_mutexes were added with the deferred freeing feature. Heaps need
to return zeroed memory to userspace, but zeroing the memory on every
allocation was causing performance issues. We added a SCHED_IDLE
thread to zero memory in the background after freeing, but locking the
heap from the SCHED_IDLE thread might block a high priority allocation
thread for a long time.

The lock is only used to protect the heap's free_list and
free_list_size members, and is not held for any long or sleeping
operations. Converting to a spinlock should prevent priority
inversion without using the rt_mutex. I'd also rename it to free_lock
to so it doesn't get used as a general heap lock."

Thus this patch converts the rt_mutex usage to a spinlock and
renames the lock free_lock to be more clear as to its use.

I also had to change a bit of logic in ion_heap_freelist_drain()
to safely avoid list corruption.

Acked-by: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Reported-by: Jim Davis <jim.epost@gmail.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_heap.c
on/ion_priv.h
f4ea823be2ca9e61522de002804c9a7a54c9be16 17-Dec-2013 John Stultz <john.stultz@linaro.org> staging: ion: Fix possible null pointer dereference

The kbuild test robot reported:

drivers/staging/android/ion/ion_system_heap.c:122 alloc_largest_available() error: potential null dereference 'info'. (kmalloc returns null)

Where the pointer returned from kmalloc goes unchecked for failure.

This patch checks the return for NULL, and reworks the logic, as
suggested by Colin, so we allocate the page_info structure first.

Acked-by: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
679bcc935c4ed45e3f9c56f5d0c766b0844c93a9 17-Dec-2013 John Stultz <john.stultz@linaro.org> staging: ion: Add HAVE_MEMBLOCK config dependency

The kbuild test robot reported a build issue w/ ION on m68k:

drivers/staging/android/ion/ion.c: In function 'ion_reserve':
drivers/staging/android/ion/ion.c:1526:4: error: implicit declaration of function 'memblock_alloc_base' [-Werror=implicit-function-declaration]
drivers/staging/android/ion/ion.c:1528:11: error: 'MEMBLOCK_ALLOC_ANYWHERE' undeclared (first use in this function)
drivers/staging/android/ion/ion.c:1528:11: note: each undeclared identifier is reported only once for each function it appears in
drivers/staging/android/ion/ion.c:1537:4: error: implicit declaration of function 'memblock_reserve' [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors

This is caused by ION using memblock functionality which m68k doesn't support.

This patch adds a HAVE_MEMBLOCK dependency to the ION config.

Acked-by: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/Kconfig
1be544cdb92954e7d73ce09f0681d9f8b6f5c3c6 17-Dec-2013 Wei Yongjun <yongjun_wei@trendmicro.com.cn> gpu: ion: fix sparse non static symbol warnings

Fixes the following sparse warnings:

drivers/staging/android/ion/tegra/tegra_ion.c:23:19: warning:
symbol 'idev' was not declared. Should it be static?
drivers/staging/android/ion/tegra/tegra_ion.c:24:19: warning:
symbol 'tegra_user_mapper' was not declared. Should it be static?
drivers/staging/android/ion/tegra/tegra_ion.c:25:5: warning:
symbol 'num_heaps' was not declared. Should it be static?
drivers/staging/android/ion/tegra/tegra_ion.c:26:17: warning:
symbol 'heaps' was not declared. Should it be static?
drivers/staging/android/ion/tegra/tegra_ion.c:28:5: warning:
symbol 'tegra_ion_probe' was not declared. Should it be static?
drivers/staging/android/ion/tegra/tegra_ion.c:66:5: warning:
symbol 'tegra_ion_remove' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/tegra/tegra_ion.c
d4ed510a4ce84b656891f617e22d4a79a99af0c1 17-Dec-2013 Wei Yongjun <yongjun_wei@trendmicro.com.cn> gpu: ion: use module_platform_driver to simplify the code

module_platform_driver() makes the code simpler by eliminating
boilerplate code.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/tegra/tegra_ion.c
0462e185caa11b38bf27f77234a8e2c3e02a35c7 17-Dec-2013 Colin Cross <ccross@android.com> ion: remove ion_user_handle_t from ion_test.h

ion_test.h should not define ion_user_handle_t, and defining it
causes a warning:
In file included from drivers/staging/android/ion/ion_test.c:31:
drivers/staging/android/ion/../uapi/ion_test.h:23: error: redefinition of typedef 'ion_user_handle_t'
drivers/staging/android/ion/../uapi/ion.h:23: note: previous declaration of 'ion_user_handle_t' was here

Reported-by: Andrew Morton <akpm@linux-foundation.org>
Cc: John Stultz <john.stultz@linaro.org>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
api/ion_test.h
24b3aa09970304ece816e73c3d7174d0dd315b98 14-Dec-2013 John Stultz <john.stultz@linaro.org> ion: Reenable the build

Now that ION builds, reenable it in the build.

Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
akefile
968141d2541fea22f921bf643636b3b51177336c 14-Dec-2013 John Stultz <john.stultz@linaro.org> ion: Don't allow building ION as a module.

ION doesn't export the proper symbols for it to be a module. This
causes build issues when ION is configured as a module.

Since Andorid kernels rarely use modules (I think recent policy
requires no modules?), go ahead and set the ION config to a bool
from the tristate option.

If folks decide ION as a module is important, we will have to go
through and export the various needed symbols.

Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/Kconfig
b1aced6f2dfd8c11a36643b020aa8d7040eb0557 14-Dec-2013 John Stultz <john.stultz@linaro.org> ion: Update system heap shrinker to use the new count/scan interface

Update the ION system heap shrinker to use the new count/scan
interfaces that landed in 3.12

Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
024789ae3b5517de151032623d1534aae804236b 14-Dec-2013 John Stultz <john.stultz@linaro.org> ion: Improve ION config description

Mostly just to quiet checkpatch warnings, be more verbose
in describing the ION config option.

Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/Kconfig
e1d855b02f5ac4c3a6cbeaa253958b2708826b9f 14-Dec-2013 John Stultz <john.stultz@linaro.org> ion: Cleanup whitespace issues and other checkpatch problems

Just some simple cleanups to address whitespace issues and
other issues found w/ checkpatch.

Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/compat_ion.c
on/ion.c
on/ion.h
on/ion_chunk_heap.c
on/ion_heap.c
on/ion_page_pool.c
on/ion_priv.h
on/ion_system_heap.c
661f82f6c219dc515ee5123213d8f57481694fe4 14-Dec-2013 Colin Cross <ccross@android.com> ion: fix bugs in cma heap

Implement ion_cma_unmap_kernel, ion will call it unconditionally.
Use correct gfp flags when calling dma_alloc_coherent so it doesn't
try to use atomic DMA memory.
Check for invalid alignment when allocating.
Reject cached allocations - the cpu address returned by
dma_alloc_coherent is always going to be an uncached mapping, so
map_kernel will not see data written by a cached userspace mapping.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_cma_heap.c
dd608dd29a417da78f6aa1715efb9786787c550e 14-Dec-2013 Colin Cross <ccross@android.com> ion: add alignment check to chunk heap

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_chunk_heap.c
df6cf5c8af54e3e89643511272f6f5f5cfb71a7d 14-Dec-2013 Colin Cross <ccross@android.com> ion: add helper to zero contiguous region of pages

Add ion_heap_pages_zero for ion heaps to use to zero pages
during initialization or allocation, when a struct ion_buffer
may not be available. Use it from the chunk heap and carveout
heaps.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_carveout_heap.c
on/ion_chunk_heap.c
on/ion_heap.c
on/ion_priv.h
ed5bf01aac7a524a1ca05f96947aeba8363cb669 14-Dec-2013 Colin Cross <ccross@android.com> ion: carveout heap: zero buffers on free, fix memory leak

The carveout heap wasn't zeroing its buffers after use.
Create the sg_table during allocate instead of map_dma, to allow
using the sg_table during free, and call ion_heap_buffer_zero
during free. Also fixes a missing kfree when destroying the
table.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_carveout_heap.c
f63958d80c07c04db48812d97ff7450517d80ffa 14-Dec-2013 Colin Cross <ccross@android.com> ion: fix sparse warnings

Fix sparse warnings in ion.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion_carveout_heap.c
on/ion_chunk_heap.c
on/ion_cma_heap.c
on/ion_heap.c
on/ion_page_pool.c
on/ion_system_heap.c
5c6a470557e51bb4e868c22450811726c32f5787 14-Dec-2013 Colin Cross <ccross@android.com> ion: use alloc_pages in system contig heap

There is no reason to use kzalloc, just call alloc_pages directly.
Change the GFP from GFP_KERNEL to include __GFP_HIGH, to allow it
to return contiguous pages from highmem. virt_to_* functions
aren't valid on highmem pages, so store the struct page * in an
sg_table in buffer->priv_virt like most other heaps, and replace
virt_to_* with page_to_*.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
a053b6ace160a7751fc53326bb354266e3e914f0 14-Dec-2013 Colin Cross <ccross@android.com> ion: allow cached mappings of chunk and system heap buffers

Now that ion_vm_fault uses vm_insert_pfn instead of vm_insert_page
cached buffers can be supported in any heap. Remove the checks
in the chunk and system heaps.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_chunk_heap.c
on/ion_system_heap.c
a3056906bfb98d10618122bc2ba7d142a61fcaf1 14-Dec-2013 Colin Cross <ccross@android.com> ion: remove ion_heap_alloc_pages

Now that ion_vm_fault doesn't need a struct page with a nonzero
refcount, there is no need allocate heap memory for cached pages using
split_page. Remove the ion_heap_alloc_pages and ion_heap_free_pages
helpers in favor of direct calls to alloc_pages and __free_pages,
and remove the special handling in the system heap.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_heap.c
on/ion_priv.h
on/ion_system_heap.c
462be0c616c297776556b24daa1511bcc0e0cd2c 14-Dec-2013 Colin Cross <ccross@android.com> ion: use vm_insert_pfn for faulted pages

Most ion userspace mappings are created with remap_pfn_range. Use
vm_insert_pfn instead of vm_insert_page to make faulted cached
mappings look more like uncached mappings.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
e460bc5e43f0750c8bdb6967058ed4f18e92812c 14-Dec-2013 Colin Cross <ccross@android.com> ion: check return value from remap_pfn_range

Check the return value of remap_pfn_range and return an error if
it fails.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_heap.c
ce3d10933a3e2e1d2cb3b9ae91b6b945f189bb90 14-Dec-2013 Colin Cross <ccross@android.com> ion: free low memory from page pools first

When the shrinkers are called with GFP_HIGH free low memory first,
it is more important to have free than high memory.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_page_pool.c
8b312bb9a795c9c07661aee7b694cbfd3217e25c 14-Dec-2013 Colin Cross <ccross@android.com> ion: optimize ion_heap_buffer_zero

ion_heap_buffer_zero can spend a long time in unmap_kernel_range
if it has to broadcast a tlb flush to every cpu for every page.
Modify it to batch pages into a larger region to clear using a
single mapping. This may cause the mapping size to change if
the buffer size is not a multiple of the mapping size, so
switch to allocating the address space for each chunk. This
allows us to use vm_map_ram to handle the allocation and mapping
together.

The number of pages to zero using a single mapping is set to 32
to hit the fastpath in vm_map_ram.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_heap.c
f0f06763820e5b5f6e13afa814e68e8f4d955c45 14-Dec-2013 Colin Cross <ccross@android.com> ion: add alignment check to carveout heap

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_carveout_heap.c
797e88be2f3e928fe5d8498f42a65a6e77b09c29 14-Dec-2013 Colin Cross <ccross@android.com> ion: drop dependency on ARM

Ion will compile and run on other platforms now, remove the
dependency on ARM.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/Kconfig
ea725ec8b1d2a5f6a46dd45174fcd6a5f8c9dd5b 14-Dec-2013 John Stultz <john.stultz@linaro.org> ion: Fix two small issues in system_heap allocation

In testing ion system heap allocations, I ran across two issues:

1) Not k*z*allocing the sg table. This can cause trouble if
we end up trying call sg_alloc_table() with too many entries,
then sg_alloc_table() internally fails and tries to free what it
thinks is internal table structure, which causes bad pointer
traversals.

2) The second list_for_each_entry probably should be _safe,
since I was seeing strange lock warnings and oopses on occasion.
This seems to resolve it, but could use some extra checking.

Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
f020b4430bf29a25229fd9975662baefb02facda 14-Dec-2013 Mitchel Humpherys <mitchelh@codeaurora.org> gpu: ion: fix use-after-free in ion_heap_freelist_drain

The `buffer' variable is being used after being freed. Fix this.

Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_heap.c
db866e3ded294aac1059d45d6497cf1bdbebaa04 14-Dec-2013 Colin Cross <ccross@android.com> ion: clean up ioctls

Convert the ion ioctls to use _IOW instead of _IOWR where
appropriate, and factor out the copy_from_user and copy_to_user
based on the _IOC_DIR bits. For the existing incorrect ioctls,
add a function to wrap _IOC_DIR to return the corrected value.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
a82130f470893c4a5be3e3cfcdc72c427a41b630 14-Dec-2013 Colin Cross <ccross@android.com> gpu: ion: remove unnecessary function from system heap

ion_system_contig_heap buffers have an sglist, just call
ion_heap_map_user to map it.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
e61fc915fa8c6991f0ed14ce70a0a3c139012684 14-Dec-2013 Colin Cross <ccross@android.com> ion: fix printk warnings

Use %z for size_t and %pa for dma_addr_t to avoid warnings in printks.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion_chunk_heap.c
on/ion_cma_heap.c
on/ion_heap.c
1d804535c37cb669334781afdbc2987284621623 14-Dec-2013 Colin Cross <ccross@android.com> ion: don't use phys_to_page or __phys_to_pfn

phys_to_page and __phys_to_pfn don't exist on all platforms.
Use a combination of pfn_to_page, PFN_DOWN, page_to_pfn, and
virt_to_page to get the same results.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_carveout_heap.c
on/ion_chunk_heap.c
on/ion_system_heap.c
8be3759a5e4ed91ffbe24d98b33a71f651cb3f9b 13-Dec-2013 Colin Cross <ccross@android.com> ion: don't use __arm_ioremap to map pages

ion_heap_map_kernel already implements mapping a scatterlist of
pages into the kernel, and all heaps are required to have struct
pages associated with them, so delete the functions that use
__arm_ioremap and use ion_heap_map_kernel instead.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_carveout_heap.c
on/ion_chunk_heap.c
b26661d1f6a1f94c11a12fef85cd2e942888310e 13-Dec-2013 Colin Cross <ccross@android.com> ion: update idr to avoid deprecated apis

Use idr_alloc instead if idr_pre_get/idr_get_new_above, and
remove idr_remove_all.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
ceff95d49cc3e28c06c2352e8d94f56046271aeb 13-Dec-2013 Colin Cross <ccross@android.com> ion: add test device for unit tests to interact with dma_bufs

Add a /dev/ion-test device that will be created if CONFIG_ION_TEST
is set. The device accepts a dma_buf fd and allows reading and
writing to the backing memory using DMA-like apis or kernel mapping
apis. Can be used to test the dma_buf mapping ops, including
the ion implementations, from userspace.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/Kconfig
on/Makefile
on/ion_test.c
api/ion_test.h
c13d1df947f1c312143eda77a754149d0043e4d3 13-Dec-2013 Colin Cross <ccross@android.com> ion: check invalid values in ion_system_heap

ion_system_heap can only satisfy page alignment, and
ion_system_contig_heap can only satisify alignment to the
allocation size. Neither can support faulting user mappings
because they use slab pages.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
06e0dcaeb4fd72a010a1f5ad0c03abd8e0a58ef9 13-Dec-2013 Colin Cross <ccross@android.com> ion: convert sg_dma_len(sg) to sg->length

ion is always dealing with the allocation and not the mapping,
so it should always be using sg->length and not sg->dma_length.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion_chunk_heap.c
on/ion_heap.c
on/ion_system_heap.c
e946b209c2ed15b1f7917def8fe6602747c3f771 13-Dec-2013 Colin Cross <ccross@android.com> ion: fix dma APIs

__dma_page_cpu_to_dev is a private ARM api that is not available
on 3.10 and was never available on other architectures. We can
get the same behavior by calling dma_sync_sg_for_device with a
scatterlist containing a single page. It's still not quite a
kosher use of the dma apis, we still conflate physical addresses
with bus addresses, but it should at least compile on all
platforms, and work on any platform that doesn't have a physical
to bus address translation.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion_chunk_heap.c
on/ion_page_pool.c
on/ion_priv.h
on/ion_system_heap.c
a14baf71b91845a7f68438d48f462cb754699ae2 13-Dec-2013 Colin Cross <ccross@android.com> ion: fix crash when alloc len is -1

If userspace passes a length between -4095 and -1 to allocate it
will pass the len != 0 check, but when len is page aligned it will
be 0. Check len after page aligning.

Drop the warning as well, userspace shouldn't be able to trigger
a warning in the kernel.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
83271f6262c91a49df325c52bec8f00f4de294ca 13-Dec-2013 Colin Cross <ccross@android.com> ion: hold reference to handle after ion_uhandle_get

commit 1262ab1846cf76f7549c66ef709120dbfbe6d49f (ion: replace
userspace handle cookies with idr) broke the locking in ion.
The ION_IOC_FREE and ION_IOC_MAP ioctls were relying on
ion_handle_validate to detect the case where a call raced
with another ION_IOC_FREE which may have freed the struct
ion_handle.

Rename ion_uhandle_get to ion_handle_get_by_id, and have it
take the client lock and return with an extra reference to
the handle. Make each caller put its reference once it
is done with the handle.

Also modify users of ion_handle_validate to continue to hold
the client lock after calling ion_handle_validate until
they are done with the handle, and warn if ion_handle_validate
is called without the client lock held.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
687258f7c89107154ed8d7967e0ad47e0f6f679f 13-Dec-2013 John Stultz <john.stultz@linaro.org> ion: Fix compat support to use proper compat ioctl numbers

The compat support added to ion didn't provide compat ioctl numbers
(who's value depends on the compat structure size). So 32bit
applications would get an error when trying to make ioctl calls.

This patch adds the needed COMPAT_ macros and uses them in the
compat_ion_ioctl, translating them to their non-compat cmd when
calling the normal ioctl call.

Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/compat_ion.c
c3a2fe03148f13b119c7bf0427a0526bdb288a92 13-Dec-2013 Colin Cross <ccross@android.com> ion: move userspace api into uapi/ion.h

Split the userspace api out of drivers/staging/android/ion/ion.h
into drivers/staging/android/uapi/ion.h

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/compat_ion.c
on/ion.h
api/ion.h
9e57e108d2c140909fa81e7a7c1498e23bb32b41 13-Dec-2013 Colin Cross <ccross@android.com> gpu: ion: delete ion_system_mapper.c

The mapper abstraction layer was removed before the initial ion
commit, but a stray ion_system_mapper.c file was left in. Delete
it.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_mapper.c
827c849e37b71cb6396d56096ad497748bbbe98f 13-Dec-2013 Rom Lemarchand <romlem@google.com> ion: add compat_ioctl

Add a compat_ioctl to the ion driver

Signed-off-by: Rom Lemarchand <romlem@google.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/Makefile
on/compat_ion.c
on/compat_ion.h
on/ion.c
b88fa7319ef3c77478d732fab2f6750c305c1873 13-Dec-2013 Rom Lemarchand <romlem@google.com> ion: change ion_user_handle_t definition to int

Turn ion_user_handle_t to int. This change reflects the underlying type
returned by the ion driver.

Signed-off-by: Rom Lemarchand <romlem@google.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion.h
22b7f24d6131ac4cbbf03f7a81000942e74fcd49 13-Dec-2013 Rom Lemarchand <romlem@google.com> ion: add new ion_user_handle_t type for the user-space token

Declare new ion_user_handle_t type to contain the token returned to user-space.
This allows a 2-step migration of the user-space code to a new kernel header
first, then will allow us to change the definition of the ion_user_handle_type_t
to int without breaking the API.

Signed-off-by: Rom Lemarchand <romlem@google.com>
(cherry picked from commit ebb8269bbb05b06ecedca3e21b3e65f23d48eadd)
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion.h
b4f8d242c6fb5e631ba861c1a6024ae14b02f5a8 13-Dec-2013 Colin Cross <ccross@android.com> ion: don't use id 0 for handle cookie

ion userspace clients think that the cookie is a pointer, so they
use NULL to check if the handle has been initialized. Set the first
id number to 1.

Signed-off-by: Colin Cross <ccross@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
e1cf36823407751d1ad1168bc718cf5a0ac5dbf4 13-Dec-2013 Colin Cross <ccross@android.com> ion: index client->handles rbtree by buffer

The only remaining users of the client->handles rbtree are
iterating through it like a list. Keep the rbtree, but change
its index to be the buffer address instead of the handle address,
which makes ion_handle_lookup a fast rbtree search.

Signed-off-by: Colin Cross <ccross@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
47b404580bd92ec8dd3e691020bd515f6af262af 13-Dec-2013 Colin Cross <ccross@android.com> ion: replace userspace handle cookies with idr

Userspace handles should not leak kernel virtual addresses to
userspace. They have to be validated by looking them up in an
rbtree anyways, so replace them with an idr and validate them
by using idr_find to convert the id number to the struct
ion_handle pointer.

Signed-off-by: Colin Cross <ccross@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
9e907654d3c0ff58fb27b51d94128a9749c7e85c 13-Dec-2013 Colin Cross <ccross@android.com> ion: remove IS_ERR_OR_NULL

IS_ERR_OR_NULL is often part of a bad pattern that can accidentally
return 0 on error:
if (IS_ERR_OR_NULL(ptr))
return PTR_ERR(ptr);

It also usually means that the errors of a function are not well
defined. Replace all uses in ion.c by ensure that the return
type of any function in ion is an ERR_PTR.

Specify that the expected return value from map_kernel or map_dma
heap ops is ERR_PTR, and warn if a heap returns NULL.

Signed-off-by: Colin Cross <ccross@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion_priv.h
dfc4a9b1769095d8125a56e5515f6728c9f137c0 13-Dec-2013 Colin Cross <ccross@android.com> ion: convert map_kernel to return ERR_PTR

ion is going to stop accepting NULL as an error value, use ERR_PTR.

Signed-off-by: Colin Cross <ccross@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_carveout_heap.c
on/ion_heap.c
2540c73a5bf068b8c1c092fc3ce63c62ba949371 13-Dec-2013 Colin Cross <ccross@android.com> ion: add free list size to heap debug files

Signed-off-by: Colin Cross <ccross@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
ea89faff84e35c7a5b386f158b5aec0c6327441c 13-Dec-2013 Colin Cross <ccross@android.com> ion: chunk_heap: fix leak in allocated counter

buffer->size is controlled by the outer ion layer, don't modify it
inside the heap. Instead, compute the rounded up allocated size
on demand.

Signed-off-by: Colin Cross <ccross@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_chunk_heap.c
c13bd1c4eb714c08214e897fcbe51b13e0e0f279 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Fix performance issue in faulting code

Previously the code to fault ion buffers in one page at a time had a
performance problem caused by the requirement to traverse the sg list
looking for the right page to load in (a result of the fact that the items in
the list may not be of uniform size). To fix the problem, for buffers
that will be faulted in, also keep a flat array of all the pages in the buffer
to use from the fault handler. To recover some of the additional memory
footprint this creates per buffer, dirty bits used to indicate which
pages have been faulted in to the cpu are now stored in the low bit of each
page struct pointer in the page array.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion_cma_heap.c
on/ion_heap.c
on/ion_priv.h
on/ion_system_heap.c
349c9e13855109df99c5205a4e8d53d9fa169490 13-Dec-2013 Benjamin Gaignard <benjamin.gaignard@linaro.org> gpu: ion: add CMA heap

New heap type ION_HEAP_TYPE_DMA where allocation is done with dma_alloc_coherent API.
device coherent_dma_mask must be set to DMA_BIT_MASK(32).
ion_platform_heap private field is used to retrieve the device linked to CMA,
if NULL the default CMA area is used.
ion_cma_get_sgtable is a copy of dma_common_get_sgtable function which should
be in kernel 3.5

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/Makefile
on/ion.h
on/ion_cma_heap.c
on/ion_heap.c
on/ion_priv.h
19007b1420ba6f780621aa2e710c44881e8be983 13-Dec-2013 Benjamin Gaignard <benjamin.gaignard@linaro.org> gpu: ion: fix ion_platform_data definition

fix ion_platform_heap to make is use an usual way in board configuration file.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.h
d1cf3e98d9777877df7aefe402ed99b68620e354 13-Dec-2013 John Stultz <john.stultz@linaro.org> ion: Add Kconfig dependency to ARM

The ion code has some very specific arm-isms which keeps it
from building on other architectures. These should probably be
resolved, but in the mean time, add a dependency on CONFIG_ARM
to avoid build failures.

v2: Fix earlier flub, sending out an early untested version of
the patch.

Cc: Arve Hjønnevåg <arve@android.com>
Cc: Rebecca Schultz Zavin <rebecca@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/Kconfig
1584f40ff0b8f2d1b42a4353f3a27b0c1f8545a5 13-Dec-2013 Arve Hjønnevåg <arve@android.com> gpu: ion: Remove __GFP_NO_KSWAPD

It no longer exists.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
def5c4926b3f691dfbcef39a94f206c0f0f3a92f 13-Dec-2013 Arve Hjønnevåg <arve@android.com> gpu: ion: __dma_page_cpu_to_dev -> arm_dma_ops.sync_single_for_device hack

Signed-off-by: Arve Hjønnevåg <arve@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_chunk_heap.c
on/ion_page_pool.c
on/ion_system_heap.c
ea313b5f88ed7119f79ad3f6b85e9620971b9875 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Also shrink memory cached in the deferred free list

When the system is low on memory, we want to shrink any cached
system memory ion is holding. Previously we were shrinking memory
in the page pools, but not in the deferred free list. This patch
makes it possible to shrink both. It also moves the shrinker
code into the heaps so they can correctly manage any caches they
might contain.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion_heap.c
on/ion_page_pool.c
on/ion_priv.h
on/ion_system_heap.c
da4aab37836b8e45e31c7d557c6d6a2c623d8eea 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Fix bug in ion shrinker

The high variable was sometimes used uninitialized

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_page_pool.c
57b5cd067fc713433e75688348832e2e2f82b843 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: ion_chunk_heap: Zero chunk heap memory at creation time

Allocations from the ion heap need to be zeroed to protect userspace
from seeing memory belonging to other processes. First allocations
from this heap were not zero'd allowing users to see memory from other
processes on a warm reset.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_chunk_heap.c
e09539a04285b616ebcc50f2f6b75ad7fbb0aec5 13-Dec-2013 JP Abgrall <jpa@google.com> gpu: ion: fix kfree/list_del order

With CONFIG_SLUB_DEBUG_ON it would panic during
ion_alloc()
ion_buffer_create()
io_heap_drain_freelist()

Signed-off-by: JP Abgrall <jpa@google.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
fe2faea7003516dd615812f663b6a9b141b842ce 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Make ion_free asynchronous

Add the ability for a heap to free buffers asynchrounously. Freed buffers
are placed on a free list and freed from a low priority background thread.
If allocations from a particular heap fail, the free list is drained. This
patch also enable asynchronous frees from the chunk heap.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion.h
on/ion_chunk_heap.c
on/ion_priv.h
on/ion_system_heap.c
22ba43220b594983c18394442e58ed4988893de6 13-Dec-2013 Johan Mossberg <johan.mossberg@stericsson.com> gpu: ion: Add support for sharing buffers with dma buf kernel handles

Currently ion can only share buffers with dma buf fd's. Fd's can not be
used inside the kernel as they are process specific so support for
sharing buffers with dma buf kernel handles is needed to support kernel
only use cases. An example use case could be a GPU driver using ion
that wants to share its output buffers with a 3d party display
controller driver supporting dma buf.

Signed-off-by: Johan Mossberg <johan.mossberg@stericsson.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion.h
88d4bda8807d846cc31e13ee58a28c7c0d3afbd0 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Only flush buffers in the chunk heap if they were used cached

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_chunk_heap.c
0b6b2cde0928707a618ce8c07970219f21d066e5 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Refactor the code to zero buffers

Refactor the code in the system heap used to map and zero the buffers
into a seperate utility so it can be called from other heaps. Use it from
the chunk heap.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_chunk_heap.c
on/ion_heap.c
on/ion_priv.h
on/ion_system_heap.c
77cbe828a10026f8ff208eaa67d75675a3ffbdfc 13-Dec-2013 Rebecca Schultz Zavin <rschultz@google.com> gpu: ion: Modify zeroing code so it only allocates address space once

vmap/vunmap spend a significant amount of time allocating the
address space to map into. Rather than allocating address space
for each page, instead allocate once for the entire allocation
and then just map and unmap each page into that address space.

Signed-off-by: Rebecca Schultz Zavin <rschultz@google.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
2bb9f5034ec75ea40068e4a462cde882ce9f5a1e 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Remove heapmask from client

The heapmask in the client generally wasn't being used. This
patch removes it.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion.h
9122fe867de6d0c4021c208b18612166931b5487 13-Dec-2013 Johan Mossberg <johan.mossberg@stericsson.com> gpu: ion: Export ion_client_create

Will enable modules to allocate memory with ion.

Signed-off-by: Johan Mossberg <johan.mossberg@stericsson.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
38eeeb51245c88d2be9bd098bcc32b15f6014bfa 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Clarify variable names and comments around heap ids v types

There is some confusion between when to use the heap type and when
the id. This patch clarifies this by using clearer variable names
and describing the intention in the comments. Also fixes the client
debug code to print heaps by id instead of type.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion.h
e3c2eb7cd9f291bf17ee056e388d0089cf378345 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Add chunk heap

This patch adds support for a chunk heap that allows for buffers that are
made up of a list of fixed size chunks taken from a carveout. Chunk sizes
are configured when the heaps are created by passing the chunk size in the
priv field of the heap platform data.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/Makefile
on/ion.h
on/ion_chunk_heap.c
on/ion_heap.c
on/ion_priv.h
8898227ed555b477e2989a2a9b984fa37e7a9b42 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Refactor common mapping functions out of system heap

The system heap contained several general purpose functions to map
buffers to the kernel and userspace. This patch refactors those
into ion_heap.c so they can be used by other heaps.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_heap.c
on/ion_priv.h
on/ion_system_heap.c
cd69488c7be3abb0767b49f313b12b8591abe5dc 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Switch heap rbtree to a prio list

Switches the rbtree tree of heaps for a plist. This significantly
simplifies the code and the list is small and is modified only at
first boot so the rbtree is unnecessary. This also switches
the traversal of the heap list to traverse from highest to lowest
id's. This allows allocations to pass a heap mask that falls
back on the system heap -- typically id 0, which is the common case.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion_priv.h
df0f6c7634f0856c3eb3d26ddc909d414199f6a7 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Fix bug where MAP ioctl was no longer supported

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
fa9bba557dd3cd3d9188541cf309f5c71486d8a6 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Modify reserve function for carveouts with no start address

This patch allows you to specify a heap that requires carveout memory
but that doesn't specify a start address. Memblock_alloc will be called
to find a location for these heaps.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
092c354b8a2e590b028957e68ad38c69b21cadd8 13-Dec-2013 Benjamin Gaignard <benjamin.gaignard@linaro.org> gpu: ion: fix compilation warning

use atomic_read to get the refcount value to avoid compilation warning

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
caaf3f12970057b32176eb333a1bfc3c6f67cbdd 13-Dec-2013 Benjamin Gaignard <benjamin.gaignard@linaro.org> gpu: ion: fix carveout ops

when using carveout heap ion_buffer_create function failed because
map_dma and unmap_dma operations aren't set by carveout heap.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_carveout_heap.c
4f597eac2cecf49eab3d0be02d17887f04d95c39 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Fix bug in zeroing pages in system heap

Pages are zeroed for security purposes when returned to the
ion heap. There was a bug in this code preventing this
from happening.

Bug: 7573871
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
b308a7c5cfef6e0d15b8872982645313f415b229 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Fix bug in ion_system_heap map_user

When the requested mmap length was not an integer number of
chunks or the buffer, or if an offset was provided, a bug
would cause extra or incorrect pages of the buffer to be mapped.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
8fae831288210dae626e212aaab459154b65ed79 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Don't flush allocatoins that come from the page pools

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
31b9432b4b588777b30ad1f7d8eecf7770a45edc 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Clear GFP_WAIT flag on high order allocations

This will prevent the kernel from kicking off compaction
when higher order allocations are made. Instead we will
get these high order allocations only if they are readily
available.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
8d7ab9a9e15b1d8965fb99b8486cae039a2de40e 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Refactor locking

Removes contention for lock between allocate and free by reducing
the length of time the lock is held for. Split out a seperate
lock to protect the list of heaps and replace it with a rwsem since
the list will most likely only be updated during initialization.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
797a95c48c48d5b83bf1a7893602161d2e2a4654 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Switch to using a single shrink function

The single shrink function will free lower order pages first. This
enables compaction to work properly.

[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_page_pool.c
on/ion_priv.h
efee5a0c62d827c0eca7044c2d14dd3324b325aa 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Fix lockdep issue in ion_page_pool

Currently the mutex is held while kmalloc is called, under a low memory
condition this might trigger the shrinker which also takes this mutex.
Refactor so the mutex is not held during allocation.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_page_pool.c
0fb9b815fe2010e9f8ff4b18bfd2a0ed9cf4eb8d 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Fix several issues with page pool

Split out low and high mem pages so they are correctly reported
when the shrinker is called.
Fix potential deadlock caused by holding the page pool lock while
allocationg and also needing that lock from the shrink function

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_page_pool.c
on/ion_priv.h
on/ion_system_heap.c
ee4a4986d1a5998ada72c805c040daf759b687be 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Modify gfp flags in ion_system_heap

When allocations larger than order 4 are made, use _GFP_NORETRY
and __GFP_NO_KSWAPD so kswapd doesn't get kicked off to reclaim
these larger chunks. For smaller allocaitons, these are
unnecessary, as the system should be able to reclaim these.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
45b17a809fda352086b63518e32d272cc3442ed5 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Use the ion_page_pool from the system heap

With this change the system heap will use pagepools to avoid
having to invalidate memory when it is allocated, a
significant performance improvement on some systems.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion_priv.h
on/ion_system_heap.c
0214c7f20bf4d5d2e204afaf43789f2f4782d9ae 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Add ion_page_pool.

This patch adds a new utility heaps can use to manage
memory. In the past we have found it can be very
expensive to manage the caches when allocating memory,
but it is imposible to know whether a previous user of a
given memory allocation had a cached mapping. This patch
adds the ability to store a pool of pages that were
previously used uncached so that cache maintenance
only need be done when growing this pool. The pool also
contains a shrinker so memory from the pool can be
recovered in low memory conditions.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/Makefile
on/ion_page_pool.c
on/ion_priv.h
98d5d5f8bad43770803a08e5a969cc9d8200b681 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: use vmalloc to allocate page array to map kernel

When ion_map_kernel is execute the system must allocate
an array large enough to hold a pointer to each page in
the buffer. If the buffer is very large and the system
memory has become very fragmented, there may not be
sufficient high order allocations available from kmalloc.
Use vmalloc instead.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
b0599c014028eb19d0e0b2cd82390555a8eef22d 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: ion_system_heap: Fix bug preventing compilation

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
ba96a2eed5d357c4107f04d8c9f32a58c9ed01da 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Stop trying to allocate from an order on first failure

With this patch the system heap will only try to allocate from each
order as long as allocations succeed. If it failes to obtain a higher
order allocation, it doesn't retry that order.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
13ba7805f9bf710016ffde5e24437fd6e5a798dc 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: optimize system heap for non fault buffers

If a buffer's user mappings are not going to be faulted
in it need not be allocated page wise. We can optimize
this common case by allocating an sglist of larger chunks
rather than creating an entry for each page in the
allocation.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion_priv.h
on/ion_system_heap.c
856661d514e8afc452bcda6f4c05a957694fea78 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Add support for cached mappings that don't fault

We have found that faulting in the mappings for cached
allocations has a significant performance impact and is
only a benefit if only a small part of the buffer is
touched by the cpu (an uncommon case for software rendering).
This patch introduces a ION_FLAG_CACHED_NEEDS_SYNC
which determines whether a mapping should be created by
faulting or at mmap time. If this flag is set,
userspace must manage the caches explictly using the SYNC ioctl.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion.h
d3c0bced267a6726a2abc44c3457495bd7b427ca 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Fix memory leak of dirty bits

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
5ad7bc3addbc3886df05ebced942964307c243c8 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Add debug information for orphaned handles

It is possible for a buffer to exist only as a dma_buf file
descriptor without it being held in any handles. When this
occurs it is impossible to track where the buffer is in the
system (without traversing every process in the system and
inspecting its file table). When buffers are orphaned like
this, copy the task comm and pid of the last client to hold
them into the buffer so we have a debugging hint as to where
this buffer came from. In practice this will probalby be
the process that allocated the buffer.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion_priv.h
37bdbf00c618203467a17d01a4dfae324a818022 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Fix bug in ion_free

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
0e9c03a58ed599594780a69c988bd11e6459a752 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Fix race between ion_import and ion_free

If preemted during ion_free after the refcount is updated but
before the handle can be removed from the rb_tree, import
might find that handle in the tree and try to reuse it
when execution returns to free, the handle will be cleaned
up leaving the caller of import with a corrupt handle.
This patch modifies the locking to protect agains this race.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
12edf53db310345693fb7227c50e70a9b1fce434 13-Dec-2013 Greg Hackmann <ghackmann@google.com> gpu: ion: fix page offset in dma_buf_kmap()

Signed-off-by: Greg Hackmann <ghackmann@google.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
708f0cac89d00c366d562265e0b0244cda6f903d 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Switch to using kmalloc rather than kmap during allocation

Previously, metadata was stored in the allocated pages themselves
during allocation. However the system can only have a limited
number of kmapped pages. A very large allocation might exceed
this limit.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
b82302438bbb496c76d5c4d64d82263253b0ac2b 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Only map as much of the vma as the user requested

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
55808b8d4dbd907834ac11e4959ef7d7040c3982 13-Dec-2013 Laura Abbott <lauraa@codeaurora.org> gpu: ion: Don't call ion_buffer_put on error path

If dma_buf_fd fails, the dma_buf needs to be cleaned up by
calling dma_buf_put. dma_buf_put will call ion_dma_buf_release
which in turn calls ion_buffer_put to clean up the buffer
reference. Calling ion_buffer_put after dma_buf_put drops the
reference count by one more which is incorrect. Fix this by
getting rid of the extra ion_buffer_put call.

Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
a1c6b996ec1d9c78ab58f189719e1674fea3d2fb 13-Dec-2013 Olav Haugan <ohaugan@codeaurora.org> gpu: ion: IOCTL return success when error occurs

ION_IOC_MAP, ION_IOC_SHARE, and ION_IOC_IMPORT may return
success when an error occurs.

Add correct error handling to ION_IOC_MAP, ION_IOC_SHARE, and
ION_IOC_IMPORT.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
ee4c8aa9f94be03a69500af4b3c3a3efa5903ce0 13-Dec-2013 Olav Haugan <ohaugan@codeaurora.org> gpu: ion: Add EXPORT_SYMBOL to functions

Several functions in the ion interface is missing
EXPORT_SYMBOL. This is needed to allow clients to
use these functions from kernel modules.

Add EXPORT_SYMBOL to functions that are supposed
to be exposed.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
a9bb075da5cdd67fddee27ea20e47ed3d04d6bb4 13-Dec-2013 Olav Haugan <ohaugan@codeaurora.org> gpu: ion: Add missing argument to WARN call

The condition argument to the WARN call in ion_free and
ion_share_dma_buf are missing. Add the argument to
allow correct printing of warning message.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
fe65ec5bd1e0f44d601a9990aa253e85561c224d 13-Dec-2013 Dima Zavin <dima@android.com> gpu: ion: do not ask for compound pages in system heap

Signed-off-by: Dima Zavin <dima@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
0b9ec1cfd4aafbadfb5e053cd201d7c3944dec80 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Add explicit sync ioctl

This is deprecated in favor of using the dma_buf api which will
automatically sync a buffer to memory when it is mapped to a device.
However, that functionality is not ready, so this patch adds the
ability to sync a buffer explicitly.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion.h
bd5d6bdae118c49d194869ef757fd650dcabd33e 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Modify the system heap to try to allocate large/huge pages

On some systems there is a performance benefit to reducing tlb pressure
by minimizing the number of chunks in an allocation.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
56a7c1851341a2fa9bd115746c1310411a6537a1 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Add cache maintenance to ion.

This patch adds cache maintenance operations to ion. As per mailing
list discussions regarding dma_buf, cache operations are done implicitly.
At buffer allocaiton time the user can select whether he'd like mappings
(both kernel and user) to be cached. When cached mappings are selected,
no mappings will be created for a buffer at mmap time. Instead pages will
be faulted in one at a time so we can track which pages require flushing
before dma. When the buffers are mapped for dma (via the dma_buf apis)
any pages which were touched will be synced for device.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion.h
on/ion_carveout_heap.c
on/ion_priv.h
on/ion_system_heap.c
7b903e44c40fdd8300582b0791ef20b70d81178c 13-Dec-2013 Laura Abbott <lauraa@codeaurora.org> gpu: ion: Map only the vma size given

When mapping carveout buffers into userspace, only map
the size of the vma given, not the full size of the buffer
since clients may map less than the buffer size.

Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_carveout_heap.c
2900cd767180e9674947101fea96e318dc9b23eb 13-Dec-2013 Laura Abbott <lauraa@codeaurora.org> gpu: ion: Loop on the handle count when destroying

When destroying a handle, all kernel mappings to that handle
should be destroyed. Other handles may still have references
and valid mappings to the buffer underneath which should not
be destroyed. Loop on the handle reference count, not the buffer
reference count to get rid of all kernel mappings for the handle.

Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
0de9577b5e708b903a58a9d5e91d6474daa29c2d 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: ion_system_heap: Change allocations to GFP_HIGHUSER

Previously the ion_system_heap was using GFP_KERNEL, forcing all allocations
to be in lowmem. This quickly causes us to run out of lowmem.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
a46b6b2d4d49d3fdb6a2ef47455dc170fbce48b7 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Set the dma_address of the sg list at alloc time

This patch sets the dma_address field of the sglist representing
an allocation at allocation time. This technically breaks the dma api
which states that these addresses should be set when a particular device
takes ownership of a buffer via the dma_map apis. In the case of our
systems the only dma address space is physical addresses. Additionally,
we can not afford the overhead of calling dma_map_sg from this location
as it implies a cache invalidate that is not necessary if the memory
was previously mapped cached. Instead, the expectation is that memory
being returned from the heaps is ready for dma in that if any cached
mappings of that memory exist they have been invalidated.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
056be396881d6cc69e5946a3b4bfbd0f58d8c45a 13-Dec-2013 Greg Hackmann <ghackmann@google.com> gpu: ion: fill in buffer->{dev,size} before mapping new buffers

At least one map_dma() implementation (EXYNOS_CONTIG) assumes the fields
are filled in

Signed-off-by: Greg Hackmann <ghackmann@google.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
ce1f147a2ed5ed468ad3a2f8418dddfd205d1fd9 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Get an sg_table from an ion handle

This patch adds an interface to return and sg_table given a
valid ion handle.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion.h
29ae6bc7123f2d2d6796ac81c013bbfdd0a0a8d5 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Allocate the sg_table at creation time rather than dynamically

Rather than calling map_dma on the allocations dynamically, this patch
switches to creating the sg_table at the time the buffer is created.
This is necessary because in future updates the sg_table will be used
for cache maintenance.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
0f34faf89f7e0755c9dad0f96087a76f0df48d26 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: support begin/end and kmap/kunmap dma_buf ops

These ops were added in the 3.4 kernel. This patch adds support
for them to ion. Previous ion_map/unmap_kernel api is also
retained in addition to this new api.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
b15934b62d959ddc75f7a85fa2a721bea28756b6 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Use alloc_pages instead of vmalloc from the system heap

With this change the ion_system_heap will only use kernel address
space when the memory is mapped into the kernel (rare case).

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_system_heap.c
b892bf75b2034e0e4af23da9a276160b8ad26c15 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> 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.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/Kconfig
on/ion.c
on/ion.h
54ac078421ae89b8ac28357bb615262174aec255 13-Dec-2013 KyongHo Cho <pullip.cho@samsung.com> gpu: ion: several bugfixes and enhancements of ION

1. Verifying if the size of memory allocation in ion_alloc() is aligned
by PAGE_SIZE at least. If it is not, this change makes the size to be
aligned by PAGE_SIZE.

2. Unmaps all mappings to the kernel and DMA address spaces when
destroying ion_buffer in ion_buffer_destroy(). This prevents leaks in
those virtual address spaces.

3. Makes the return value of ion_alloc() to be explicit Linux error code
when it fails to allocate a buffer.

4. Makes ion_alloc() implementation simpler. Removes 'goto' statement and
relavant call to ion_buffer_put().

5. Checks if the task is valid before calling put_task_struct() due
to failure on creating a ion client in ion_client_create().

6. Returns error when buffer allocation requested by userspace is failed.

Signed-off-by: KyongHo Cho <pullip.cho@samsung.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
2991b7a044c82252e7b6456321515ebdbdf3acac 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> ion: Add reserve function to ion

Rather than requiring each platform call memblock_remove or reserve
from the board file, add this to ion

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion.h
4d5ca3299fb7b27ceb6c33a62bc10ce4d408dc0b 13-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> ion: Switch map/unmap dma api to sg_tables

Switch these api's from scatterlists to sg_tables

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion.c
on/ion.h
on/ion_priv.h
on/ion_system_heap.c
0f3cbb59ec47f313e138913c89a1dd0048561355 13-Dec-2013 Colin Cross <ccross@android.com> gpu: ion: ion_carveout_heap: fix for 3.4

__arch_ioremap is no longer available, use __arm_ioremap instead.

Signed-off-by: Colin Cross <ccross@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
on/ion_carveout_heap.c
c30707be128e952ca2ba77417cb5509e254a4aac 14-Dec-2013 Rebecca Schultz Zavin <rebecca@android.com> gpu: ion: Add ION Memory Manager

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: Squished in Colin Cross' move to staging change,
also disables ION from the build, as it won't compile till
the end of the patchset]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
config
akefile
on/Kconfig
on/Makefile
on/ion.c
on/ion.h
on/ion_carveout_heap.c
on/ion_heap.c
on/ion_priv.h
on/ion_system_heap.c
on/ion_system_mapper.c
on/tegra/Makefile
on/tegra/tegra_ion.c
5230a5f585244b300586d1f4cd578d9e604b8771 14-Nov-2013 SeongJae Park <sj38.park@gmail.com> staging: alarm-dev: Seperate functions with one blank line

Signed-off-by: SeongJae Park <sj38.park@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm-dev.c
027c440971f9b3dccc05da5bf626cb129f8daf58 14-Nov-2013 SeongJae Park <sj38.park@gmail.com> staging: alarm-dev: Remove unnecessary blank lines

Signed-off-by: SeongJae Park <sj38.park@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm-dev.c
6eaf842a24bae6c4d8159a26f428919d114fc667 14-Nov-2013 SeongJae Park <sj38.park@gmail.com> staging: alarm-dev: Remove unnecessary parenthesis

Signed-off-by: SeongJae Park <sj38.park@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm-dev.c
4e20effa23b1cbfc15fcdd6774937334775c5361 31-Oct-2013 Masanari Iida <standby24x7@gmail.com> staging: android: Fix typo in android/sync.h

Correct spelling typo in android/sync.h

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.h
5957324045ba2c127c9401fa3ac61ac52e043ca8 21-Oct-2013 John Stultz <john.stultz@linaro.org> staging: ashmem: Fix ASHMEM_PURGE_ALL_CACHES return value

Hopefully this isn't too late for 3.12.

In commit 7dc19d5aff (convert shrinkers to new count/scan API)
the return value to PURGE_ALL_CACHES was dropped, causing -EPERM
to always be returned.

This patch re-adds the ret assignment, setting it to the the
ashmem_shrink_count(), which is the lru_count.

(Sorry this was missed in the review!)

Fixes: 7dc19d5affd7 ("convert shrinkers to new count/scan API")
Cc: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Cc: Glauber Costa <glommer@openvz.org>
Reported-by: YongQin Liu <yongqin.liu@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Cc: stable <stable@kernel.org> # 3.12
Acked-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
shmem.c
b59f105c7e26e30f9c549b9c08251c662ed0cfb8 03-Sep-2013 Cruz Julian Bishop <cruzjbishop@gmail.com> staging/android: Add kerneldoc to one function in alarm-dev.c

Sorry. I thought that this would be a nice easy class to document fully.
Turns out I was very wrong - I will have to research the Linux alarm and
timer subsystem one day next week and try again.

Here is what I started out with, anyway. It's not much, but it's better
than nothing!

Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm-dev.c
781114ced258bac3cff00342c9dafda1afe93c6d 03-Sep-2013 Cruz Julian Bishop <cruzjbishop@gmail.com> staging/android: Add some more kerneldoc to ashmem.c

I am sorry if I have interpreted anything incorrectly here. This is my
second day really attempting to understand the Ashmem system.

I can not finish documenting this class at this stage - There is still
more that I have to learn. For now, however, it will have to do.

Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
shmem.c
4d2c9d5ddc3a38abb12253b4fd6ac05bfc3b4462 03-Sep-2013 Cruz Julian Bishop <cruzjbishop@gmail.com> staging/android: Initial partial kernel-doc for ashmem.c

I am beginning to understand the core concepts at play here.

I am nowhere near finished with this class - However, it is better if
I commit what I have documented so far tonight - That way, if I mess
up tomorrow morning, I can just roll back to here.

Sorry if this clutters things up. In the end, once *everything* is
documented, it will make understanding the Android staging driver
easier to understand as a programmer - Hopefully for both new developers
and current ones.

Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
shmem.c
fb51b500a9adafb85a1c0b0544b547f30c9167e1 03-Sep-2013 Cruz Julian Bishop <cruzjbishop@gmail.com> staging/android: Persistent formatting of help Kconfig entries

Three entries were recently added with help listed as "help", while
all previous entries were listed as "---help---" to make it more
noticeable.

This commit fixes that. Sorry that it is so trivial, but it's
been bugging me for a while.

Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
config
cb75d53231ee7c7f01ff9c32da6c3b3623cc26c4 02-Sep-2013 Bojan Prtvar <prtvar.b@gmail.com> Staging: android: Remove extern from function prototypes in .h files

checkpatch.pl complains that extern prototypes should be avoided in .h files

Signed-off-by: Bojan Prtvar <prtvar.b@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
imed_output.h
31507f74f1b2f540614b60cf98d6091f321e4290 02-Sep-2013 Chen Gang <gang.chen@asianux.com> drivers: staging: android: Kconfig: add depends on MMU for ANDROID_BINDER_IPC

ANDROID_BINDER_IPC used the functions which need depend on MMU, so need
let it depend on MMU too, or compiling fails.

The related error:

drivers/built-in.o: In function `binder_update_page_range':
drivers/staging/android/binder.c:599: undefined reference to `map_vm_area'
drivers/staging/android/binder.c:626: undefined reference to `zap_page_range'
drivers/built-in.o: In function `binder_mmap':
drivers/staging/android/binder.c:2744: undefined reference to `get_vm_area'

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
config
fb07ebc3e82a98a3605112b71ea819c359549c4b 02-Sep-2013 Bojan Prtvar <prtvar.b@gmail.com> Staging: android: Mark local functions in binder.c as static

This fixes the following sparse warnings
drivers/staging/android/binder.c:1703:5: warning: symbol 'binder_thread_write' was not declared. Should it be static?
drivers/staging/android/binder.c:2058:6: warning: symbol 'binder_stat_br' was not declared. Should it be static?

Signed-off-by: Bojan Prtvar <prtvar.b@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
308fbd8ac0b0078dba29cad027e5b454aac13a6a 01-Sep-2013 Bojan Prtvar <prtvar.b@gmail.com> Staging: android: add __user annotation in binder.c

This fixes the following sparse error
drivers/staging/android/binder.c:1795:36: error: incompatible types in comparison expression (different address spaces)

Signed-off-by: Bojan Prtvar <prtvar.b@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
9bf12df31f282e845b3dfaac1e5d5376a041da22 13-Sep-2013 Linus Torvalds <torvalds@linux-foundation.org> Merge git://git.kvack.org/~bcrl/aio-next

Pull aio changes from Ben LaHaise:
"First off, sorry for this pull request being late in the merge window.
Al had raised a couple of concerns about 2 items in the series below.
I addressed the first issue (the race introduced by Gu's use of
mm_populate()), but he has not provided any further details on how he
wants to rework the anon_inode.c changes (which were sent out months
ago but have yet to be commented on).

The bulk of the changes have been sitting in the -next tree for a few
months, with all the issues raised being addressed"

* git://git.kvack.org/~bcrl/aio-next: (22 commits)
aio: rcu_read_lock protection for new rcu_dereference calls
aio: fix race in ring buffer page lookup introduced by page migration support
aio: fix rcu sparse warnings introduced by ioctx table lookup patch
aio: remove unnecessary debugging from aio_free_ring()
aio: table lookup: verify ctx pointer
staging/lustre: kiocb->ki_left is removed
aio: fix error handling and rcu usage in "convert the ioctx list to table lookup v3"
aio: be defensive to ensure request batching is non-zero instead of BUG_ON()
aio: convert the ioctx list to table lookup v3
aio: double aio_max_nr in calculations
aio: Kill ki_dtor
aio: Kill ki_users
aio: Kill unneeded kiocb members
aio: Kill aio_rw_vect_retry()
aio: Don't use ctx->tail unnecessarily
aio: io_cancel() no longer returns the io_event
aio: percpu ioctx refcount
aio: percpu reqs_available
aio: reqs_active -> reqs_available
aio: fix build when migration is disabled
...
7dc19d5affd71370754a2c3d36b485810eaee7a1 28-Aug-2013 Dave Chinner <dchinner@redhat.com> drivers: convert shrinkers to new count/scan API

Convert the driver shrinkers to the new API. Most changes are compile
tested only because I either don't have the hardware or it's staging
stuff.

FWIW, the md and android code is pretty good, but the rest of it makes me
want to claw my eyes out. The amount of broken code I just encountered is
mind boggling. I've added comments explaining what is broken, but I fear
that some of the code would be best dealt with by being dragged behind the
bike shed, burying in mud up to it's neck and then run over repeatedly
with a blunt lawn mower.

Special mention goes to the zcache/zcache2 drivers. They can't co-exist
in the build at the same time, they are under different menu options in
menuconfig, they only show up when you've got the right set of mm
subsystem options configured and so even compile testing is an exercise in
pulling teeth. And that doesn't even take into account the horrible,
broken code...

[glommer@openvz.org: fixes for i915, android lowmem, zcache, bcache]
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Glauber Costa <glommer@openvz.org>
Acked-by: Mel Gorman <mgorman@suse.de>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Kent Overstreet <koverstreet@google.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Jerome Glisse <jglisse@redhat.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Carlos Maiolino <cmaiolino@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Chuck Lever <chuck.lever@oracle.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: David Rientjes <rientjes@google.com>
Cc: Gleb Natapov <gleb@redhat.com>
Cc: Greg Thelen <gthelen@google.com>
Cc: J. Bruce Fields <bfields@redhat.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Jerome Glisse <jglisse@redhat.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Kent Overstreet <koverstreet@google.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Steven Whitehouse <swhiteho@redhat.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
shmem.c
owmemorykiller.c
0ce3d74450815500e31f16a0b65f6bab687985c3 28-Aug-2013 Dave Chinner <dchinner@redhat.com> shrinker: add node awareness

Pass the node of the current zone being reclaimed to shrink_slab(),
allowing the shrinker control nodemask to be set appropriately for node
aware shrinkers.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Glauber Costa <glommer@openvz.org>
Acked-by: Mel Gorman <mgorman@suse.de>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Carlos Maiolino <cmaiolino@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Chuck Lever <chuck.lever@oracle.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: David Rientjes <rientjes@google.com>
Cc: Gleb Natapov <gleb@redhat.com>
Cc: Greg Thelen <gthelen@google.com>
Cc: J. Bruce Fields <bfields@redhat.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Jerome Glisse <jglisse@redhat.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Kent Overstreet <koverstreet@google.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Steven Whitehouse <swhiteho@redhat.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
shmem.c
9d3ab801740ab5ff1e22932fdfecdaacd0d64a18 24-Aug-2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org> staging: android: timed_output: fix sysfs file creation race

The sysfs file for the driver was being created _after_ the device was
announced to userspace, causing a race with any tools looking for sysfs
files.

Fix the race by using the default attribute group for the class.

Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
imed_output.c
9c6cd3b39048c8bbb83c5cd936f4dffc847321c6 15-Aug-2013 Yann Droneaud <ydroneaud@opteya.com> android/sync: use get_unused_fd_flags(O_CLOEXEC) instead of get_unused_fd()

Macro get_unused_fd() is used to allocate a file descriptor with
default flags. Those default flags (0) can be "unsafe":
O_CLOEXEC must be used by default to not leak file descriptor
across exec().

Instead of macro get_unused_fd(), functions anon_inode_getfd()
or get_unused_fd_flags() should be used with flags given by userspace.
If not possible, flags should be set to O_CLOEXEC to provide userspace
with a default safe behavor.

In a further patch, get_unused_fd() will be removed so that
new code start using anon_inode_getfd() or get_unused_fd_flags()
with correct flags.

This patch replaces calls to get_unused_fd() with call to
get_unused_fd_flags(O_CLOEXEC) following advice from Erik Gilling.

Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Colin Cross <ccross@google.com>
Link: http://lkml.kernel.org/r/CACSP8SjXGMk2_kX_+RgzqqQwqKernvF1Wt3K5tw991W5dfAnCA@mail.gmail.com
Link: http://lkml.kernel.org/r/cover.1376327678.git.ydroneaud@opteya.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
45acea57335ece628bdf96dc35d2ebdefd1efb9e 15-Aug-2013 Yann Droneaud <ydroneaud@opteya.com> android/sw_sync: use get_unused_fd_flags(O_CLOEXEC) instead of get_unused_fd()

Macro get_unused_fd() is used to allocate a file descriptor with
default flags. Those default flags (0) can be "unsafe":
O_CLOEXEC must be used by default to not leak file descriptor
across exec().

Instead of macro get_unused_fd(), functions anon_inode_getfd()
or get_unused_fd_flags() should be used with flags given by userspace.
If not possible, flags should be set to O_CLOEXEC to provide userspace
with a default safe behavor.

In a further patch, get_unused_fd() will be removed so that
new code start using anon_inode_getfd() or get_unused_fd_flags()
with correct flags.

This patch replaces calls to get_unused_fd() with call to
get_unused_fd_flags(O_CLOEXEC) following advice from Erik Gilling.

Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Colin Cross <ccross@google.com>
Link: http://lkml.kernel.org/r/CACSP8SjZcpcpEtQHzcGYhf-MP7QGo0XpN7-uN7rmD=vNtopG=w@mail.gmail.com
Link: http://lkml.kernel.org/r/cover.1376327678.git.ydroneaud@opteya.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
w_sync.c
73a7075e3f6ec63dc359064eea6fd84f406cf2a5 10-May-2013 Kent Overstreet <koverstreet@google.com> aio: Kill aio_rw_vect_retry()

This code doesn't serve any purpose anymore, since the aio retry
infrastructure has been removed.

This change should be safe because aio_read/write are also used for
synchronous IO, and called from do_sync_read()/do_sync_write() - and
there's no looping done in the sync case (the read and write syscalls).

Signed-off-by: Kent Overstreet <koverstreet@google.com>
Cc: Zach Brown <zab@redhat.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Asai Thambi S P <asamymuthupa@micron.com>
Cc: Selvan Mani <smani@micron.com>
Cc: Sam Bradshaw <sbradshaw@micron.com>
Cc: Jeff Moyer <jmoyer@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Benjamin LaHaise <bcrl@kvack.org>
Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
ogger.c
01731cf2eee38410b505c447026e46a591674835 29-Jul-2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org> Merge 3.11-rc3 into staging-next

We want these fixes here.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
72bb99cfe9c57d2044445fb34bbc95b4c0bae6f2 22-Jul-2013 Karlis Ogsts <karlis.ogsts@sonymobile.com> staging: android: logger: Correct write offset reset on error

In the situation that a writer fails to copy data from userspace it will reset
the write offset to the value it had before it went to sleep. This discarding
any messages written while aquiring the mutex.

Therefore the reset offset needs to be retrieved after acquiring the mutex.

Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ogger.c
64dcfe6b84d4104d93e4baf2b5a0b3e7f2e4cc30 04-Jul-2013 Serban Constantinescu <serban.constantinescu@arm.com> staging: android: binder: fix binder interface for 64bit compat layer

The changes in this patch will fix the binder interface for use on 64bit
machines and stand as the base of the 64bit compat support. The changes
apply to the structures that are passed between the kernel and
userspace.

Most of the changes applied mirror the change to struct binder_version
where there is no need for a 64bit wide protocol_version(on 64bit
machines). The change inlines with the existing 32bit userspace(the
structure has the same size) and simplifies the compat layer such that
the same handler can service the BINDER_VERSION ioctl.

Other changes make use of kernel types as well as user-exportable ones
and fix format specifier issues.

The changes do not affect existing 32bit ABI.

Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Acked-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
inder.h
eecddef594f9eb159040160b929642f16a07387f 04-Jul-2013 Serban Constantinescu <serban.constantinescu@arm.com> staging: android: binder: replace types with portable ones

Since this driver is meant to be used on different types of processors
and a portable driver should specify the size a variable expects to be
this patch changes the types used throughout the binder interface.

We use "userspace" types since this header will be exported and used by
the Android filesystem.

The patch does not change in any way the functionality of the binder driver.

Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Acked-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.h
ec35e852dc9de9809f88ff397d7a611208880f9f 04-Jul-2013 Serban Constantinescu <serban.constantinescu@arm.com> staging: android: binder: fix alignment issues

The Android userspace aligns the data written to the binder buffers to
4bytes. Thus for 32bit platforms or 64bit platforms running an 32bit
Android userspace we can have a buffer looking like this:

platform buffer(binder_cmd pointer) size
32/32 32b 32b 8B
64/32 32b 64b 12B
64/64 32b 64b 12B

Thus the kernel needs to check that the buffer size is aligned to 4bytes
not to (void *) that will be 8bytes on 64bit machines.

The change does not affect existing 32bit ABI.

Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Acked-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
fc56f2ecf091d774c18ad0d470c62c6818fa32a3 04-Jul-2013 Serban Constantinescu <serban.constantinescu@arm.com> staging: android: binder: fix BC_FREE_BUFFER ioctl declaration

BinderDriverCommands mirror the ioctl usage. Thus the size of the
structure passed through the interface should be used to generate the
ioctl No.

The change reflects the type being passed from the user space-a pointer
to a binder_buffer. This change should not affect the existing 32bit
user space since BC_FREE_BUFFER is computed as:

#define _IOW(type,nr,size) \
((type) << _IOC_TYPESHIFT) | \
((nr) << _IOC_NRSHIFT) | \
((size) << _IOC_SIZESHIFT))

and for a 32bit compiler BC_FREE_BUFFER will have the same computed
value. This change will also ease our work in differentiating
BC_FREE_BUFFER from COMPAT_BC_FREE_BUFFER.

The change does not affect existing 32bit ABI.

Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Acked-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.h
a9350fc859ae3f1db7f2efd55c7a3e0d09a4098d 04-Jul-2013 Serban Constantinescu <serban.constantinescu@arm.com> staging: android: binder: fix BINDER_SET_MAX_THREADS declaration

This change will fix the BINDER_SET_MAX_THREADS ioctl to use __u32
instead of size_t for setting the max threads. Thus using the same
handler for 32 and 64bit kernels.

This value is stored internally in struct binder_proc and set to 15
on open_binder() in the libbinder API(thus no need for a 64bit size_t
on 64bit platforms).

The change does not affect existing 32bit ABI.

Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Acked-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.h
397334fc2be6a7e2f77474bd2b24880efea007bf 04-Jul-2013 Serban Constantinescu <serban.constantinescu@arm.com> staging: android: binder: modify struct binder_write_read to use size_t

This change mirrors the userspace operation where struct binder_write_read
members that specify the buffer size and consumed size are size_t elements.

The patch also fixes the binder_thread_write() and binder_thread_read()
functions prototypes to conform with the definition of binder_write_read.

The changes do not affect existing 32bit ABI.

Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Acked-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
inder.h
7f0ef0267e20d62d45d527911a993b1e998f4968 04-Jul-2013 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'akpm' (updates from Andrew Morton)

Merge first patch-bomb from Andrew Morton:
- various misc bits
- I'm been patchmonkeying ocfs2 for a while, as Joel and Mark have been
distracted. There has been quite a bit of activity.
- About half the MM queue
- Some backlight bits
- Various lib/ updates
- checkpatch updates
- zillions more little rtc patches
- ptrace
- signals
- exec
- procfs
- rapidio
- nbd
- aoe
- pps
- memstick
- tools/testing/selftests updates

* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (445 commits)
tools/testing/selftests: don't assume the x bit is set on scripts
selftests: add .gitignore for kcmp
selftests: fix clean target in kcmp Makefile
selftests: add .gitignore for vm
selftests: add hugetlbfstest
self-test: fix make clean
selftests: exit 1 on failure
kernel/resource.c: remove the unneeded assignment in function __find_resource
aio: fix wrong comment in aio_complete()
drivers/w1/slaves/w1_ds2408.c: add magic sequence to disable P0 test mode
drivers/memstick/host/r592.c: convert to module_pci_driver
drivers/memstick/host/jmb38x_ms: convert to module_pci_driver
pps-gpio: add device-tree binding and support
drivers/pps/clients/pps-gpio.c: convert to module_platform_driver
drivers/pps/clients/pps-gpio.c: convert to devm_* helpers
drivers/parport/share.c: use kzalloc
Documentation/accounting/getdelays.c: avoid strncpy in accounting tool
aoe: update internal version number to v83
aoe: update copyright date
aoe: perform I/O completions in parallel
...
02aa2a37636c8fa4fb9322d91be46ff8225b7de0 04-Jul-2013 Kees Cook <keescook@chromium.org> drivers: avoid format string in dev_set_name

Calling dev_set_name with a single paramter causes it to be handled as a
format string. Many callers are passing potentially dynamic string
content, so use "%s" in those cases to avoid any potential accidents,
including wrappers like device_create*() and bdi_register().

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
imed_output.c
f991fae5c6d42dfc5029150b05a78cf3f6c18cc9 03-Jul-2013 Linus Torvalds <torvalds@linux-foundation.org> Merge tag 'pm+acpi-3.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management and ACPI updates from Rafael Wysocki:
"This time the total number of ACPI commits is slightly greater than
the number of cpufreq commits, but Viresh Kumar (who works on cpufreq)
remains the most active patch submitter.

To me, the most significant change is the addition of offline/online
device operations to the driver core (with the Greg's blessing) and
the related modifications of the ACPI core hotplug code. Next are the
freezer updates from Colin Cross that should make the freezing of
tasks a bit less heavy weight.

We also have a couple of regression fixes, a number of fixes for
issues that have not been identified as regressions, two new drivers
and a bunch of cleanups all over.

Highlights:

- Hotplug changes to support graceful hot-removal failures.

It sometimes is necessary to fail device hot-removal operations
gracefully if they cannot be carried out completely. For example,
if memory from a memory module being hot-removed has been allocated
for the kernel's own use and cannot be moved elsewhere, it's
desirable to fail the hot-removal operation in a graceful way
rather than to crash the kernel, but currenty a success or a kernel
crash are the only possible outcomes of an attempted memory
hot-removal. Needless to say, that is not a very attractive
alternative and it had to be addressed.

However, in order to make it work for memory, I first had to make
it work for CPUs and for this purpose I needed to modify the ACPI
processor driver. It's been split into two parts, a resident one
handling the low-level initialization/cleanup and a modular one
playing the actual driver's role (but it binds to the CPU system
device objects rather than to the ACPI device objects representing
processors). That's been sort of like a live brain surgery on a
patient who's riding a bike.

So this is a little scary, but since we found and fixed a couple of
regressions it caused to happen during the early linux-next testing
(a month ago), nobody has complained.

As a bonus we remove some duplicated ACPI hotplug code, because the
ACPI-based CPU hotplug is now going to use the common ACPI hotplug
code.

- Lighter weight freezing of tasks.

These changes from Colin Cross and Mandeep Singh Baines are
targeted at making the freezing of tasks a bit less heavy weight
operation. They reduce the number of tasks woken up every time
during the freezing, by using the observation that the freezer
simply doesn't need to wake up some of them and wait for them all
to call refrigerator(). The time needed for the freezer to decide
to report a failure is reduced too.

Also reintroduced is the check causing a lockdep warining to
trigger when try_to_freeze() is called with locks held (which is
generally unsafe and shouldn't happen).

- cpufreq updates

First off, a commit from Srivatsa S Bhat fixes a resume regression
introduced during the 3.10 cycle causing some cpufreq sysfs
attributes to return wrong values to user space after resume. The
fix is kind of fresh, but also it's pretty obvious once Srivatsa
has identified the root cause.

Second, we have a new freqdomain_cpus sysfs attribute for the
acpi-cpufreq driver to provide information previously available via
related_cpus. From Lan Tianyu.

Finally, we fix a number of issues, mostly related to the
CPUFREQ_POSTCHANGE notifier and cpufreq Kconfig options and clean
up some code. The majority of changes from Viresh Kumar with bits
from Jacob Shin, Heiko Stübner, Xiaoguang Chen, Ezequiel Garcia,
Arnd Bergmann, and Tang Yuantian.

- ACPICA update

A usual bunch of updates from the ACPICA upstream.

During the 3.4 cycle we introduced support for ACPI 5 extended
sleep registers, but they are only supposed to be used if the
HW-reduced mode bit is set in the FADT flags and the code attempted
to use them without checking that bit. That caused suspend/resume
regressions to happen on some systems. Fix from Lv Zheng causes
those registers to be used only if the HW-reduced mode bit is set.

Apart from this some other ACPICA bugs are fixed and code cleanups
are made by Bob Moore, Tomasz Nowicki, Lv Zheng, Chao Guan, and
Zhang Rui.

- cpuidle updates

New driver for Xilinx Zynq processors is added by Michal Simek.

Multidriver support simplification, addition of some missing
kerneldoc comments and Kconfig-related fixes come from Daniel
Lezcano.

- ACPI power management updates

Changes to make suspend/resume work correctly in Xen guests from
Konrad Rzeszutek Wilk, sparse warning fix from Fengguang Wu and
cleanups and fixes of the ACPI device power state selection
routine.

- ACPI documentation updates

Some previously missing pieces of ACPI documentation are added by
Lv Zheng and Aaron Lu (hopefully, that will help people to
uderstand how the ACPI subsystem works) and one outdated doc is
updated by Hanjun Guo.

- Assorted ACPI updates

We finally nailed down the IA-64 issue that was the reason for
reverting commit 9f29ab11ddbf ("ACPI / scan: do not match drivers
against objects having scan handlers"), so we can fix it and move
the ACPI scan handler check added to the ACPI video driver back to
the core.

A mechanism for adding CMOS RTC address space handlers is
introduced by Lan Tianyu to allow some EC-related breakage to be
fixed on some systems.

A spec-compliant implementation of acpi_os_get_timer() is added by
Mika Westerberg.

The evaluation of _STA is added to do_acpi_find_child() to avoid
situations in which a pointer to a disabled device object is
returned instead of an enabled one with the same _ADR value. From
Jeff Wu.

Intel BayTrail PCH (Platform Controller Hub) support is added to
the ACPI driver for Intel Low-Power Subsystems (LPSS) and that
driver is modified to work around a couple of known BIOS issues.
Changes from Mika Westerberg and Heikki Krogerus.

The EC driver is fixed by Vasiliy Kulikov to use get_user() and
put_user() instead of dereferencing user space pointers blindly.

Code cleanups are made by Bjorn Helgaas, Nicholas Mazzuca and Toshi
Kani.

- Assorted power management updates

The "runtime idle" helper routine is changed to take the return
values of the callbacks executed by it into account and to call
rpm_suspend() if they return 0, which allows us to reduce the
overall code bloat a bit (by dropping some code that's not
necessary any more after that modification).

The runtime PM documentation is updated by Alan Stern (to reflect
the "runtime idle" behavior change).

New trace points for PM QoS are added by Sahara
(<keun-o.park@windriver.com>).

PM QoS documentation is updated by Lan Tianyu.

Code cleanups are made and minor issues are addressed by Bernie
Thompson, Bjorn Helgaas, Julius Werner, and Shuah Khan.

- devfreq updates

New driver for the Exynos5-bus device from Abhilash Kesavan.

Minor cleanups, fixes and MAINTAINERS update from MyungJoo Ham,
Abhilash Kesavan, Paul Bolle, Rajagopal Venkat, and Wei Yongjun.

- OMAP power management updates

Adaptive Voltage Scaling (AVS) SmartReflex voltage control driver
updates from Andrii Tseglytskyi and Nishanth Menon."

* tag 'pm+acpi-3.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (162 commits)
cpufreq: Fix cpufreq regression after suspend/resume
ACPI / PM: Fix possible NULL pointer deref in acpi_pm_device_sleep_state()
PM / Sleep: Warn about system time after resume with pm_trace
cpufreq: don't leave stale policy pointer in cdbs->cur_policy
acpi-cpufreq: Add new sysfs attribute freqdomain_cpus
cpufreq: make sure frequency transitions are serialized
ACPI: implement acpi_os_get_timer() according the spec
ACPI / EC: Add HP Folio 13 to ec_dmi_table in order to skip DSDT scan
ACPI: Add CMOS RTC Operation Region handler support
ACPI / processor: Drop unused variable from processor_perflib.c
cpufreq: tegra: call CPUFREQ_POSTCHANGE notfier in error cases
cpufreq: s3c64xx: call CPUFREQ_POSTCHANGE notfier in error cases
cpufreq: omap: call CPUFREQ_POSTCHANGE notfier in error cases
cpufreq: imx6q: call CPUFREQ_POSTCHANGE notfier in error cases
cpufreq: exynos: call CPUFREQ_POSTCHANGE notfier in error cases
cpufreq: dbx500: call CPUFREQ_POSTCHANGE notfier in error cases
cpufreq: davinci: call CPUFREQ_POSTCHANGE notfier in error cases
cpufreq: arm-big-little: call CPUFREQ_POSTCHANGE notfier in error cases
cpufreq: powernow-k8: call CPUFREQ_POSTCHANGE notfier in error cases
cpufreq: pcc: call CPUFREQ_POSTCHANGE notfier in error cases
...
790eac5640abf7a57fa3a644386df330e18c11b0 03-Jul-2013 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull second set of VFS changes from Al Viro:
"Assorted f_pos race fixes, making do_splice_direct() safe to call with
i_mutex on parent, O_TMPFILE support, Jeff's locks.c series,
->d_hash/->d_compare calling conventions changes from Linus, misc
stuff all over the place."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (63 commits)
Document ->tmpfile()
ext4: ->tmpfile() support
vfs: export lseek_execute() to modules
lseek_execute() doesn't need an inode passed to it
block_dev: switch to fixed_size_llseek()
cpqphp_sysfs: switch to fixed_size_llseek()
tile-srom: switch to fixed_size_llseek()
proc_powerpc: switch to fixed_size_llseek()
ubi/cdev: switch to fixed_size_llseek()
pci/proc: switch to fixed_size_llseek()
isapnp: switch to fixed_size_llseek()
lpfc: switch to fixed_size_llseek()
locks: give the blocked_hash its own spinlock
locks: add a new "lm_owner_key" lock operation
locks: turn the blocked_list into a hashtable
locks: convert fl_link to a hlist_node
locks: avoid taking global lock if possible when waking up blocked waiters
locks: protect most of the file_lock handling with i_lock
locks: encapsulate the fl_link list handling
locks: make "added" in __posix_lock_file a bool
...
e77e43003382e46c673c9f82b5f2df8058d3c527 16-Jun-2013 Al Viro <viro@zeniv.linux.org.uk> more open-coded file_inode() calls

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
ogger.c
207bc1181b1c03ab6ecb55bca5b307606dd1d6bc 28-Jun-2013 Rafael J. Wysocki <rafael.j.wysocki@intel.com> Merge branch 'freezer'

* freezer:
af_unix: use freezable blocking calls in read
sigtimedwait: use freezable blocking call
nanosleep: use freezable blocking call
futex: use freezable blocking call
select: use freezable blocking call
epoll: use freezable blocking call
binder: use freezable blocking calls
freezer: add new freezable helpers using freezer_do_not_count()
freezer: convert freezable helpers to static inline where possible
freezer: convert freezable helpers to freezer_do_not_count()
freezer: skip waking up tasks with PF_FREEZER_SKIP set
freezer: shorten freezer sleep time using exponential backoff
lockdep: check that no locks held at freeze time
lockdep: remove task argument from debug_check_no_locks_held
freezer: add unsafe versions of freezable helpers for CIFS
freezer: add unsafe versions of freezable helpers for NFS
1dcdbfd6d9a5172ece7ccccbca90531d4cf62083 23-Jun-2013 Masanari Iida <standby24x7@gmail.com> staging: android: Fix typo in staging/android

Fix "with with" in debug message.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
b37668d0808a1bf15d05e678f431fb5fb4659c90 09-Jun-2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org> Merge 3.10-rc5 into staging-next
cd0c1d70f69a8ac51634ef878ce6610044ee166c 05-Jun-2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org> staging: android: sync: fix up a sparse warning

Fix up a sparse warning about sync_dump that was reported.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: Erik Gilling <konkers@android.com>
Cc: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
60bba385c5e86ee6a654e3345093eb48e258eb1d 04-Jun-2013 Dan Carpenter <dan.carpenter@oracle.com> staging: alarm-dev: information leak in alarm_compat_ioctl()

If we pass an invalid clock type then "ts" is never set. We need to
check for errors earlier, otherwise we end up passing uninitialized
stack data to userspace.

Reported-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm-dev.c
e919b86c3b018c0e0c5e522354e743dcc0824ee1 03-Jun-2013 Dan Carpenter <dan.carpenter@oracle.com> staging: alarm-dev: information leak in alarm_ioctl()

Smatch complains that if we pass an invalid clock type then "ts" is
never set. We need to check for errors earlier, otherwise we end up
passing uninitialized stack data to userspace.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm-dev.c
829455bb0e994373519e3c58d403fc1148f44630 27-May-2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org> Merge 3.10-rc3 into staging-next

We want the changes here, and we resolve the merge conflict that was
happening in the nvec_kbd.c file.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
0f14a20e4586bff80575b4806382d43e0d543cda 15-May-2013 Marlies Ruck <marlies.ruck@gmail.com> staging: Fix lines over 80 chars in android sw_sync

Fixes the following checkpatch warning:
WARNING: Line over 80 characters

Signed-off-by: Marlies Ruck <marlies.ruck@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
w_sync.c
bd471258f2e0911f29d5dc3e1689de35518a157a 08-May-2013 Xiong Zhou <jencce.kernel@gmail.com> staging: android: logger: use kuid_t instead of uid_t

Use kuid_t instead of uid_t, to pass the UIDGID_STRICT_TYPE_CHECKS.

Signed-off-by: Xiong Zhou <jencce.kernel@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ogger.c
ogger.h
017ca3bf4aa28871a5a19830ca27e1f4726c26ec 10-May-2013 Marlies Ruck <marlies.ruck@gmail.com> staging: android: Fixed line over 80 char

Fixes the following checkpatch warning:
Warning: Line over 80 characters

Signed-off-by: Marlies Ruck <marlies.ruck@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
shmem.c
a0eacf2959a2879dce29d35568d78fcfeea54d86 08-May-2013 Hema Prathaban <hemaklnce@gmail.com> staging: android: Replace seq_printf with seq_puts

Fixes the following checkpatch warning:
WARNING: Prefer seq_puts to seq_printf

Signed-off-by: Hema Prathaban <hemaklnce@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
d03f6bbaa42c2c5466350718f804537384902d5d 08-May-2013 Hema Prathaban <hemaklnce@gmail.com> staging: android: Remove unnecessary braces

Fixes the following checkpatch warning:
WARNING: braces {} are not necessary for single statement blocks

Signed-off-by: Hema Prathaban <hemaklnce@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
e2610b268bb74d24866a9578e78d8c3de90ed596 07-May-2013 Colin Cross <ccross@android.com> binder: use freezable blocking calls

Avoid waking up every thread sleeping in a binder call during
suspend and resume by calling a freezable blocking call. Previous
patches modified the freezer to avoid sending wakeups to threads
that are blocked in freezable blocking calls.

This call was selected to be converted to a freezable call because
it doesn't hold any locks or release any resources when interrupted
that might be needed by another freezing task or a kernel driver
during suspend, and is a common site where idle userspace tasks are
blocked.

Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
inder.c
5647ac0ad4f355817b788372a01cb293ed63bde4 09-May-2013 Linus Torvalds <torvalds@linux-foundation.org> Merge tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux

Pull removal of GENERIC_GPIO from Grant Likely:
"GENERIC_GPIO now synonymous with GPIOLIB. There are no longer any
valid cases for enableing GENERIC_GPIO without GPIOLIB, even though it
is possible to do so which has been causing confusion and breakage.
This branch does the work to completely eliminate GENERIC_GPIO."

* tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux:
gpio: update gpio Chinese documentation
Remove GENERIC_GPIO config option
Convert selectors of GENERIC_GPIO to GPIOLIB
blackfin: force use of gpiolib
m68k: coldfire: use gpiolib
mips: pnx833x: remove requirement for GENERIC_GPIO
openrisc: default GENERIC_GPIO to false
avr32: default GENERIC_GPIO to false
xtensa: remove explicit selection of GENERIC_GPIO
sh: replace CONFIG_GENERIC_GPIO by CONFIG_GPIOLIB
powerpc: remove redundant GENERIC_GPIO selection
unicore32: default GENERIC_GPIO to false
unicore32: remove unneeded select GENERIC_GPIO
arm: plat-orion: use GPIO driver on CONFIG_GPIOLIB
arm: remove redundant GENERIC_GPIO selection
mips: alchemy: require gpiolib
mips: txx9: change GENERIC_GPIO to GPIOLIB
mips: loongson: use GPIO driver on CONFIG_GPIOLIB
mips: remove redundant GENERIC_GPIO select
a27bb332c04cec8c4afd7912df0dc7890db27560 08-May-2013 Kent Overstreet <koverstreet@google.com> aio: don't include aio.h in sched.h

Faster kernel compiles by way of fewer unnecessary includes.

[akpm@linux-foundation.org: fix fallout]
[akpm@linux-foundation.org: fix build]
Signed-off-by: Kent Overstreet <koverstreet@google.com>
Cc: Zach Brown <zab@redhat.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Asai Thambi S P <asamymuthupa@micron.com>
Cc: Selvan Mani <smani@micron.com>
Cc: Sam Bradshaw <sbradshaw@micron.com>
Cc: Jeff Moyer <jmoyer@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Benjamin LaHaise <bcrl@kvack.org>
Reviewed-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
ogger.c
76ec9d18b8972f1b228f819f6126c9f022b3e642 28-Mar-2013 Alexandre Courbot <acourbot@nvidia.com> Convert selectors of GENERIC_GPIO to GPIOLIB

GENERIC_GPIO is now equivalent to GPIOLIB and features that depended on
GENERIC_GPIO can now depend on GPIOLIB to allow removal of this option.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
config
aa7a82b9f941f1e299bf9b26dcd8bb76ecce3c8f 09-Apr-2013 Serban Constantinescu <serban.constantinescu@arm.com> staging: android: binder: replace IOCTL types with user-exportable types

This patch modifies the IOCTL macros to use user-exportable data types,
as they are the referred kernel types for the user/kernel interface.

The patch does not change in any way the functionality of the binder driver.

Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Acked-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.h
c37b95eeefee32a765a9bbbfeaece48a361b2d23 29-Mar-2013 Dmitry Pervushin <dmitry.pervushin@linaro.org> staging: sync: Add compat_ioctl handlers to sync drivers

The sync drivers are missing compat_ioctl handlers, so this
patch adds them.

The same change has been submitted to AOSP:
https://android-review.googlesource.com/#/c/54901/
Change-Id: If1a1ecc3952b321c8d64c6a8b050104859efc4b1

Cc: Erik Gilling <konkers@android.com>
Cc: Dmitry Pervushin <dmitry.pervushin@linaro.org>
Cc: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Dmitry Pervushin <dmitry.pervushin@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
w_sync.c
ync.c
6b83f9150ff5d23355fc3baf6960801fb1525f77 16-Mar-2013 Dmitry Voytik <dvv.kernel@gmail.com> staging: android: lowmemorykiller: well-marked debug print

Add "lowmemorykiller:" prefix to the debug print so it's easier to
analyse LMK's debug output:
dmesg | grep lowmemorykiller

Signed-off-by: Dmitry Voytik <dvv.kernel@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
owmemorykiller.c
c07c933fc1ba6a2ee460f8fe048d6fefbced674e 12-Mar-2013 Mirsal Ennaime <mirsal@mirsal.fr> drivers: android: binder: Use __func__ in debug messages

Debug messages sent in binder_deferred_release begin with
"binder_release:" which is a bit misleading as binder_release is not
directly part of the call stack. Use __func__ instead for debug messages
in binder_deferred_release.

Signed-off-by: Mirsal Ennaime <mirsal@mirsal.fr>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
ba97bc5b139b9ef16cf6ad8fa6618d8836150628 12-Mar-2013 Mirsal Ennaime <mirsal@mirsal.fr> drivers: android: binder: Remove excessive indentation

Remove one level of indentation from the binder proc page release code
by using slightly different control semantics.

Signed-off-by: Mirsal Ennaime <mirsal@mirsal.fr>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
53413e7dcba9c5e931352f0588fc3bb95b700f15 12-Mar-2013 Mirsal Ennaime <mirsal@mirsal.fr> drivers: android: binder: Fix code style in binder_deferred_release

* Use tabs where applicable
* Remove a few "80-columns" checkpatch warnings
* Separate code paths with empty lines for readability

Signed-off-by: Mirsal Ennaime <mirsal@mirsal.fr>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
008fa749e0fe5b2fffd20b7fe4891bb80d072c6a 12-Mar-2013 Mirsal Ennaime <mirsal@mirsal.fr> drivers: android: binder: Move the node release code to a separate function

The binder_deferred_release() function has many levels of indentation
which makes it difficult to read. This patch moves the code which deals
with disposing of a binder node to a separate binder_node_release()
function, thus removing one level of indentation and allowing the code to
fit in 80 columns.

Signed-off-by: Mirsal Ennaime <mirsal@mirsal.fr>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
2c0fb1c969ddedf15b4d9d0c106f4dca82dffc21 14-Mar-2013 Paul Bolle <pebolle@tiscali.nl> staging: android: remove dependency on TINY_SHMEM

The Kconfig entry for the "Anonymous Shared Memory Subsystem" got added
in v3.3. It has an optional dependency on TINY_SHMEM. But TINY_SHMEM had
already been removed in v2.6.29. So this optional dependency can safely
be removed too.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
config
59691367be00806a3ab1c6a125ced6ed87e91356 11-Mar-2013 Wei Yongjun <yongjun_wei@trendmicro.com.cn> staging: sync: fix return value check in sync_fence_alloc()

In case of error, the function anon_inode_getfile() returns
ERR_PTR() and never returns NULL. The NULL test in the return
value check should be replaced with IS_ERR().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
451fb7664a590e74122061d3ac773eddb3c73674 05-Mar-2013 Changlong Xie <changlongx.xie@intel.com> staging: sw_sync: sw_sync_timeline_ops can be static

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Changlong Xie <changlongx.xie@intel.com>
Acked-by: Erik Gilling <konkers@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
w_sync.c
e9f5b8145af9a0ee34e98cf01dcd3afb87225538 05-Mar-2013 Serban Constantinescu <serban.constantinescu@arm.com> staging: android: ashmem: Add support for 32bit ashmem calls in a 64bit kernel

Android's shared memory subsystem, Ashmem, does not support calls from a
32bit userspace in a 64 bit kernel. This patch adds support for syscalls
coming from a 32bit userspace in a 64bit kernel.

The patch has been successfully tested on ARMv8 AEM(64bit
platform model) and Versatile Express A9(32bit platform).

v2: Fix missing compat.h include.

Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Acked-by: Arve Hjønnevåg <arve@android.com>
Acked-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
shmem.c
shmem.h
1e70bd46a5a950b7ba319e50bdfed9d20ed9fd73 27-Feb-2013 Charndeep Grewal <csgrewa@tycho.ncsc.mil> staging: android: logger: enforce GID and CAP check on log flush

Restrict log flushing to those in the logs group, or
anyone with CAP_SYSLOG.

Cc: Android Kernel Team <kernel-team@android.com>
Cc: Charndeep Grewal <csgrewa@tycho.ncsc.mil>
Signed-off-by: Charndeep Grewal <csgrewa@tycho.ncsc.mil>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ogger.c
0441bcf4db64e9825937916fe64d539d12c3fead 27-Feb-2013 Nick Kralevich <nnk@google.com> staging: android: logger: Allow a UID to read it's own log entries

Modify the kernel logger to record the UID associated with
the log entries. Always allow the same UID which generated a
log message to read the log message.

Allow anyone in the logs group, or anyone with CAP_SYSLOG, to
read all log entries.

In addition, allow the client to upgrade log formats, so they
can get additional information from the kernel.

Cc: Android Kernel Team <kernel-team@android.com>
Cc: Nick Kralevich <nnk@google.com>
Signed-off-by: Nick Kralevich <nnk@google.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ogger.c
ogger.h
99150f6a1a015de275a83ca95aa5f4054b409f40 27-Feb-2013 Arve Hjønnevåg <arve@android.com> staging: android: lowmemorykiller: Change default debug_level to 1

The select...to kill messages are not very useful when not debugging
the lowmemorykiller itself. After the change to check TIF_MEMDIE
instead of using a task notifer this message can also get very
noisy.

Cc: Android Kernel Team <kernel-team@android.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
owmemorykiller.c
eeb0f4f35fc1a4c0a5e30ec73e8e61916afa0399 27-Feb-2013 Arve Hjønnevåg <arve@android.com> staging: android: lowmemorykiller: Don't count reserved free memory

The amount of reserved memory varies between devices. Subtract it
here to reduce the amount of devices specific tuning needed for the
minfree values.

Cc: Android Kernel Team <kernel-team@android.com>
Cc: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
owmemorykiller.c
e5834d620d61d01444c41958f1816d688a96433c 20-Feb-2013 Shankar Brahadeeswaran <shankoo77@gmail.com> staging: android: ashmem: get_name,set_name not to hold ashmem_mutex

Problem:
There exists a path in ashmem driver that could lead to acquistion
of mm->mmap_sem, ashmem_mutex in reverse order. This could lead
to deadlock in the system.
For Example, assume that mmap is called on a ashmem region
in the context of a thread say T1.
sys_mmap_pgoff (1. acquires mm->mmap_sem)
|
--> mmap_region
|
----> ashmem_mmap (2. acquires asmem_mutex)
Now if there is a context switch after 1 and before 2,
and if another thread T2 (that shares the mm struct) invokes an
ioctl say ASHMEM_GET_NAME, this can lead to the following path

ashmem_ioctl
|
-->get_name (3. acquires ashmem_mutex)
|
---> copy_to_user (4. acquires the mm->mmap_sem)
Note that the copy_to_user could lead to a valid fault if no
physical page is allocated yet for the user address passed.
Now T1 has mmap_sem and is waiting for ashmem_mutex.
and T2 has the ashmem_mutex and is waiting for mmap_sem
Thus leading to deadlock.

Solution:
Do not call copy_to_user or copy_from_user while holding the
ahsmem_mutex. Instead copy this to a local buffer that lives
in the stack while holding this lock. This will maintain data
integrity as well never reverse the lock order.

Testing:
Created a unit test case to reproduce the problem.
Used the same to test this fix on kernel version 3.4.0
Ported the same patch to 3.8

Signed-off-by: Shankar Brahadeeswaran <shankoo77@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
shmem.c
573632c2eaf87429a89490173f34682bb71f6883 01-Mar-2013 Jamie Gennis <jgennis@google.com> staging: sync: Fix timeout = 0 wait behavior

Fix wait behavior on timeout == 0 case

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: Jamie Gennis <jgennis@google.com>
[jstultz: Added commit message]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
4c67d802119813f11fd7c71ca9e6d0f805ea414a 01-Mar-2013 Erik Gilling <konkers@android.com> staging: sync: Don't log wait timeouts when timeout = 0

If the timeout is zero, don't trip the timeout debugging

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]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
713648f0f137e149a1acade3278b621728291f37 01-Mar-2013 Ørjan Eide <orjan.eide@arm.com> staging: sync: Fix race condition between merge and signal

The copied sync_pt was activated immediately. If the sync_pt was
signaled before the entire merge was completed, the new fence's pt_list
could be iterated over while it is still in the process of being
created.

Moving the the sync_pt_activate call for all new sync_pts to after both
the sync_fence_copy_pts and the sync_fence_merge_pts calls ensure that
the pt_list is complete and immutable before it can be reached from the
timeline's active list.

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>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
b699a644f82110e8e5a0f9b45ee1d3a3cd3e4586 01-Mar-2013 Erik Gilling <konkers@android.com> staging: sync: Add tracepoint support

Add support for tracepoints

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: Whitespace changes, add commit message, move to staging]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
race/sync.h
135114a566c15dfe44fb8ca31e42dd215d627383 01-Mar-2013 Erik Gilling <konkers@android.com> staging: sw_sync: Convert to use new value_str debug ops

Switch from print_obj/print_pt to the new
timeline_value_str and pt_value_str ops.

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: Add commit message]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
w_sync.c
dbd523905bac49da0643332e4eb0f2202e2acd06 01-Mar-2013 Erik Gilling <konkers@android.com> staging: sync: Refactor sync debug printing

Move driver callbacks to fill strings instead of using seq_files. This
will allow those values to be used in a future tracepoint patch.

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>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
ync.h
4b5de08a37e8189c039424c92ca76ff605cf1c7f 01-Mar-2013 Erik Gilling <konkers@android.com> staging: sync: Use proper barriers when waiting indefinitely

The previous fix only addressed waiting with a timeout.

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>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
eeb2f571639feedcfce3f1718b0c3fd85d796812 01-Mar-2013 Erik Gilling <konkers@android.com> staging: sync: Update new fence status with sync_fence_signal_pt

If a fence's pt is signaled before sync_fence_create is called, the fence
will never transition into the signaled state. This also address a tiny
race if a merged fence's pt after sync_fence_get_status checks it's status
and before fence->status is updated.

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>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
c679212dbfd060513e156133326122bf9f496579 01-Mar-2013 Erik Gilling <konkers@android.com> staging: sync: Protect unlocked access to fence status

Fence status is checked outside of locks in both sync_fence_wait and
sync_fence_poll. This patch adds propper barrier protection in these
cases to avoid seeing stale status.

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>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
7560645406b8341ab74644b505297e3e32fa6f3a 01-Mar-2013 Erik Gilling <konkers@android.com> staging: sync: Dump sync state on fence errors

When we get a bad status, dump sync state

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]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
1d5db2ce93089db91d7997927b4cfd92a88c5aad 01-Mar-2013 Erik Gilling <konkers@android.com> staging: sync: Improve timeout dump messages

Improve the output of the timeout dumps, including
the fence pointer.

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]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
f56388f3bd15a853d5718bf31c5d4dbc8f499cbe 01-Mar-2013 Erik Gilling <konkers@android.com> staging: sync: Dump sync state to console on timeout

If we hit a timeout, dump sync state to console

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: Add commit message, whitespace fixups]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
3b640f5dd050f972439e5c67ba618a5377b61d34 01-Mar-2013 Erik Gilling <konkers@android.com> staging: sync: Change wait timeout to mirror poll semantics

Change wait timeout to act like poll

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, squished typo-fix]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
ync.h
03e7a503561f6d0ef09c7ec73772a7a6f78417d3 01-Mar-2013 Rebecca Schultz Zavin <rebecca@android.com> staging: sw_sync: Fix error paths

Check the return value of get_unused_fd to make sure a valid
file descriptor is returned.

Make sure to call put_unused_fd even if an error occurs before
the fd can be used.

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: Rebecca Schultz Zavin <rebecca@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
w_sync.c
92ea915adb5565b522902a7b3f0a33ede16bb797 01-Mar-2013 Rebecca Schultz Zavin <rebecca@android.com> staging: sync: Fix error paths

Check the return value of get_unused_fd to make sure a valid
file descriptor is returned.

Make sure to call put_unused_fd even if an error occurs before
the fd can be used.

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: Rebecca Schultz Zavin <rebecca@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
c5b86b7418f46220a623277718d6a909f520477b 01-Mar-2013 Erik Gilling <konkers@android.com> staging: sync: Add reference counting to timelines

If a timeline is destroyed while fences still hold pts on it, the reworked
fence release handler can cause the timeline to be freed before all it's points
are freed.

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: Squished in compiler warning fix]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
ync.h
01544170e1959dd261ceec6413674a528221669b 01-Mar-2013 Erik Gilling <konkers@android.com> staging: sync: Add internal refcounting to fences

If a fence is released while a timeline that one of it's pts is on is being
signaled, it is possible for that fence to be deleted before it is signaled.
This patch adds a refcount for internal references such as signaled pt
processing.

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>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
ync.h
c6f668ce63943db48057b2e3ae8ef3ad5f9b29d2 01-Mar-2013 Erik Gilling <konkers@android.com> staging: sync: Optimize fence merges

If the two fences being merged contain sync_pts from the same timeline,
those two pts will be collapsed into a single pt representing the latter
of the two.

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: Whitespace fixes]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
cc3c5cdc7bc16b78b6c59f0720542965a67d1c81 01-Mar-2013 Erik Gilling <konkers@android.com> staging: sync: Reorder sync_fence_release

Previously fence's pts were freed before the were the fence was removed from the
global fence list. This led to a race with the debugfs support where it would
iterate over sync_pts that had been freed.

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>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
6e91f719865df97abf483b80b7778dc8a51011c4 01-Mar-2013 Erik Gilling <konkers@android.com> staging: sw_sync: Export sw_sync API

Needed to let modules link against sw_sync.

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>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
w_sync.c
8edb4ad9118befafe6e0a6b7456939b74a545e42 01-Mar-2013 Erik Gilling <konkers@android.com> staging: sync: Export sync API symbols

This is needed to allow modules to link against the sync subsystem

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>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
c0f61a4e6145728153d0b94152b4dd5b06899b3b 01-Mar-2013 Erik Gilling <konkers@android.com> staging: sync: Allow async waits to be canceled

In order to allow drivers to cleanly handled teardown we need to allow them
to cancel pending async waits. To do this cleanly, we move allocation of
sync_fence_waiter to the driver calling sync_async_wait().

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>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
ync.h
57b505bbe746dcc011152e79732bdaf96723c51a 01-Mar-2013 Erik Gilling <konkers@android.com> staging: sync: Add poll support

Support poll on sync fence

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: Add commit message]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
b1489c2704b3db72ff37ecabe054926176e88e50 01-Mar-2013 Erik Gilling <konkers@android.com> staging: sw_sync: Add fill_driver_data support

Add fill_driver_data support to export fence data to ioctl

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: Add commit message]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
w_sync.c
79ba1525a91e99cdd7a3b6a57c7537d13ac0ac19 01-Mar-2013 Erik Gilling <konkers@android.com> staging: sync: Add ioctl to get fence data

Add ioctl to get fence data

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: Commit message tweaks]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
ync.h
cebed3b1d7eaee7fb79e2c510a0da4296db043c8 01-Mar-2013 Erik Gilling <konkers@android.com> staging: sw_sync: Add debug support

Add debugfs support hooks.

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: Add commit message]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
w_sync.c
af7582f293cdc29999d05f75b1ec835ffa43cb68 01-Mar-2013 Erik Gilling <konkers@android.com> staging: sync: Add debugfs support

Add support for debugfs

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: Add commit message]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
ync.h
97a84843ac4a1b81c36ccf35ee26cd19c5b8d873 01-Mar-2013 Erik Gilling <konkers@android.com> staging: sync: Add timestamps to sync_pts

Add ktime timestamps to sync_pt structure and
update them when signaled

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]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ync.c
ync.h
9d1906e61dda982070e3910a04d9cce050f7f1a4 01-Mar-2013 Erik Gilling <konkers@android.com> staging: sw_sync: Add cpu based sync driver

Adds a base sync driver that uses the cpu for serialization.

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: Add commit message, whitespace fixes and move to
staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
config
akefile
w_sync.c
w_sync.h
7ad530bf2499c702a6dcbb279cf78b76845ed584 01-Mar-2013 Erik Gilling <konkers@android.com> 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>
config
akefile
ync.c
ync.h
b67bfe0d42cac56c512dd5da4b1b347a23f4b70a 28-Feb-2013 Sasha Levin <sasha.levin@oracle.com> hlist: drop the node parameter from iterators

I'm not sure why, but the hlist for each entry iterators were conceived

list_for_each_entry(pos, head, member)

The hlist ones were greedy and wanted an extra parameter:

hlist_for_each_entry(tpos, pos, head, member)

Why did they need an extra pos parameter? I'm not quite sure. Not only
they don't really need it, it also prevents the iterator from looking
exactly like the list iterator, which is unfortunate.

Besides the semantic patch, there was some manual work required:

- Fix up the actual hlist iterators in linux/list.h
- Fix up the declaration of other iterators based on the hlist ones.
- A very small amount of places were using the 'node' parameter, this
was modified to use 'obj->member' instead.
- Coccinelle didn't handle the hlist_for_each_entry_safe iterator
properly, so those had to be fixed up manually.

The semantic patch which is mostly the work of Peter Senna Tschudin is here:

@@
iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;

type T;
expression a,c,d,e;
identifier b;
statement S;
@@

-T b;
<+... when != b
(
hlist_for_each_entry(a,
- b,
c, d) S
|
hlist_for_each_entry_continue(a,
- b,
c) S
|
hlist_for_each_entry_from(a,
- b,
c) S
|
hlist_for_each_entry_rcu(a,
- b,
c, d) S
|
hlist_for_each_entry_rcu_bh(a,
- b,
c, d) S
|
hlist_for_each_entry_continue_rcu_bh(a,
- b,
c) S
|
for_each_busy_worker(a, c,
- b,
d) S
|
ax25_uid_for_each(a,
- b,
c) S
|
ax25_for_each(a,
- b,
c) S
|
inet_bind_bucket_for_each(a,
- b,
c) S
|
sctp_for_each_hentry(a,
- b,
c) S
|
sk_for_each(a,
- b,
c) S
|
sk_for_each_rcu(a,
- b,
c) S
|
sk_for_each_from
-(a, b)
+(a)
S
+ sk_for_each_from(a) S
|
sk_for_each_safe(a,
- b,
c, d) S
|
sk_for_each_bound(a,
- b,
c) S
|
hlist_for_each_entry_safe(a,
- b,
c, d, e) S
|
hlist_for_each_entry_continue_rcu(a,
- b,
c) S
|
nr_neigh_for_each(a,
- b,
c) S
|
nr_neigh_for_each_safe(a,
- b,
c, d) S
|
nr_node_for_each(a,
- b,
c) S
|
nr_node_for_each_safe(a,
- b,
c, d) S
|
- for_each_gfn_sp(a, c, d, b) S
+ for_each_gfn_sp(a, c, d) S
|
- for_each_gfn_indirect_valid_sp(a, c, d, b) S
+ for_each_gfn_indirect_valid_sp(a, c, d) S
|
for_each_host(a,
- b,
c) S
|
for_each_host_safe(a,
- b,
c, d) S
|
for_each_mesh_entry(a,
- b,
c, d) S
)
...+>

[akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
[akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
[akpm@linux-foundation.org: checkpatch fixes]
[akpm@linux-foundation.org: fix warnings]
[akpm@linux-foudnation.org: redo intrusive kvm changes]
Tested-by: Peter Senna Tschudin <peter.senna@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
inder.c
9afa3195b96da7d2320ec44d19fbfbded7a15571 22-Feb-2013 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial

Pull trivial tree from Jiri Kosina:
"Assorted tiny fixes queued in trivial tree"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (22 commits)
DocBook: update EXPORT_SYMBOL entry to point at export.h
Documentation: update top level 00-INDEX file with new additions
ARM: at91/ide: remove unsused at91-ide Kconfig entry
percpu_counter.h: comment code for better readability
x86, efi: fix comment typo in head_32.S
IB: cxgb3: delay freeing mem untill entirely done with it
net: mvneta: remove unneeded version.h include
time: x86: report_lost_ticks doesn't exist any more
pcmcia: avoid static analysis complaint about use-after-free
fs/jfs: Fix typo in comment : 'how may' -> 'how many'
of: add missing documentation for of_platform_populate()
btrfs: remove unnecessary cur_trans set before goto loop in join_transaction
sound: soc: Fix typo in sound/codecs
treewide: Fix typo in various drivers
btrfs: fix comment typos
Update ibmvscsi module name in Kconfig.
powerpc: fix typo (utilties -> utilities)
of: fix spelling mistake in comment
h8300: Fix home page URL in h8300/README
xtensa: Fix home page URL in Kconfig
...
617677295b53a40d0e54aac4cbbc216ffbc755dd 29-Jan-2013 Jiri Kosina <jkosina@suse.cz> Merge branch 'master' into for-next

Conflicts:
drivers/devfreq/exynos4_bus.c

Sync with Linus' tree to be able to apply patches that are
against newer code (mvneta).
532572b94815e1ede5d9c5434ddb94835df4429e 12-Jan-2013 John Stultz <john.stultz@linaro.org> staging: alarm-dev: Implement compat_ioctl support

Implement compat_ioctl support for the alarm-dev ioctl.

Cc: Serban Constantinescu <serban.constantinescu@arm.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Colin Cross <ccross@google.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm-dev.c
ndroid_alarm.h
cec8bb73a2c603034b04b5d56e16878d0b0ef2dd 12-Jan-2013 John Stultz <john.stultz@linaro.org> staging: alarm-dev: Refactor alarm-dev ioctl code in prep for compat_ioctl

Cleanup the Android alarm-dev driver's ioctl code to refactor it
in preparation for compat_ioctl support.

Cc: Serban Constantinescu <serban.constantinescu@arm.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Colin Cross <ccross@google.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm-dev.c
be1a3e38ad7ba682f1a71e61ba16289061627217 12-Jan-2013 John Stultz <john.stultz@linaro.org> staging: alarm-dev: Drop pre Android 1.0 _OLD ioctls

Per Colin's comment:
"The "support old userspace code" comment for those two ioctls has
been there since pre-Android 1.0. Those apis are not exposed to
Android apps, I don't see any problem deleting them."

Thus this patch removes the ANDROID_ALARM_SET_OLD and
ANDROID_ALARM_SET_AND_WAIT_OLD ioctl compatability
logic.

Cc: Serban Constantinescu <serban.constantinescu@arm.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Colin Cross <ccross@google.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm-dev.c
d7f9729f6e06c9613a88a18c4e1fbbdf2f6146fd 22-Dec-2012 Cruz Julian Bishop <cruzjbishop@gmail.com> staging: android: Add some Kconfig help entries

This commit adds Kconfig entries for the following:

1: ANDROID_BINDER_IPC
2: ASHMEM (additional text)
3: ANDROID_LOGGER

It also changes "Register" to "Registers" in
ANDROID_LOW_MEMORY_KILLER

Finally, all "help" instances are changed to "---help---",
as recommended by kconfig-language.txt in order to visually
aid developers.

Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
config
167bccbd80b3625af5e7ec04ad4810321c1f300a 22-Dec-2012 Cruz Julian Bishop <cruzjbishop@gmail.com> staging: android: Fix two checkpatch issues in binder.c

This fixes two instances of
"static const char * array should probably be static const char * const"

I have seen other commits doing this in other files, so I am
assuming it should be done here as well.

Please tell me if this is wrong :)

Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
0f5afdd2389d983d38030ff95d2a07373a5550fc 22-Dec-2012 Cruz Julian Bishop <cruzjbishop@gmail.com> staging: android: Avoid using camelcase in binder.h

This changes the following:

1: BinderDriverReturnProtocol -> binder_driver_return_protocol
2: BinderDriverCommandProtocol -> binder_driver_return_protocol

These enums are not currently used, but still generate noise in checkpatch.

Well, did. They don't now :)

Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.h
d82603c6da7579c50ebe3fe7da6e3e267d9f6427 27-Dec-2012 Jorrit Schippers <jorrit@ncode.nl> treewide: Replace incomming with incoming in all comments and strings

Signed-off-by: Jorrit Schippers <jorrit@ncode.nl>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
inder.h
6a2b60b17b3e48a418695a94bd2420f6ab32e519 18-Dec-2012 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace

Pull user namespace changes from Eric Biederman:
"While small this set of changes is very significant with respect to
containers in general and user namespaces in particular. The user
space interface is now complete.

This set of changes adds support for unprivileged users to create user
namespaces and as a user namespace root to create other namespaces.
The tyranny of supporting suid root preventing unprivileged users from
using cool new kernel features is broken.

This set of changes completes the work on setns, adding support for
the pid, user, mount namespaces.

This set of changes includes a bunch of basic pid namespace
cleanups/simplifications. Of particular significance is the rework of
the pid namespace cleanup so it no longer requires sending out
tendrils into all kinds of unexpected cleanup paths for operation. At
least one case of broken error handling is fixed by this cleanup.

The files under /proc/<pid>/ns/ have been converted from regular files
to magic symlinks which prevents incorrect caching by the VFS,
ensuring the files always refer to the namespace the process is
currently using and ensuring that the ptrace_mayaccess permission
checks are always applied.

The files under /proc/<pid>/ns/ have been given stable inode numbers
so it is now possible to see if different processes share the same
namespaces.

Through the David Miller's net tree are changes to relax many of the
permission checks in the networking stack to allowing the user
namespace root to usefully use the networking stack. Similar changes
for the mount namespace and the pid namespace are coming through my
tree.

Two small changes to add user namespace support were commited here adn
in David Miller's -net tree so that I could complete the work on the
/proc/<pid>/ns/ files in this tree.

Work remains to make it safe to build user namespaces and 9p, afs,
ceph, cifs, coda, gfs2, ncpfs, nfs, nfsd, ocfs2, and xfs so the
Kconfig guard remains in place preventing that user namespaces from
being built when any of those filesystems are enabled.

Future design work remains to allow root users outside of the initial
user namespace to mount more than just /proc and /sys."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace: (38 commits)
proc: Usable inode numbers for the namespace file descriptors.
proc: Fix the namespace inode permission checks.
proc: Generalize proc inode allocation
userns: Allow unprivilged mounts of proc and sysfs
userns: For /proc/self/{uid,gid}_map derive the lower userns from the struct file
procfs: Print task uids and gids in the userns that opened the proc file
userns: Implement unshare of the user namespace
userns: Implent proc namespace operations
userns: Kill task_user_ns
userns: Make create_new_namespaces take a user_ns parameter
userns: Allow unprivileged use of setns.
userns: Allow unprivileged users to create new namespaces
userns: Allow setting a userns mapping to your current uid.
userns: Allow chown and setgid preservation
userns: Allow unprivileged users to create user namespaces.
userns: Ignore suid and sgid on binaries if the uid or gid can not be mapped
userns: fix return value on mntns_install() failure
vfs: Allow unprivileged manipulation of the mount namespace.
vfs: Only support slave subtrees across different user namespaces
vfs: Add a user namespace reference from struct mnt_namespace
...
608ff1a210ab0e8b969399039bf8e18693605910 12-Dec-2012 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'akpm' (Andrew's patchbomb)

Merge misc updates from Andrew Morton:
"About half of most of MM. Going very early this time due to
uncertainty over the coreautounifiednumasched things. I'll send the
other half of most of MM tomorrow. The rest of MM awaits a slab merge
from Pekka."

* emailed patches from Andrew Morton: (71 commits)
memory_hotplug: ensure every online node has NORMAL memory
memory_hotplug: handle empty zone when online_movable/online_kernel
mm, memory-hotplug: dynamic configure movable memory and portion memory
drivers/base/node.c: cleanup node_state_attr[]
bootmem: fix wrong call parameter for free_bootmem()
avr32, kconfig: remove HAVE_ARCH_BOOTMEM
mm: cma: remove watermark hacks
mm: cma: skip watermarks check for already isolated blocks in split_free_page()
mm, oom: fix race when specifying a thread as the oom origin
mm, oom: change type of oom_score_adj to short
mm: cleanup register_node()
mm, mempolicy: remove duplicate code
mm/vmscan.c: try_to_freeze() returns boolean
mm: introduce putback_movable_pages()
virtio_balloon: introduce migration primitives to balloon pages
mm: introduce compaction and migration for ballooned pages
mm: introduce a common interface for balloon pages mobility
mm: redefine address_space.assoc_mapping
mm: adjust address_space_operations.migratepage() return code
arch/sparc/kernel/sys_sparc_64.c: s/COLOUR/COLOR/
...
a9c58b907dbc6821533dfc295b63caf111ff1f16 12-Dec-2012 David Rientjes <rientjes@google.com> mm, oom: change type of oom_score_adj to short

The maximum oom_score_adj is 1000 and the minimum oom_score_adj is -1000,
so this range can be represented by the signed short type with no
functional change. The extra space this frees up in struct signal_struct
will be used for per-thread oom kill flags in the next patch.

Signed-off-by: David Rientjes <rientjes@google.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
Cc: Anton Vorontsov <anton.vorontsov@linaro.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
owmemorykiller.c
a3b41b7a3183b1f6a133e2c29502eae515f915e0 22-Nov-2012 Luca Clementi <luca.clementi@gmail.com> Staging: Android: logger: module_exit implementation

This patch creates the module_exit for the android logger
so that it can be loaded and unloaded as a module.

The android logger is already declared as a tristate in the
Kconfig but the module_exit function was missing.

device_initcall works also with modprobe since include/linux/init.h:

#define module_init(x) __initcall(x);
...
#define __initcall(fn) device_initcall(fn)

Tested against f4a75d2eb7b1e2206094b901be09adb31ba63681 Linux 3.7-rc6

Signed-off-by: Luca Clementi <luca.clementi@gmail.com>
Cc: Brian Swetland <swetland@google.com>
Cc: Robert Love <rlove@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ogger.c
17cf22c33e1f1b5e435469c84e43872579497653 02-Mar-2010 Eric W. Biederman <ebiederm@xmission.com> pidns: Use task_active_pid_ns where appropriate

The expressions tsk->nsproxy->pid_ns and task_active_pid_ns
aka ns_of_pid(task_pid(tsk)) should have the same number of
cache line misses with the practical difference that
ns_of_pid(task_pid(tsk)) is released later in a processes life.

Furthermore by using task_active_pid_ns it becomes trivial
to write an unshare implementation for the the pid namespace.

So I have used task_active_pid_ns everywhere I can.

In fork since the pid has not yet been attached to the
process I use ns_of_pid, to achieve the same effect.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
inder.c
acf1cf6a1c0966ef64a73083ca985605a12b032d 17-Nov-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org> Merge 3.7-rc6 into staging-next
d38e0e3fed4f58bcddef4dc93a591dfe2f651cb0 08-Nov-2012 Colin Cross <ccross@android.com> Revert "Staging: Android alarm: IOCTL command encoding fix"

Commit 6bd4a5d96c08dc2380f8053b1bd4f879f55cd3c9 changed the
ANDROID_ALARM_GET_TIME ioctls from IOW to IOR. While technically
correct, the _IOC_DIR bits are ignored by alarm_ioctl, so the
commit breaks a userspace ABI used by all existing Android devices
for a purely cosmetic reason. Revert it.

Cc: stable <stable@vger.kernel.org>
Cc: Dae S. Kim <dae@velatum.com>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ndroid_alarm.h
56b468fc709b2b962cd91e6cd9f087c3cd095283 30-Oct-2012 Anmol Sarma <unmole.in@gmail.com> Staging: android: binder: Fixed multi-line strings

Changed all user visible multi-line strings to single line.
Removed 'binder:' prefix on stings.

Signed-off-by: Anmol Sarma <unmole.in@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
cb1f6268acd7f1bca7153fa9ca187ffb73f60ab8 29-Oct-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org> Merge 3.7-rc3 into staging-next

This resolves the conflict with:
drivers/staging/comedi/drivers/amplc_dio200.c
and syncs up the changes that happened in the staging directory for
3.7-rc3.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
585650dcec88e704a19bb226a34b6a7166111623 17-Oct-2012 Arve Hjønnevåg <arve@android.com> Staging: android: binder: Allow using highmem for binder buffers

The default kernel mapping for the pages allocated for the binder
buffers is never used. Set the __GFP_HIGHMEM flag when allocating
these pages so we don't needlessly use low memory pages that may
be required elsewhere.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
675d66b0ed5fd170d6a44cf8dbb3fa56a5347bdb 17-Oct-2012 Arve Hjønnevåg <arve@android.com> Staging: android: binder: Fix memory leak on thread/process exit

If a thread or process exited while a reply, one-way transaction or
death notification was pending, the struct holding the pending work
was leaked.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
975a1ac9a9fe65d66ee1726c0db6dc58e53d232a 17-Oct-2012 Arve Hjønnevåg <arve@android.com> Staging: android: binder: Add some tracepoints

Add tracepoints:
- ioctl entry and exit
- Main binder lock: lock, locked and unlock
- Command and return buffer opcodes
- Transaction: create and receive
- Transaction buffer: create and free
- Object and file descriptor transfer
- binder_update_page_range

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
akefile
inder.c
inder_trace.h
89334ab4d389c008d291eb8682914c759851ee34 17-Oct-2012 Arve Hjønnevåg <arve@android.com> Staging: android: binder: Add some missing binder_stat_br calls

Cached thread return errors, death notifications and new looper
requests were not included in the stats.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
0b173bc4daa8f8ec03a85abf5e47b23502ff80af 09-Oct-2012 Konstantin Khlebnikov <khlebnikov@openvz.org> mm: kill vma flag VM_CAN_NONLINEAR

Move actual pte filling for non-linear file mappings into the new special
vma operation: ->remap_pages().

Filesystems must implement this method to get non-linear mapping support,
if it uses filemap_fault() then generic_file_remap_pages() can be used.

Now device drivers can implement this method and obtain nonlinear vma support.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Carsten Otte <cotte@de.ibm.com>
Cc: Chris Metcalf <cmetcalf@tilera.com> #arch/tile
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Eric Paris <eparis@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Morris <james.l.morris@oracle.com>
Cc: Jason Baron <jbaron@redhat.com>
Cc: Kentaro Takeda <takedakn@nttdata.co.jp>
Cc: Matt Helsley <matthltc@us.ibm.com>
Cc: Nick Piggin <npiggin@kernel.dk>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Venkatesh Pallipadi <venki@google.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
shmem.c
aab174f0df5d72d31caccf281af5f614fa254578 03-Oct-2012 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull vfs update from Al Viro:

- big one - consolidation of descriptor-related logics; almost all of
that is moved to fs/file.c

(BTW, I'm seriously tempted to rename the result to fd.c. As it is,
we have a situation when file_table.c is about handling of struct
file and file.c is about handling of descriptor tables; the reasons
are historical - file_table.c used to be about a static array of
struct file we used to have way back).

A lot of stray ends got cleaned up and converted to saner primitives,
disgusting mess in android/binder.c is still disgusting, but at least
doesn't poke so much in descriptor table guts anymore. A bunch of
relatively minor races got fixed in process, plus an ext4 struct file
leak.

- related thing - fget_light() partially unuglified; see fdget() in
there (and yes, it generates the code as good as we used to have).

- also related - bits of Cyrill's procfs stuff that got entangled into
that work; _not_ all of it, just the initial move to fs/proc/fd.c and
switch of fdinfo to seq_file.

- Alex's fs/coredump.c spiltoff - the same story, had been easier to
take that commit than mess with conflicts. The rest is a separate
pile, this was just a mechanical code movement.

- a few misc patches all over the place. Not all for this cycle,
there'll be more (and quite a few currently sit in akpm's tree)."

Fix up trivial conflicts in the android binder driver, and some fairly
simple conflicts due to two different changes to the sock_alloc_file()
interface ("take descriptor handling from sock_alloc_file() to callers"
vs "net: Providing protocol type via system.sockprotoname xattr of
/proc/PID/fd entries" adding a dentry name to the socket)

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (72 commits)
MAX_LFS_FILESIZE should be a loff_t
compat: fs: Generic compat_sys_sendfile implementation
fs: push rcu_barrier() from deactivate_locked_super() to filesystems
btrfs: reada_extent doesn't need kref for refcount
coredump: move core dump functionality into its own file
coredump: prevent double-free on an error path in core dumper
usb/gadget: fix misannotations
fcntl: fix misannotations
ceph: don't abuse d_delete() on failure exits
hypfs: ->d_parent is never NULL or negative
vfs: delete surplus inode NULL check
switch simple cases of fget_light to fdget
new helpers: fdget()/fdput()
switch o2hb_region_dev_write() to fget_light()
proc_map_files_readdir(): don't bother with grabbing files
make get_file() return its argument
vhost_set_vring(): turn pollstart/pollstop into bool
switch prctl_set_mm_exe_file() to fget_light()
switch xfs_find_handle() to fget_light()
switch xfs_swapext() to fget_light()
...
437589a74b6a590d175f86cf9f7b2efcee7765e7 02-Oct-2012 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace

Pull user namespace changes from Eric Biederman:
"This is a mostly modest set of changes to enable basic user namespace
support. This allows the code to code to compile with user namespaces
enabled and removes the assumption there is only the initial user
namespace. Everything is converted except for the most complex of the
filesystems: autofs4, 9p, afs, ceph, cifs, coda, fuse, gfs2, ncpfs,
nfs, ocfs2 and xfs as those patches need a bit more review.

The strategy is to push kuid_t and kgid_t values are far down into
subsystems and filesystems as reasonable. Leaving the make_kuid and
from_kuid operations to happen at the edge of userspace, as the values
come off the disk, and as the values come in from the network.
Letting compile type incompatible compile errors (present when user
namespaces are enabled) guide me to find the issues.

The most tricky areas have been the places where we had an implicit
union of uid and gid values and were storing them in an unsigned int.
Those places were converted into explicit unions. I made certain to
handle those places with simple trivial patches.

Out of that work I discovered we have generic interfaces for storing
quota by projid. I had never heard of the project identifiers before.
Adding full user namespace support for project identifiers accounts
for most of the code size growth in my git tree.

Ultimately there will be work to relax privlige checks from
"capable(FOO)" to "ns_capable(user_ns, FOO)" where it is safe allowing
root in a user names to do those things that today we only forbid to
non-root users because it will confuse suid root applications.

While I was pushing kuid_t and kgid_t changes deep into the audit code
I made a few other cleanups. I capitalized on the fact we process
netlink messages in the context of the message sender. I removed
usage of NETLINK_CRED, and started directly using current->tty.

Some of these patches have also made it into maintainer trees, with no
problems from identical code from different trees showing up in
linux-next.

After reading through all of this code I feel like I might be able to
win a game of kernel trivial pursuit."

Fix up some fairly trivial conflicts in netfilter uid/git logging code.

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace: (107 commits)
userns: Convert the ufs filesystem to use kuid/kgid where appropriate
userns: Convert the udf filesystem to use kuid/kgid where appropriate
userns: Convert ubifs to use kuid/kgid
userns: Convert squashfs to use kuid/kgid where appropriate
userns: Convert reiserfs to use kuid and kgid where appropriate
userns: Convert jfs to use kuid/kgid where appropriate
userns: Convert jffs2 to use kuid and kgid where appropriate
userns: Convert hpfs to use kuid and kgid where appropriate
userns: Convert btrfs to use kuid/kgid where appropriate
userns: Convert bfs to use kuid/kgid where appropriate
userns: Convert affs to use kuid/kgid wherwe appropriate
userns: On alpha modify linux_to_osf_stat to use convert from kuids and kgids
userns: On ia64 deal with current_uid and current_gid being kuid and kgid
userns: On ppc convert current_uid from a kuid before printing.
userns: Convert s390 getting uid and gid system calls to use kuid and kgid
userns: Convert s390 hypfs to use kuid and kgid where appropriate
userns: Convert binder ipc to use kuids
userns: Teach security_path_chown to take kuids and kgids
userns: Add user namespace support to IMA
userns: Convert EVM to deal with kuids and kgids in it's hmac computation
...
483ce1d4b8c3b82bc9c9a1dd9dbc44f50b3aaf5a 19-Aug-2012 Al Viro <viro@zeniv.linux.org.uk> take descriptor-related part of close() to file.c

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
inder.c
f869e8a7f753e3fd43d6483e796774776f645edb 16-Aug-2012 Al Viro <viro@zeniv.linux.org.uk> expose a low-level variant of fd_install() for binder

Similar situation to that of __alloc_fd(); do not use unless you
really have to. You should not touch any descriptor table other
than your own; it's a sure sign of a really bad API design.

As with __alloc_fd(), you *must* use a first-class reference to
struct files_struct; something obtained by get_files_struct(some task)
(let alone direct task->files) will not do. It must be either
current->files, or obtained by get_files_struct(current) by the
owner of that sucker and given to you.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
inder.c
dcfadfa4ec5a12404a99ad6426871a6b03a62b37 12-Aug-2012 Al Viro <viro@zeniv.linux.org.uk> new helper: __alloc_fd()

Essentially, alloc_fd() in a files_struct we own a reference to.
Most of the time wanting to use it is a sign of lousy API
design (such as android/binder). It's *not* a general-purpose
interface; better that than open-coding its guts, but again,
playing with other process' descriptor table is a sign of bad
design.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
inder.c
a79f41ed9786b75ebe75e52295ad54049b8551b6 16-Aug-2012 Al Viro <viro@zeniv.linux.org.uk> binder: don't allow mmap() by process other than proc->tsk

we really shouldn't do get_files_struct() on a different process
and use it to modify the sucker later on.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
inder.c
4a2ebb93bf0ae67b4b49f1974a525523eb923da0 26-May-2012 Eric W. Biederman <ebiederm@xmission.com> userns: Convert binder ipc to use kuids

Cc: Arve Hjønnevåg <arve@android.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
inder.c
6a2a2cdd57d11ee3117539b846a45df6efbd35b1 17-Sep-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org> Merge 3.6-rc6 into staging-next

This pulls in the staging tree fixes in 3.6-rc6 into our branch to resolve the
merge issues.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
147cd165757fc67fdf8ae58b015f39c8134970fb 29-Aug-2012 Dae S. Kim <dae@velatum.com> Staging: android: Alarm driver cleanups

Little cleanups. Enum value ANDROID_ALARM_TYPE_COUNT was treated as
an alarm type within a switch statement. That condition was unreachable
though.

Signed-off-by: Dae S. Kim <dae@velatum.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm-dev.c
6bd4a5d96c08dc2380f8053b1bd4f879f55cd3c9 31-Aug-2012 Dae S. Kim <dae@velatum.com> Staging: Android alarm: IOCTL command encoding fix

Fixed a bug. Data was being written to user space using an IOCTL
command encoded with _IOC_WRITE access mode.

Signed-off-by: Dae S. Kim <dae@velatum.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ndroid_alarm.h
bf2023614201b36f929cce0d9fbb3cc856ea7c1a 17-Aug-2012 Sachin Kamat <sachin.kamat@linaro.org> Staging: android: binder: Remove an inconsequential conditional macro

Removes an inconsequential conditional macro.

Cc: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
efde99cd281a3f0d3562bb2fa7e7ef60ad32fe8d 17-Aug-2012 Sachin Kamat <sachin.kamat@linaro.org> Staging: android: binder: Make task_get_unused_fd_flags function static

Silence the following warning:
drivers/staging/android/binder.c:368:5: warning:
symbol 'task_get_unused_fd_flags' was not declared. Should it be static?

Cc: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
0edc6c6d545f2615d9239d5ea350d7ed833ee539 01-Aug-2012 Cruz Julian Bishop <cruzjbishop@gmail.com> staging: android: logger: Finish documentation of two structs

Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ogger.c
adb913658f5cecc02dd8f36aa9edecb3e9fd3399 01-Aug-2012 Cruz Julian Bishop <cruzjbishop@gmail.com> staging: android: logger.h: Complete documentation of logger_entry

Previously, there were simply comments after each part - Now, it is
completed properly according to "Kernel doc" Sorry in advance if I made
any mistakes.

Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ogger.h
2258937b2137214bae796ec929394a282f531ed7 01-Aug-2012 Cruz Julian Bishop <cruzjbishop@gmail.com> staging: android: ashmem: Fix comment/license formatting

Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
shmem.c
c21be47c834bc411339ee04462ec7c5246e58596 20-Jul-2012 Devendra Naga <develkernel412222@gmail.com> staging/android: use module_platform_driver

as the init and exit functions just do a platform_driver_register and
platform_driver_unregister, and nothing else, so its better to
use the module_platform_driver macro rather replicating its implementation

Signed-off-by: Devendra Naga <develkernel412222@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
imed_gpio.c
258767fed9da230553d92e2d53f5f872d55795b1 26-Jun-2012 Sherwin Soltani <sherwin@wybc.com> drivers: staging: android: binder.c: fix printk macros

Change printk() messages to pr_* macros.

Signed-off-by: Sherwin Soltani <sherwin@wybc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
15d76446205710ddfcba6cc9156c7883074f84b1 26-May-2012 Anton Vorontsov <anton.vorontsov@linaro.org> staging/android: Remove ram_console driver

All the functionality is now supported by pstore and pstore_ram drivers.

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Acked-by: Kees Cook <keescook@chromium.org>
Acked-by: Colin Cross <ccross@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
config
akefile
am_console.c
71f882fe71823c54ae095ce29ce050f814eefdbc 19-May-2012 Devendra Naga <devendra.aaru@gmail.com> staging: android: alarm: remove unnecessary goto statement

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm-dev.c
592314e9e1c0057bdb75ff00cbd1c51aa06c65e7 05-Jun-2012 Sachin Kamat <sachin.kamat@linaro.org> staging: Android: Fix NULL pointer related warning in alarm-dev.c file

Fixes the following sparse warning:
drivers/staging/android/alarm-dev.c:259:35: warning: Using plain integer as NULL pointer

Cc: Brian Swetland <swetland@google.com>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm-dev.c
c810a399798022d545191e2daaca0368623c15d3 05-Jun-2012 Sachin Kamat <sachin.kamat@linaro.org> staging: Android: Fix some checkpatch warnings

Warnings reported by checkpatch.pl have been fixed.

Cc: Brian Swetland <swetland@google.com>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
shmem.c
ogger.c
am_console.c
imed_output.c
8a7245ea2c48641257ff149569b56650d0cfc99c 20-May-2012 Joe Perches <joe@perches.com> Staging: android: alarm: Rename pr_alarm to alarm_dbg

Rename a macro to make it explicit it's for debugging.

Use %s: __func__ instead of embedding function names.
Coalesce formats, align arguments.

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm-dev.c
3f31d07571eeea18a7d34db9af21d2285b807a17 30-May-2012 Hugh Dickins <hughd@google.com> mm/fs: route MADV_REMOVE to FALLOC_FL_PUNCH_HOLE

Now tmpfs supports hole-punching via fallocate(), switch madvise_remove()
to use do_fallocate() instead of vmtruncate_range(): which extends
madvise(,,MADV_REMOVE) support from tmpfs to ext4, ocfs2 and xfs.

There is one more user of vmtruncate_range() in our tree,
staging/android's ashmem_shrink(): convert it to use do_fallocate() too
(but if its unpinned areas are already unmapped - I don't know - then it
would do better to use shmem_truncate_range() directly).

Based-on-patch-by: Cong Wang <amwang@redhat.com>
Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Colin Cross <ccross@android.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Greg Kroah-Hartman <gregkh@linux-foundation.org>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Andreas Dilger <adilger@dilger.ca>
Cc: Mark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Ben Myers <bpm@sgi.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
shmem.c
ab11ca34eea8fda7a1a9302d86f6ef6108ffd68f 24-May-2012 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media updates from Mauro Carvalho Chehab:
- some V4L2 API updates needed by embedded devices
- DVB API extensions for ATSC-MH delivery system, used in US for mobile
TV
- new tuners for fc0011/0012/0013 and tua9001
- a new dvb driver for af9033/9035
- a new ATSC-MH frontend (lg2160)
- new remote controller keymaps
- Removal of a few legacy webcam driver that got replaced by gspca on
several kernel versions ago
- a new driver for Exynos 4/5 webcams(s5pp fimc-lite)
- a new webcam sensor driver (smiapp)
- a new video input driver for embedded (sta2x1xx)
- several improvements, fixes, cleanups, etc inside the drivers.

Manually fix up conflicts due to err() -> dev_err() conversion in
drivers/staging/media/easycap/easycap_main.c

* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (484 commits)
[media] saa7134-cards: Remove a PCI entry added by mistake
[media] radio-sf16fmi: add support for SF16-FMD
[media] rc-loopback: remove duplicate line
[media] patch for Asus My Cinema PS3-100 (1043:48cd)
[media] au0828: Move the Kconfig knob under V4L_USB_DRIVERS
[media] em28xx: simple comment fix
[media] [resend] radio-sf16fmr2: add PnP support for SF16-FMD2
[media] smiapp: Use v4l2_ctrl_new_int_menu() instead of v4l2_ctrl_new_custom()
[media] smiapp: Add support for 8-bit uncompressed formats
[media] smiapp: Allow generic quirk registers
[media] smiapp: Use non-binning limits if the binning limit is zero
[media] smiapp: Initialise rval in smiapp_read_nvm()
[media] smiapp: Round minimum pre_pll up rather than down in ip_clk_freq check
[media] smiapp: Use 8-bit reads only before identifying the sensor
[media] smiapp: Quirk for sensors that only do 8-bit reads
[media] smiapp: Pass struct sensor to register writing commands instead of i2c_client
[media] smiapp: Allow using external clock from the clock framework
[media] zl10353: change .read_snr() to report SNR as a 0.1 dB
[media] media: add support to gspca/pac7302.c for 093a:2627 (Genius FaceCam 300)
[media] m88rs2000 - only flip bit 2 on reg 0x70 on 16th try
...
fb09bafda67041b74a668dc9d77735e36bd33d3b 23-May-2012 Linus Torvalds <torvalds@linux-foundation.org> Merge tag 'staging-3.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging tree changes from Greg Kroah-Hartman:
"Here is the big staging tree pull request for the 3.5-rc1 merge
window.

Loads of changes here, and we just narrowly added more lines than we
added:
622 files changed, 28356 insertions(+), 26059 deletions(-)

But, good news is that there is a number of subsystems that moved out
of the staging tree, to their respective "real" portions of the
kernel.

Code that moved out was:
- iio core code
- mei driver
- vme core and bridge drivers

There was one broken network driver that moved into staging as a step
before it is removed from the tree (pc300), and there was a few new
drivers added to the tree:
- new iio drivers
- gdm72xx wimax USB driver
- ipack subsystem and 2 drivers

All of the movements around have acks from the various subsystem
maintainers, and all of this has been in the linux-next tree for a
while.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"

Fixed up various trivial conflicts, along with a non-trivial one found
in -next and pointed out by Olof Johanssen: a clean - but incorrect -
merge of the arch/arm/boot/dts/at91sam9g20.dtsi file. Fix up manually
as per Stephen Rothwell.

* tag 'staging-3.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (536 commits)
Staging: bcm: Remove two unused variables from Adapter.h
Staging: bcm: Removes the volatile type definition from Adapter.h
Staging: bcm: Rename all "INT" to "int" in Adapter.h
Staging: bcm: Fix warning: __packed vs. __attribute__((packed)) in Adapter.h
Staging: bcm: Correctly format all comments in Adapter.h
Staging: bcm: Fix all whitespace issues in Adapter.h
Staging: bcm: Properly format braces in Adapter.h
Staging: ipack/bridges/tpci200: remove unneeded casts
Staging: ipack/bridges/tpci200: remove TPCI200_SHORTNAME constant
Staging: ipack: remove board_name and bus_name fields from struct ipack_device
Staging: ipack: improve the register of a bus and a device in the bus.
staging: comedi: cleanup all the comedi_driver 'detach' functions
staging: comedi: remove all 'default N' in Kconfig
staging: line6/config.h: Delete unused header
staging: gdm72xx depends on NET
staging: gdm72xx: Set up parent link in sysfs for gdm72xx devices
staging: drm/omap: initial dmabuf/prime import support
staging: drm/omap: dmabuf/prime mmap support
pstore/ram: Add ECC support
pstore/ram: Switch to persistent_ram routines
...
cddb8751c80348df75149f44fc3bf38d3dd1f3e6 17-May-2012 Anton Vorontsov <anton.vorontsov@linaro.org> staging: android: persistent_ram: Move to fs/pstore/ram_core.c

This is a first step for adding ECC support for pstore RAM backend: we
will use the persistent_ram routines, kindly provided by Google.

Basically, persistent_ram is a set of helper routines to deal with the
[optionally] ECC-protected persistent ram regions.

A bit of Makefile, Kconfig and header files adjustments were needed
because of the move.

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
config
akefile
ersistent_ram.c
ersistent_ram.h
am_console.c
7dd8e9be9dba1dc5f0dfec67e37076b9c56a97d7 16-May-2012 Anton Vorontsov <anton.vorontsov@linaro.org> staging: android: persistent_ram: Prepare for modular builds

This is a transition patch to keep things bisectable, just moves
some routines under '#ifndef MODULE'. The code inside the #ifndef
will go away soon, but so far we must support pstore and ram_console.

So, we are about to use persistent_ram with pstore, with the ability
to compile persistent_ram routines as modules. Some parts of
persistent_ram uses memblock_reserve() routine, which is should be
only used built-in code, and thus it is not exported.

These persistent_ram bits are only used by Android's ram_console,
which is always built-in.

Without this patch, we won't able to compile persistent_ram as a
module:

ERROR: "memblock_reserve" [fs/pstore/ramoops.ko] undefined!
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2

(As alternative, we could export memblock_reserve, but the thing
is: we won't need it later.)

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ersistent_ram.c
2717fca171b737c94a143dbad85e04781154c74b 16-May-2012 Anton Vorontsov <anton.vorontsov@linaro.org> staging: android: persistent_ram: Remove never used struct persistent_ram_zone members

Remove 'old_log_footer_size' and 'early' members of struct
persistent_ram_zone, as these were never used at all.

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ersistent_ram.h
d3b487695120b5342067244253697eabb121436d 12-May-2012 Anton Vorontsov <anton.vorontsov@linaro.org> staging: android: persistent_ram: Introduce persistent_ram_free()

A corresponding function to persistent_ram_new().

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ersistent_ram.c
ersistent_ram.h
24c3d2f342edbc10fee9f8ab9e0a033393686543 12-May-2012 Anton Vorontsov <anton.vorontsov@linaro.org> staging: android: persistent_ram: Make it possible to use memory outside of bootmem

This includes devices' memory (e.g. framebuffers or memory mapped
EEPROMs on a local bus), as well as the normal RAM that we don't use
for the main memory.

For the normal (but unused) ram we could use kmaps, but this assumes
highmem support, so we don't bother and just use the memory via
ioremap.

As a side effect, the following hack is possible: when used together
with pstore_ram (new ramoops) module, we can limit the normal RAM region
with mem= and then point ramoops to use the rest of the memory, e.g.

mem=128M ramoops.mem_address=0x8000000

Sure, we could just reserve the region with memblock_reserve() early in
the arch/ code, and then register a pstore_ram platform device pointing
to the reserved region. It's still a viable option if platform wants
to do so.

Also, we might want to use IO accessors in case of a real device,
but for now we don't bother (the old ramoops wasn't using it either, so
at least we don't make things worse).

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ersistent_ram.c
2b1321e4714cc03d298e1b06c1457f8786c083ed 12-May-2012 Anton Vorontsov <anton.vorontsov@linaro.org> staging: android: persistent_ram: Introduce persistent_ram_vmap()

Factor out vmap logic out of persistent_ram_buffer_map(), this will
make the code a bit more understandable when we'll add support for
non-bootmem memory.

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ersistent_ram.c
8cf5aff89e5991aa4bec903b6dbab7d248047d98 12-May-2012 Anton Vorontsov <anton.vorontsov@linaro.org> staging: android: persistent_ram: Introduce persistent_ram_new()

The routine just creates a persistent ram zone at a specified address.

For persistent_ram_init_ringbuffer() we'd need to add a
'struct persistent_ram' to the global list, and associate it with a
device. We don't need all this complexity in pstore_ram, so we introduce
the simple function.

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ersistent_ram.c
ersistent_ram.h
bb4206f2042d950a7af1560200af81aa59172a84 12-May-2012 Anton Vorontsov <anton.vorontsov@linaro.org> staging: android: persistent_ram: Introduce persistent_ram_post_init()

Factor post init logic out of __persistent_ram_init(), we'll need
it for the new persistent_ram_new() routine.

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ersistent_ram.c
484dd30e016eb425b0de871357fff2c9bb93be45 12-May-2012 Anton Vorontsov <anton.vorontsov@linaro.org> persistent_ram: Fix buffer size clamping during writes

This is a longstanding bug, almost unnoticeable when calling
persistent_ram_write() for small buffers.

But when called for large data buffers, the write routine behaves
incorrectly, as the size may never update: instead of clamping
the size to the maximum buffer size, buffer_size_add_clamp() returns
an error (which is never checked by the write routine, btw).

To fix this, we now use buffer_size_add() that actually clamps the
size to the max value.

Also remove buffer_size_add_clamp(), it is no longer needed.

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Acked-by: Colin Cross <ccross@android.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ersistent_ram.c
06f3d3bdee9bac871c556c34ea80303033c474b3 12-May-2012 Anton Vorontsov <anton.vorontsov@linaro.org> persistent_ram: Remove prz->node

The 'node' struct member is unused, so remove it.

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ersistent_ram.c
ersistent_ram.h
e7f3eb0c912ca334fa67429a060389cbea6e815d 10-May-2012 Tim Bird <tim.bird@am.sony.com> staging: android: logger: Fix some sparse and whitespace issues

Fix a few sparse warnings, and improve whitespace.

Cc: Brian Swetland <swetland@google.com>
Signed-off-by: Tim Bird <tim.bird@am.sony.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ogger.c
10b241991fc10876b46ab7ca690f44281510d85b 11-May-2012 Tim Bird <tim.bird@am.sony.com> staging: android: logger: Allocate logs dynamically at boot (v3)

This changes the log initialization to be dynamic, but still
at boot time. These changes are a predecessor to implementing
runtime allocation and freeing of logs, to make the Android logger
less hard-coded.

Change from a fixed set of static log structures, to allocation
at init time into a list. Return proper error numbers on log
allocation failure.

Cc: Brian Swetland <swetland@google.com>
Signed-off-by: Tim Bird <tim.bird@am.sony.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ogger.c
eb1574270a6de8fb8d31ffc3b021e30df0afcda3 02-May-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org> Merge 3.4-rc5 into driver-core-next

This was done to resolve a merge issue with the init/main.c file.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
d210267741fb2a8b6d741d9040703683a39087f4 02-May-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org> Merge 3.4-rc5 into staging-next

This resolves the conflict in:
drivers/staging/vt6656/ioctl.c

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
d9a861d55e0cf60829956d7c6e18b7de0b02ab92 27-Apr-2012 Kim, Milo <Milo.Kim@ti.com> staging: android: timed_output : disable the timed output device when the device is unregistered

(Life cycle of timed output device driver)

1) register the device as the timed output
2) enable() ops is called via the sysfs
timeout > 0 : timer is activated and device is turned on
timeout = 0 : timer is cancelled and device is off
3) unregister the timed output device if not used any more

So the registered device should be disabled explicitly when the module is removed.
('disabled' means the timer is stopped and the device is turned off)

Rather than implementing that code in each driver,
just call enable() with timeout = 0 to clean up the driver.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Cc: Mike Lockwood <lockwood@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
imed_output.c
78aee0fc9a2ee913ef8c524c380a72ee693dd6cb 24-Apr-2012 Emil Goode <emilgoode@gmail.com> staging: android: binder: fix sparse warnings

Fix sparse warnings by adding __user annotation to stucts.

This patch fixes the the following sparse warnings:

drivers/staging/android/binder.c:1343:76: warning:
incorrect type in argument 2 (different address spaces)
drivers/staging/android/binder.c:1343:76:
expected void [noderef] <asn:1>*ptr
drivers/staging/android/binder.c:1343:76: got void *binder
drivers/staging/android/binder.c:1567:57: warning:
incorrect type in argument 2 (different address spaces)
drivers/staging/android/binder.c:1567:57:
expected void const [noderef] <asn:1>*from
drivers/staging/android/binder.c:1567:57:
got void const *buffer
drivers/staging/android/binder.c:1573:46: warning:
incorrect type in argument 2 (different address spaces)
drivers/staging/android/binder.c:1573:46:
expected void const [noderef] <asn:1>*from
drivers/staging/android/binder.c:1573:46:
got void const *offsets
drivers/staging/android/binder.c:1603:76: warning:
incorrect type in argument 2 (different address spaces)
drivers/staging/android/binder.c:1603:76:
expected void [noderef] <asn:1>*ptr
drivers/staging/android/binder.c:1603:76: got void *binder
drivers/staging/android/binder.c:1605:64: warning:
incorrect type in argument 2 (different address spaces)
drivers/staging/android/binder.c:1605:64:
expected void [noderef] <asn:1>*ptr
drivers/staging/android/binder.c:1605:64: got void *binder
drivers/staging/android/binder.c:1605:76: warning:
incorrect type in argument 3 (different address spaces)
drivers/staging/android/binder.c:1605:76:
expected void [noderef] <asn:1>*cookie
drivers/staging/android/binder.c:1605:76: got void *cookie
drivers/staging/android/binder.c:1613:40: error:
incompatible types in comparison

Signed-off-by: Emil Goode <emilgoode@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.h
a180c0d659f604568637336a00c0c3ca2f7b094a 24-Apr-2012 John Stultz <john.stultz@linaro.org> staging: android-alarm: Switch from wakelocks to wakeup sources

In their current AOSP tree, the Android in-kernel wakelock
infrastructure has been reimplemented in terms of wakeup
sources:
http://git.linaro.org/gitweb?p=people/jstultz/android.git;a=commitdiff;h=e9911f4efdc55af703b8b3bb8c839e6f5dd173bb

The Android alarm driver currently has stubbed out calls
to wakelock functionality. So this patch simply converts
the stubbed out wakelock calls to wakeup source calls, and
removes the empty wakelock macros

Greg, would you mind queuing this in staging-next?

CC: Colin Cross <ccross@android.com>
CC: Arve Hjønnevåg <arve@android.com>
CC: Greg KH <gregkh@linuxfoundation.org>
CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm-dev.c
449a2bf5e881b2a00d42a7c0baa67119c8cb5dce 23-Apr-2012 MyungJoo Ham <myungjoo.ham@samsung.com> Remove "switch" class in drivers/staging/android/switch

Because extcon can also be a switch class for legacy userspace (Android)
and is a superset of switch class in drivers/staging/android/switch,
switch class may be removed.

- Remove switch class
- Remove switch class consideration in extcon class

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
config
akefile
witch/Kconfig
witch/Makefile
witch/switch.h
witch/switch_class.c
witch/switch_gpio.c
ef2353d26bdc44c78713da1a6eb2325ba9dac6f7 20-Apr-2012 John Stultz <john.stultz@linaro.org> android-alarm: Remove unused android alarm in-kernel interfaces

Now that alarm-dev.c uses the upstreamed alarmtimer interfaces,
we can remove the otherwise unused in-kernel android alarm api.

CC: Colin Cross <ccross@android.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
config
akefile
larm.c
ndroid_alarm.h
b8793260980b0fc356af3bf11abea82650b0d595 20-Apr-2012 John Stultz <john.stultz@linaro.org> staging: android-alarm: Rework alarm-dev.c to use upstreamed alarmtimers

This reworks the alarm-dev.c to use the upstreamed alarmtimers
interface.

CC: Colin Cross <ccross@android.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm-dev.c
e2d8ccef0a8e8aedaf401edca6ad54663b0da24b 20-Apr-2012 John Stultz <john.stultz@linaro.org> staging: android-alarm: Convert ALARM_ELAPSED_REALTIME to use CLOCK_BOOTTIME

The ALARM_ELAPSED_REALTIME clock domain in Android pointed
to the need for something similar in linux system-wide
(instead of limited to just the alarm interface).

Thus CLOCK_BOOTTIME was introduced into the upstream kernel
in 2.6.39.

This patch attempts to convert the android alarm timer to utilize
the kernel's CLOCK_BOOTTIME clockid for ALARM_ELAPSED_REALTIME,
instead of managing it itself.

CC: Colin Cross <ccross@android.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm-dev.c
larm.c
ndroid_alarm.h
d5aeee8cb28317ef608ecac421abc4d986d585d2 19-Apr-2012 Mauro Carvalho Chehab <mchehab@redhat.com> Merge tag 'v3.4-rc3' into staging/for_v3.5

* tag 'v3.4-rc3': (3755 commits)
Linux 3.4-rc3
x86-32: fix up strncpy_from_user() sign error
ARM: 7386/1: jump_label: fixup for rename to static_key
ARM: 7384/1: ThumbEE: Disable userspace TEEHBR access for !CONFIG_ARM_THUMBEE
ARM: 7382/1: mm: truncate memory banks to fit in 4GB space for classic MMU
ARM: 7359/2: smp_twd: Only wait for reprogramming on active cpus
PCI: Fix regression in pci_restore_state(), v3
SCSI: Fix error handling when no ULD is attached
ARM: OMAP: clock: cleanup CPUfreq leftovers, fix build errors
ARM: dts: remove blank interrupt-parent properties
ARM: EXYNOS: Fix Kconfig dependencies for device tree enabled machine files
do not export kernel's NULL #define to userspace
ARM: EXYNOS: Remove broken config values for touchscren for NURI board
ARM: EXYNOS: set fix xusbxti clock for NURI and Universal210 boards
ARM: EXYNOS: fix regulator name for NURI board
ARM: SAMSUNG: make SAMSUNG_PM_DEBUG select DEBUG_LL
cpufreq: OMAP: fix build errors: depends on ARCH_OMAP2PLUS
sparc64: Eliminate obsolete __handle_softirq() function
sparc64: Fix bootup crash on sun4v.
ARM: msm: Fix section mismatches in proc_comm.c
...
15ecf29e1666ac0c18625ad276423c0291536543 17-Apr-2012 Randy Dunlap <rdunlap@xenotime.net> staging: fix android alarm.c printk format warnings

Fix printk format warnings by using 't' modifier for ptrdiff_t.

drivers/staging/android/alarm.c:344:2: warning: format '%ld' expects type 'long int', but argument 2 has type 'int'
drivers/staging/android/alarm.c:367:3: warning: format '%ld' expects type 'long int', but argument 2 has type 'int'

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Cc: Brian Swetland <swetland@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm.c
ad220db422c778a30f83061e9e2458b5f0ee6704 16-Apr-2012 Masanari Iida <standby24x7@gmail.com> staging: Fix typo within android drivers.

Fix spelling typo in comments within android drivers.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm-dev.c
larm.c
ndroid_alarm.h
inder.h
3dbc35a339d7c8c756cb159b9ba076fac4e7faeb 13-Apr-2012 Linus Torvalds <torvalds@linux-foundation.org> Merge tag 'staging-3.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging tree fixes from Greg KH:
"Here are a number of bugfixes for the drivers/staging/ portion of the
kernel that have been reported recently.

Nothing major here, with maybe the exception of the ramster code can
now be built so it is enabled in the build again, and lots of memory
leaks that people like to have fixed on their systems.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"

* tag 'staging-3.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
staging: android: fix mem leaks in __persistent_ram_init()
staging: vt6656: Don't leak memory in drivers/staging/vt6656/ioctl.c::private_ioctl()
staging: iio: hmc5843: Fix crash in probe function.
staging/xgifb: fix display on XGI Volari Z11m cards
Staging: android: timed_gpio: Fix resource leak in timed_gpio_probe error paths
android: make persistent_ram based drivers depend on HAVE_MEMBLOCK
staging: iio: ak8975: Remove i2c client data corruption
staging: drm/omap: move where DMM driver is registered
staging: zsmalloc: fix memory leak
Staging: rts_pstor: off by one in for loop
staging: ozwpan: Added new maintainer for ozwpan
staging:rts_pstor:Avoid "Bad target number" message when probing driver
staging:rts_pstor:Fix possible panic by NULL pointer dereference
Staging: vt6655-6: check keysize before memcpy()
staging/media/as102: Don't call release_firmware() on uninitialized variable
staging:iio:core add missing increment of loop index in iio_map_array_unregister()
staging: ramster: unbreak my heart
staging/vme: Fix module parameters
staging: sep: Fix sign of error
474a89885f77953b12bce9f23660c31ef5c2630e 11-Apr-2012 Jesper Juhl <jj@chaosbits.net> staging: android: fix mem leaks in __persistent_ram_init()

If, in __persistent_ram_init(), the call to
persistent_ram_buffer_init() fails or the call to
persistent_ram_init_ecc() fails then we fail to free the memory we
allocated to 'prz' with kzalloc() - thus leaking it.

To prevent the leaks I consolidated all error exits from the function
at a 'err:' label at the end and made all error cases jump to that
label where we can then make sure we always free 'prz'. This is safe
since all the situations where the code bails out happen before 'prz'
has been stored anywhere and although we'll do a redundant kfree(NULL)
call in the case of kzalloc() itself failing that's OK since kfree()
deals gracefully with NULL pointers and I felt it was more important
to keep all error exits at a single location than to avoid that one
harmless/redundant kfree() on a error path.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Acked-by: Colin Cross <ccross@android.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ersistent_ram.c
7cfce77d779f43299c1cfeddd72462fed596c168 21-Mar-2012 Konstantin Khlebnikov <khlebnikov@openvz.org> [media] mm/drivers: use vm_flags_t for vma flags

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: linux-media@vger.kernel.org
Cc: devel@driverdev.osuosl.org
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: John Stultz <john.stultz@linaro.org>
Cc: "Arve Hjønnevåg" <arve@android.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
shmem.c
f56d711bc9cc25b17643a76ead98caff24507ba9 30-Mar-2012 Randy Dunlap <rdunlap@xenotime.net> staging: fix android persistent_ram printk formats

Fix printk format warnings in android/persistent_ram.c:

drivers/staging/android/persistent_ram.c:426:4: warning: format '%ld' expects type 'long int', but argument 2 has type 'size_t'
drivers/staging/android/persistent_ram.c:426:4: warning: format '%ld' expects type 'long int', but argument 3 has type 'size_t'
drivers/staging/android/persistent_ram.c:430:4: warning: format '%ld' expects type 'long int', but argument 2 has type 'size_t'
drivers/staging/android/persistent_ram.c:430:4: warning: format '%ld' expects type 'long int', but argument 3 has type 'size_t'

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Cc: Brian Swetland <swetland@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ersistent_ram.c
5d92f71e687e4e1a0bed489707d1ec58fe1100de 21-Mar-2012 Axel Lin <axel.lin@gmail.com> Staging: android: timed_gpio: Fix resource leak in timed_gpio_probe error paths

If gpio_request fails, we need to free all allocated resources.
Current code uses wrong array index to access gpio_data array.
So current code actually frees gpio_data[i].gpio by j times.

This patch moves the error handling code to err_out and thus improves
readability.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
imed_gpio.c
099f5d01a6f73712e17552679aa724e021809a6e 21-Mar-2012 Colin Cross <ccross@android.com> android: make persistent_ram based drivers depend on HAVE_MEMBLOCK

m68k doesn't have memblock_reserve, which causes a build failure
with allmodconfig. Make PERSISTENT_RAM and RAM_CONSOLE depend on
HAVE_MEMBLOCK.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reported-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
config
83dbbdbb38666e20a75fad2294cf1df77c52f121 10-Apr-2012 David Rientjes <rientjes@google.com> android, lowmemorykiller: remove task handoff notifier

The task handoff notifier leaks task_struct since it never gets freed
after the callback returns NOTIFY_OK, which means it is responsible for
doing so.

It turns out the lowmemorykiller actually doesn't need this notifier at
all. It's used to prevent unnecessary killing by waiting for a thread
to exit as a result of lowmem_shrink(), however, it's possible to do
this in the same way the kernel oom killer works by setting TIF_MEMDIE
and avoid killing if we're still waiting for it to exit.

The kernel oom killer will already automatically set TIF_MEMDIE for
threads that are attempting to allocate memory that have a fatal signal.
The thread selected by lowmem_shrink() will have such a signal after the
lowmemorykiller sends it a SIGKILL, so this won't result in an
unnecessary use of memory reserves for the thread to exit.

This has the added benefit that we don't have to rely on
CONFIG_PROFILING to prevent needlessly killing tasks.

Reported-by: Werner Landgraf <w.landgraf@ru.ru>
Cc: stable@vger.kernel.org
Signed-off-by: David Rientjes <rientjes@google.com>
Acked-by: Colin Cross <ccross@android.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
owmemorykiller.c
a591afc01d9e48affbacb365558a31e53c85af45 30-Mar-2012 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'x86-x32-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x32 support for x86-64 from Ingo Molnar:
"This tree introduces the X32 binary format and execution mode for x86:
32-bit data space binaries using 64-bit instructions and 64-bit kernel
syscalls.

This allows applications whose working set fits into a 32 bits address
space to make use of 64-bit instructions while using a 32-bit address
space with shorter pointers, more compressed data structures, etc."

Fix up trivial context conflicts in arch/x86/{Kconfig,vdso/vma.c}

* 'x86-x32-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (71 commits)
x32: Fix alignment fail in struct compat_siginfo
x32: Fix stupid ia32/x32 inversion in the siginfo format
x32: Add ptrace for x32
x32: Switch to a 64-bit clock_t
x32: Provide separate is_ia32_task() and is_x32_task() predicates
x86, mtrr: Use explicit sizing and padding for the 64-bit ioctls
x86/x32: Fix the binutils auto-detect
x32: Warn and disable rather than error if binutils too old
x32: Only clear TIF_X32 flag once
x32: Make sure TS_COMPAT is cleared for x32 tasks
fs: Remove missed ->fds_bits from cessation use of fd_set structs internally
fs: Fix close_on_exec pointer in alloc_fdtable
x32: Drop non-__vdso weak symbols from the x32 VDSO
x32: Fix coding style violations in the x32 VDSO code
x32: Add x32 VDSO support
x32: Allow x32 to be configured
x32: If configured, add x32 system calls to system call tables
x32: Handle process creation
x32: Signal-related system calls
x86: Add #ifdef CONFIG_COMPAT to <asm/sys_ia32.h>
...
296736552fb30a183b8c4635a6cd94f2cb74aa82 16-Mar-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org> Staging: android: ram_console.c:

Fix build error when CONFIG_PRINTK is not selected.

Reported-by: Randy Dunlap <rdunlap@xenotime.net>
Acked-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
am_console.c
2a90957f2cfc2bf0b705a62a97830cf0d42a5a40 09-Mar-2012 Arve Hjønnevåg <arve@android.com> Staging: android: binder: Fix use-after-free bug

binder_update_page_range could read freed memory if the vma of the
selected process was freed right before the check that the vma
belongs to the mm struct it just locked.

If the vm_mm pointer in that freed vma struct had also been rewritten
with a value that matched the locked mm struct, then the code would
proceed and possibly modify the freed vma.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
06caa4174ef7ec0f9c1e7c898a52e737c4897714 08-Mar-2012 Stephen Boyd <sboyd@codeaurora.org> staging: ram_console: Fix section mismatches

WARNING: vmlinux.o(.text+0xfcf6e): Section mismatch in reference
from the function ram_console_driver_probe() to the function
.init.text:persistent_ram_init_ringbuffer()
The function ram_console_driver_probe() references
the function __init persistent_ram_init_ringbuffer().
This is often because ram_console_driver_probe lacks a __init
annotation or the annotation of persistent_ram_init_ringbuffer is
wrong.

Move this driver to platform_driver_probe() because ram console
devices aren't going to be added and removed at runtime. Also
shorten the probe function name since driver is redundant and
makes the function name long.

Cc: Android Kernel Team <kernel-team@android.com>
Cc: John Stultz <john.stultz@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
am_console.c
dd09979346813357200adf71b07003fc0a778089 08-Mar-2012 Nick Kralevich <nnk@google.com> staging: android: ram_console: honor dmesg_restrict

The Linux kernel has a setting called dmesg_restrict. When true,
only processes with CAP_SYSLOG can view the kernel dmesg logs. This
helps prevent leaking of kernel information into user space.

On Android, it's possible to bypass these restrictions by viewing
/proc/last_kmsg.

This change makes /proc/last_kmsg require the same permissions as
dmesg.

CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Nick Kralevich <nnk@google.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
am_console.c
3a21138d3f76296ad070a3692d72eb529e7d5d2c 08-Mar-2012 Colin Cross <ccross@android.com> staging: android: ram_console: fix crash in ram_console_late_init

If the persistent ram buffer is not available, ram_console_late_init
would crash when dereferencing ram_console_zone. Return early if
ram console was not initialized.

CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
am_console.c
a15d0b365e9bbf04dacb44fbe69d15f6594460e1 08-Mar-2012 Colin Cross <ccross@android.com> staging: android: persistent_ram: add notrace to persistent_ram_write

Add the notrace attribute to persistent_ram_write and the
non-ecc functions that it calls to allow persistent_ram to
be used for ftracing (only when ecc is disabled).

CC: Greg KH <gregkh@linuxfoundation.org>
CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ersistent_ram.c
808d0387eb7df3f83352ca41f8c943cb3ed61246 08-Mar-2012 Colin Cross <ccross@android.com> staging: android: persistent_ram: make persistent_ram_write atomic

Allow persistent_ram_write to be called on multiple cpus at
the same time, as long as ecc is not in use. Uses atomics
for the buffer->start and buffer->size counters.

[jstultz: Fix up some pr_info casting issues on 64bit]
CC: Greg KH <gregkh@linuxfoundation.org>
CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ersistent_ram.c
404a6043385de17273624b076599669db5ad891f 08-Mar-2012 Colin Cross <ccross@android.com> staging: android: persistent_ram: handle reserving and mapping memory

Replace the ioremapped memory passed in from the drivers with
a memblock_reserve and vmap. Adds a new function,
persistent_ram_early_init, designed to be called from the machine
init_early callback, that calls memblock_remove and saves the
provided persistent ram area layout.

Drivers only pass in their struct device * and ecc settings.
Locating and mapping the memory is now handled entirely within
persistent_ram.

Also, convert ram_console to the new persistent_ram_init
parameters that only take a struct device * and ecc settings.

[jstultz: Fix pr_info casting issues on 64bit, folded two
patches as the build breaks if they are apart. Also replaced
phys_to_page() w/ pfn_to_page(addr>>PAGE_SHIFT), as phys_to_page
is only on a few arches.]
CC: Greg KH <gregkh@linuxfoundation.org>
CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ersistent_ram.c
ersistent_ram.h
am_console.c
9cc05ad97c5728aaf4db94490daf41f8958b5aee 08-Mar-2012 Colin Cross <ccross@android.com> staging: android: persistent_ram: refactor ecc support

Remove CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION and related
#ifdefs. Also allow persistent ram zones without ecc enabled.
For some use cases, like the data portion of the upcoming
persistent_vars patches, or a persistent ftrace ringbuffer,
ecc on every update is too expensive.

CC: Greg KH <gregkh@linuxfoundation.org>
CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
config
ersistent_ram.c
ersistent_ram.h
am_console.c
c672528aec4a1cf6f3df7a6022e6823a20b20f8e 08-Mar-2012 Colin Cross <ccross@android.com> staging: android: ram_console: split out persistent ram

Split ram_console into two halves.

persistent_ram is a set of apis that handle a block of memory
that does not get erased across a reboot. It provides functions
to fill it as a single buffer or a ring buffer, and to extract
the old data after a reboot. It handles ecc on the data to
correct bit errors introduced during reboot.

ram_console is now a small wrapper around persistent_ram that
feeds console data into the ringbuffer, and exports the old
data to /proc/last_kmsg after a reboot.

[jstultz: Moved persistent_ram.h to staging dir]
CC: Greg KH <gregkh@linuxfoundation.org>
CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
config
akefile
ersistent_ram.c
ersistent_ram.h
am_console.c
c5ee1211f249b0897f715aba4647c1f494509cab 08-Mar-2012 Colin Cross <ccross@android.com> staging: android: ram_console: drop verbose ram_console support

Equivalent functionality can be obtained with loglevel=15

CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
config
am_console.c
8294e2362fa1ce8a172a32ae8607d35563e8b043 08-Mar-2012 Colin Cross <ccross@android.com> staging: android: ram_console: drop early buffer support

Early ramconsole is not very useful, an early crash will prevent
getting the logged data out on the next boot, and CONFIG_DEBUG_LL=y
will get the same information. Drop it to simplify a future
refactoring.

CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
config
am_console.c
f6ccb80ed6c96af2138da49b621edd3d0f19fdca 08-Mar-2012 Colin Cross <ccross@android.com> staging: android: ram_console: move footer strings

Don't store the bootinfo string and the ecc status string with
the recovered old log data. This will simplify refactoring the
persistent ram code out of the ram console code later.

CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
am_console.c
74f6736ecfbbbe9e7ebf9ba52475b6cb39c44f75 08-Mar-2012 Dima Zavin <dima@android.com> staging: android: ram_console: set CON_ANYTIME console flag

We want to ensure that we get all the console messages, even ones
that occur while the printing CPU is not yet online.

[jstultz: tweaked commit subject line]
CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Dima Zavin <dima@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
am_console.c
624b225035b24e9d7c22cc214f449fc2ec2491c9 07-Mar-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org> Staging: android: lowmemorykiller.c

Fix compiler warning about the type of the module parameter.

Cc: San Mehat <san@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
owmemorykiller.c
1eda5166c7640092f512138be6899d050c3d62ed 07-Mar-2012 Paul E. McKenney <paulmck@linux.vnet.ibm.com> staging: android/lowmemorykiller: Don't unregister notifier from atomic context

The lowmemorykiller registers an atomic notifier for notfication of when
the task is freed. From this atomic notifier callback, it removes the
atomic notifier via task_free_unregister(). This is incorrect because
atomic_notifier_chain_unregister() calls syncronize_rcu(), which can
sleep, which shouldn't be done from an atomic notifier.

Fix this by registering the notifier during init, and only unregister it
if the lowmemorykiller is unloaded.

Rebased to -next by Paul E. McKenney.
Rebased to -next again by Anton Vorontsov.

Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Christian Bejram <christian.bejram@stericsson.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reported-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
owmemorykiller.c
2c52325ed2984069f893040f6139f0024e7d3b50 07-Mar-2012 Zhengwang Ruan <ruan.zhengwang@gmail.com> Staging:android: Change type for binder_debug_no_lock switch to bool

GCC warns that module_param_named() indirectly returns a bool type value
which is different from 'int' type binder_debug_no_lock declared. Change
it to bool because it is a internal switch for debugging.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
51be392603762ebbff7337bc8af178d33f3ba71e 25-Feb-2012 Johannes Thumshirn <morbidrsa@googlemail.com> Staging: android: timed_gpio: Removed spaces before tabs

Signed-off-by: Johannes Thumshirn <morbidrsa@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
imed_gpio.h
47de87a234aac8b2121557f3903bb16bb678af67 22-Feb-2012 Rabin Vincent <rabin.vincent@stericsson.com> staging: logger: hold mutex while removing reader

The readers list is traversed under the log->mutex lock
(for example from fix_up_readers()), but the deletion of
elements from this list is not being done under this lock.

Cc: Brian Swetland <swetland@google.com>
Cc: Dima Zavin <dima@android.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ogger.c
189017c25c8497760c89646c06297c37d6cde072 24-Feb-2012 David Howells <dhowells@redhat.com> fs: Remove missed ->fds_bits from cessation use of fd_set structs internally

Stephen Rothwell reported that the following commit broke the
linux-next build:

1fd36adcd98c: Replace the fd_sets in struct fdtable with an array of unsigned longs

Fix places where ->fds_bits needed to be removed as the core
kernel no longer uses fd_set internally for file descriptor
table management. There are two places:

(1) drivers/staging/android/binder.c

(2) arch/mips/kernel/kspd.c

Question: Should sp_cleanup() in the MIPS arch be using find_next_bit()
or fls()?

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Ralf Bächle <ralf@linux-mips.org>
cc: Arve Hjønnevåg <arve@android.com>
Link: http://lkml.kernel.org/r/20120224105707.32170.11550.stgit@warthog.procyon.org.uk
Signed-off-by: Ingo Molnar <mingo@elte.hu>
inder.c
1dce27c5aa6770e9d195f2bb7db1db3d4dde5591 16-Feb-2012 David Howells <dhowells@redhat.com> Wrap accesses to the fd_sets in struct fdtable

Wrap accesses to the fd_sets in struct fdtable (for recording open files and
close-on-exec flags) so that we can move away from using fd_sets since we
abuse the fd_set structs by not allocating the full-sized structure under
normal circumstances and by non-core code looking at the internals of the
fd_sets.

The first abuse means that use of FD_ZERO() on these fd_sets is not permitted,
since that cannot be told about their abnormal lengths.

This introduces six wrapper functions for setting, clearing and testing
close-on-exec flags and fd-is-open flags:

void __set_close_on_exec(int fd, struct fdtable *fdt);
void __clear_close_on_exec(int fd, struct fdtable *fdt);
bool close_on_exec(int fd, const struct fdtable *fdt);
void __set_open_fd(int fd, struct fdtable *fdt);
void __clear_open_fd(int fd, struct fdtable *fdt);
bool fd_is_open(int fd, const struct fdtable *fdt);

Note that I've prepended '__' to the names of the set/clear functions because
they require the caller to hold a lock to use them.

Note also that I haven't added wrappers for looking behind the scenes at the
the array. Possibly that should exist too.

Signed-off-by: David Howells <dhowells@redhat.com>
Link: http://lkml.kernel.org/r/20120216174942.23314.1364.stgit@warthog.procyon.org.uk
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
inder.c
940f77b07f85a4211fb149d6316a3cbd84d7227d 14-Feb-2012 David Rientjes <rientjes@google.com> staging: android, lowmemorykiller: convert to use oom_score_adj

/proc/pid/oom_adj is deprecated and will be removed in August 2012
according to Documentation/feature-removal-schedule.txt. Convert its
usage in the lowmemorykiller to use the new interface, oom_score_adj,
instead.

Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
owmemorykiller.c
b91867f2ee5c84b550f95ce54c91b180f70f48cb 10-Feb-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org> Merge tag 'staging-3.3-rc3' into staging-next

This was done to resolve some merge issues with the following files that
had changed in both branches:
drivers/staging/rtl8712/rtl871x_sta_mgt.c
drivers/staging/tidspbridge/rmgr/drv_interface.c
drivers/staging/zcache/zcache-main.c

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2157f896774ace6e98c851878f8089fb861502e2 09-Feb-2012 John Stultz <john.stultz@linaro.org> staging: android-alarm: Support old drivers via preprocessor aliasing

Older out of tree drivers that were desgined to the Android Alarm
in-kernel API may not build due to the namespace collision fixed in
an earlier patch. Per Arve's suggestion, this patch provides
preprocessor macros that allow older drivers to build.

CC: Arve Hjønnevåg <arve@android.com>
CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
config
ndroid_alarm.h
7f9b98a39bdd12db051514eb0daff689c34b8b4e 09-Feb-2012 John Stultz <john.stultz@linaro.org> staging: android-alarm: Fixup minor pr_alarm warnings

This patch fixes the following warnings:

drivers/staging/android/alarm.c: In function ‘alarm_timer_triggered’:
drivers/staging/android/alarm.c:344: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long int’
drivers/staging/android/alarm.c:367: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long int’

CC: Arve Hjønnevåg <arve@android.com>
CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm.c
f2d3c6898abd6c5d69e6d1504413434df1ea2538 09-Feb-2012 JP Abgrall <jpa@google.com> staging: android-alarm: Fix bad index when canceling alarms[]

It was using ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP_MASK as an
index.

CC: Arve Hjønnevåg <arve@android.com>
CC: Android Kernel Team <kernel-team@android.com>
CC: JP Abgrall <jpa@google.com>
Change-Id: I919860cc71254453e382616bce9fd5455802cb3d
Signed-off-by: JP Abgrall <jpa@google.com>
[jstultz: Tweaked commit subject]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm.c
66c48107719b751e8ec360034bc84ee1511147e4 09-Feb-2012 Arve Hjønnevåg <arve@android.com> staging: android-alarm: Update hrtimer if alarm at the head of the queue is reprogrammed

If an alarm was restarted with a value that moved it away from the head
of a queue, the hrtimer would not be updated. This would cause unnecessary
wakeups.

CC: Arve Hjønnevåg <arve@android.com>
CC: Android Kernel Team <kernel-team@android.com>
Change-Id: If379f8dd92b0bdb3173bd8d057adfe0dc1d15259
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm.c
58a38ff3b12ebd103e3ca2c5dea3292ffbfd0f02 09-Feb-2012 Praneeth Kumar Bajjuri <a0132704@ti.com> staging: android-alarm: Disable Android alarm driver by default

Do not enable Android alarm driver by default

CC: Arve Hjønnevåg <arve@android.com>
CC: Android Kernel Team <kernel-team@android.com>
CC: Praneeth Bajjuri <praneeth@ti.com>
Change-Id: Iff8f7a65c4eceecfd084074937c72824697b5e7f
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
[jstultz: tweaked commit subject & msg]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
config
fe8d2727ffa65bcb516b4947bec1c546841e7d25 09-Feb-2012 John Stultz <john.stultz@linaro.org> staging: android-alarm: Reenable android alarm driver

Now that it builds, re-enable android alarm driver in
the makefile and kconfig

CC: Arve Hjønnevåg <arve@android.com>
CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
config
akefile
79ef07162fb088f8afe7709881e2b5e2a4098202 09-Feb-2012 John Stultz <john.stultz@linaro.org> staging: android-alarm: HACK: wakelock workaround

Allow Android alarmtimer device to build while wakelocks are still
out of tree.

CC: Arve Hjønnevåg <arve@android.com>
CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm-dev.c
larm.c
f2f28eacf240baffbba5e9744278f85fc62ddd60 09-Feb-2012 John Stultz <john.stultz@linaro.org> staging: android-alarm: Fix namespace collision with upstreamed alarmtimers

The upstreamed alarmtimers are similar but not quite 100% API
compatibile with the android in-kernel alarm api. To aid the
transition, prefix the the android in-kernel api with android_

CC: Arve Hjønnevåg <arve@android.com>
CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm-dev.c
larm.c
ndroid_alarm.h
d47908b20c4cc22c2700ca737252bdc555d4f28a 09-Feb-2012 John Stultz <john.stultz@linaro.org> staging: android-alarm: Fix include compile issues

The file asm/mach/time.h doesn't exist on all arches,
so include <linux/time.h>. Also linux/sysdev.h is gone
so kill it.

CC: Arve Hjønnevåg <arve@android.com>
CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm-dev.c
larm.c
bf647ea717e529fc4f3dfa17dffd40da10522b00 09-Feb-2012 Andy Green <andy.green@linaro.org> staging: android-alarm: Add needed module.h includes

Add module.h includes required to build

CC: Arve Hjønnevåg <arve@android.com>
CC: Android Kernel Team <kernel-team@android.com>
CC: Andy Green <andy.green@linaro.org>
Signed-off-by: Andy Green <andy.green@linaro.org>
[jstultz: Tweaked commit subject, folded two patches
into one]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm-dev.c
larm.c
5dd12c29b45f27d059e4bd58ff1854bc6a236804 09-Feb-2012 Arve Hjønnevåg <arve@android.com> staging: android-alarm: Don't use save_time_delta.

Remove references to non-existant save_time_delta.

Change-Id: Iaefeca497de02fe36b7f5d79075912f6e349ec53
CC: Arve Hjønnevåg <arve@android.com>
CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Arve Hjønnevåg <arve@android.com>
[Added commit message -jstultz]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm.c
841cb11c6fc7ae559ef2d856932907056b75617d 09-Feb-2012 Arve Hjønnevåg <arve@android.com> staging: android-alarm: Add android alarm driver & in-kernel alarm interface

Drivers can now create alarms that will use an hrtimer while the
system is running and the rtc to wake up from suspend.

CC: Arve Hjønnevåg <arve@android.com>
CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Arve Hjønnevåg <arve@android.com>
[Fold and move alarm driver and interface to staging,
fix whitespace issue, drop kconfig & make file changes
as it currently doesn't build -jstultz]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
larm-dev.c
larm.c
ndroid_alarm.h
9823ec9ded836ee7ca4fe5ab7964b9cdc8af010c 06-Feb-2012 Anton Vorontsov <anton.vorontsov@linaro.org> staging: android/lowmemorykiller: Do not kill kernel threads

LMK should not try killing kernel threads.

Suggested-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Acked-by: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
owmemorykiller.c
353416099128914a684e8bb81e7475d8c2961cc3 06-Feb-2012 Anton Vorontsov <anton.vorontsov@linaro.org> staging: android/lowmemorykiller: No need for task->signal check

task->signal == NULL is not possible, so no need for these checks.

Suggested-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Acked-by: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
owmemorykiller.c
95670001188911f9d466875cd68e3681f39df38a 06-Feb-2012 Anton Vorontsov <anton.vorontsov@linaro.org> staging: android/lowmemorykiller: Better mm handling

LMK should not directly check for task->mm. The reason is that the
process' threads may exit or detach its mm via use_mm(), but other
threads may still have a valid mm. To catch this we use
find_lock_task_mm(), which walks up all threads and returns an
appropriate task (with lock held).

Suggested-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Acked-by: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
owmemorykiller.c
294b27119f2e20643e71a0c1a1b511320a11e4c3 06-Feb-2012 Anton Vorontsov <anton.vorontsov@linaro.org> staging: android/lowmemorykiller: Don't grab tasklist_lock

Grabbing tasklist_lock has its disadvantages, i.e. it blocks
process creation and destruction. If there are lots of processes,
blocking doesn't sound as a great idea.

For LMK, it is sufficient to surround tasks list traverse with
rcu_read_{,un}lock().

>From now on using force_sig() is not safe, as it can race with an
already exiting task, so we use send_sig() now. As a downside, it
won't kill PID namespace init processes, but that's not what we
want anyway.

Suggested-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
owmemorykiller.c
350a1955957d73352c043d0f948e3f28bb118c57 08-Feb-2012 Tim Bird <tim.bird@am.sony.com> staging: android: logger: clarify non-update of w_off in do_write_log_from_user

Add comment to explain when w_off is not updated in case of failed second
fragment copy to buffer.

Signed-off-by: Tim Bird <tim.bird@am.sony.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ogger.c
169c843afffcb328390ef39ff95227596d6f63c4 08-Feb-2012 Tim Bird <tim.bird@am.sony.com> staging: android: logger: clarify code in clock_interval

Add commentary, rename the function and make the code easier to read.

Signed-off-by: Tim Bird <tim.bird@am.sony.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ogger.c
c76c7ca31f16c9556cad527bfa3504b0aafb3045 08-Feb-2012 Tim Bird <tim.bird@am.sony.com> staging: android: logger: reorder prepare_to_wait and mutex_lock

If mutex_lock waits, it will return in state TASK_RUNNING,
rubbing out the effect of prepare_to_wait().

Signed-off-by: Tim Bird <tim.bird@am.sony.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ogger.c
3bcfa431334d99fa8bff96c4e7c2108f0b26242e 08-Feb-2012 Tim Bird <tim.bird@am.sony.com> staging: android: logger: simplify and optimize get_entry_len

Make this code slightly easier to read, and eliminate calls
to sub-routines. Some of these were previously optimized away
by the compiler, but one memcpy was not.

In my testing, this makes the code about 20% smaller, and
has no sub-routine calls and no branches (on ARM).

v2 of this patch is, IMHO, easier to read than v1. Compared to
that patch it uses __u8 instead of unsigned char, for
consistency with the __u16 val data type, simplifies the
conditional expression, adds a another comment, and
moves a common statement out of the if.

Signed-off-by: Tim Bird <tim.bird@am.sony.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ogger.c
c626224de9370ae783e8b0cb6aaca2ba3d81fe62 08-Feb-2012 Tim Bird <tim.bird@am.sony.com> staging: android: logger: Change logger_offset() from macro to function

Convert to function and add log as a parameter, rather than relying
on log in the context of the macro.

Signed-off-by: Tim Bird <tim.bird@am.sony.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ogger.c
e3251e0d7921fbedfe61cb237c6ce6c273bd93a7 23-Jan-2012 Tracey Dent <tdent48227@gmail.com> drivers/staging/android/timed_gpio.c: Stlye fixes

Just made it more neat and not bother scripts/checkpatch.pl

Signed-off-by: Tracey Dent <tdent48227@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
imed_gpio.c
aa5af974127d317071d6225a0f3678c5f520e7ce 23-Jan-2012 Tracey Dent <tdent48227@gmail.com> drivers/staging/android/ashmem.c: Cleanups

Minor cleanups that consist of removal of a whitespace and
make file_operations const.

Signed-off-by: Tracey Dent <tdent48227@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
shmem.c
8d438bef6556315a23781fd673f13f7bfb94047d 22-Jan-2012 Thomas Meyer <thomas@m3y3r.de> Staging: android: ram_console: Use resource_size function

The semantic patch that makes this change is available
in scripts/coccinelle/api/resource_size.cocci.

More information about semantic patching is available at
http://coccinelle.lip6.fr/

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
am_console.c
217218f002a669905701cc0baa18a8d6ba1d5e21 12-Jan-2012 Justin P. Mattock <justinmattock@gmail.com> drivers:staging:android Typos: fix some comments that have typos in them.

Below is a patch that fixes some typos in some comments.

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
Cc: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ODO
inder.c
28aa41fb8d555b120edefd7fdf879b156a1c9f3a 15-Jan-2012 Greg Dietsche <Gregory.Dietsche@cuw.edu> staging: android: ram_console use kmemdup instead of kmalloc

Replace kmalloc + memcpy will kmemdup in ram_console_late_init

Signed-off-by: Greg Dietsche <Gregory.Dietsche@cuw.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
am_console.c
203209ef77e4d5f0ee729557b09770bce0c2d251 07-Feb-2012 Anton Vorontsov <anton.vorontsov@linaro.org> staging: android/ram_console: Don't build on arches w/o ioremap

This patch fixes UML build:

CC drivers/staging/android/ram_console.o
drivers/staging/android/ram_console.c: In function
'ram_console_driver_probe':
drivers/staging/android/ram_console.c:358:2: error: implicit declaration
of function 'ioremap' [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
make[3]: *** [drivers/staging/android/ram_console.o] Error 1

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
config
e5d7965f88a3755b2d0c54768a17032ab3a72819 13-Jan-2012 Arve Hjønnevåg <arve@android.com> staging: android: lowmemorykiller: Don't wait more than one second for a process to die

If a process forked and the child process was killed by the
lowmemorykiller, the lowmemory killer would be disabled until
the parent process reaped the child or it died itself.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
owmemorykiller.c
bd1eff9741af27378b241b347041c724bb28e857 02-Feb-2012 Arve Hjønnevåg <arve@android.com> Staging: android: binder: Fix crashes when sharing a binder file between processes

Opening the binder driver and sharing the file returned with
other processes (e.g. by calling fork) can crash the kernel.
Prevent these crashes with the following changes:
- Add a mutex to protect against two processes mmapping the
same binder_proc.
- After locking mmap_sem, check that the vma we want to access
(still) points to the same mm_struct.
- Use proc->tsk instead of current to get the files struct since
this is where we get the rlimit from.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
inder.c
b0d017e80e9f4e6b37e699b9a944646e64deb473 27-Jan-2012 Shuah Khan <shuahkhan@gmail.com> Staging: android: Remove pmem driver

Addroid pmem driver is no longer used in any of the Android products.
This patch removes pmem driver from Android staging area

Reference: https://lkml.org/lkml/2012/1/23/183

Signed-off-by: Shuah Khan <shuahkhan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
config
akefile
ndroid_pmem.h
mem.c
3c1b86f17068cf6476fb2d022b9c8b44dedea2e5 21-Jan-2012 Arve Hjønnevåg <arve@android.com> Staging: android: binder: Don't call dump_stack in binder_vma_open

If user-space partially unmaps the driver, binder_vma_open
would dump the kernel stack. This is not a kernel bug however
and will be treated as if the whole area was unmapped once
binder_vma_close gets called.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
3bf5d65f4324510231cf33e5d75654f4fb1d1892 22-Dec-2011 Marco Navarra <fromenglish@gmail.com> Staging: android: fixed 80 characters warnings in lowmemorykiller.c

This patch fixes some 80 chatacters limit warnings in the lowmemorykiller.c file

Signed-off-by: Marco Navarra <fromenglish@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
owmemorykiller.c
29b858471b266be7e56b69cfcee7ba94d9427dd3 22-Dec-2011 Marco Navarra <fromenglish@gmail.com> Staging: android: fixed a space warning in binder.h

This patch fixes a simple tab-space warning in binder.h found by checkpatch tool

Signed-off-by: Marco Navarra <fromenglish@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.h
1efb34394a694b458d66f25072318c375e22afe2 21-Dec-2011 John Stultz <john.stultz@linaro.org> ashmem: Whitespace cleanups

Fixes checkpatch warnings with the ashmem.c file

CC: Brian Swetland <swetland@google.com>
CC: Colin Cross <ccross@android.com>
CC: Arve Hjønnevåg <arve@android.com>
CC: Dima Zavin <dima@android.com>
CC: Robert Love <rlove@google.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
shmem.c
33e8fc463eeec29227282e4bd2082f5928d629a5 21-Dec-2011 Colin Cross <ccross@android.com> ashmem: Fix arguments to ashmem_shrink

The arguments to shrink functions have changed, update
ashmem_shrink to match.

Signed-off-by: Colin Cross <ccross@android.com>
[jstultz: tweaked commit subject]
CC: Brian Swetland <swetland@google.com>
CC: Colin Cross <ccross@android.com>
CC: Arve Hjønnevåg <arve@android.com>
CC: Dima Zavin <dima@android.com>
CC: Robert Love <rlove@google.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
shmem.c
5154b93b8eceb57bdab4e77030bf21ead15b42e4 21-Dec-2011 Bjorn Bringert <bringert@android.com> ashmem: Support lseek(2) in ashmem driver

Signed-off-by: Bjorn Bringert <bringert@android.com>
[jstultz: tweaked commit subject]
CC: Brian Swetland <swetland@google.com>
CC: Colin Cross <ccross@android.com>
CC: Arve Hjønnevåg <arve@android.com>
CC: Dima Zavin <dima@android.com>
CC: Robert Love <rlove@google.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
shmem.c
1d3f8f2da1c28709a3c494f3872b89c871906b2d 21-Dec-2011 Colin Cross <ccross@google.com> ashmem: Update arguments of shrinker for 2.6.35

Signed-off-by: Colin Cross <ccross@google.com>
CC: Brian Swetland <swetland@google.com>
CC: Colin Cross <ccross@android.com>
CC: Arve Hjønnevåg <arve@android.com>
CC: Dima Zavin <dima@android.com>
CC: Robert Love <rlove@google.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
shmem.c
56f76fc68492af718fff88927bc296635d634b78 21-Dec-2011 Arve Hjønnevåg <arve@android.com> ashmem: Fix ASHMEM_SET_PROT_MASK.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
CC: Brian Swetland <swetland@google.com>
CC: Colin Cross <ccross@android.com>
CC: Arve Hjønnevåg <arve@android.com>
CC: Dima Zavin <dima@android.com>
CC: Robert Love <rlove@google.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
shmem.c
853ca7ae292f9c4809e1e42914e81453eaa15367 21-Dec-2011 Bjorn Bringert <bringert@android.com> ashmem: Implement read(2) in ashmem driver

Signed-off-by: Bjorn Bringert <bringert@android.com>
[jstultz: Tweaked commit subject]
CC: Brian Swetland <swetland@google.com>
CC: Colin Cross <ccross@android.com>
CC: Arve Hjønnevåg <arve@android.com>
CC: Dima Zavin <dima@android.com>
CC: Robert Love <rlove@google.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
shmem.c
11980c2ac4ccfad21a5f8ee9e12059f1e687bb40 21-Dec-2011 Robert Love <rlove@google.com> ashmem: Anonymous shared memory subsystem

The anonymous shared memory (ashmem) subsystem provides a
Unix-y,file-based shared memory interface to user-space. It
works like anonymous memory (e.g. mmapping fd=0) except if
you share the file descriptor via the usual means, you will
share the mapping. The shared memory can be accessed via both
mmap or file I/O. The backing store is a simple shmem file.

Additionally, ashmem introduces the concept of page pinning.
Pinned pages (the default) behave like any anonymous memory.
Unpinned pages are available to the kernel for eviction during
VM pressure. When repinning the pages, the return value
instructs user-space as to any eviction. In this manner,
user-space processes may implement caching and similar
resource management that efficiently integrates with kernel
memory management.

Signed-off-by: Robert Love <rlove@google.com>

ashmem: Don't install fault handler for private mmaps.

Ashmem is used to create named private heaps. If this heap is backed
by a tmpfs file it will allocate two pages for every page touched.
In 2.6.27, the extra page would later be freed, but 2.6.29 does not
scan anonymous pages when running without swap so the memory is not
freed while the file is referenced. This change changes the behavior
of private ashmem mmaps to match /dev/zero instead tmpfs.

Signed-off-by: Arve Hjønnevåg <arve@android.com>

ashmem: Add common prefix to name reported in /proc/pid/maps

Signed-off-by: Arve Hjønnevåg <arve@android.com>

ashmem: don't require a page aligned size

This makes ashmem more similar to shmem and mmap, by
not requiring the specified size to be page aligned,
instead rounding it internally as needed.

Signed-off-by: Marco Nelissen <marcone@android.com>
[jstultz: Improved commit subject and included patch description
from rlove. Also moved ashmem files to staging dir, and reworked
code to avoid touching mm/shmem.c while we're in staging.]
CC: Brian Swetland <swetland@google.com>
CC: Colin Cross <ccross@android.com>
CC: Arve Hjønnevåg <arve@android.com>
CC: Dima Zavin <dima@android.com>
CC: Robert Love <rlove@google.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
config
akefile
shmem.c
shmem.h
b6aba85c35baa7d08b7a601b30589bcae607d9e0 24-Jul-2008 Rebecca Schultz <rschultz@google.com> staging: android: add pmem driver

This adds the Android pmem driver to the staging tree.

[At this point in time, it is dependent on the ARM platform, due to some
build issues that require it. - gregkh]

Signed-off-by: Rebecca Schultz <rschultz@google.com>
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Signed-off-by: Dima Zavin <dima@android.com>
Signed-off-by: Jamie Gennis <jgennis@google.com>
Cc: Brian Swetland <swetland@google.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Colin Cross <ccross@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
config
akefile
ndroid_pmem.h
mem.c
c001dff0f6715813bdb8e978dc8c05416c01962b 16-Dec-2011 Greg Kroah-Hartman <gregkh@suse.de> staging: android: switch: minor code formatting cleanups

This fixes a number of minor space issues in the Android switch code.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
witch/switch.h
witch/switch_gpio.c
e0f5bb9b3850bdd7907eda9eb923cd3f9d4358b8 14-Oct-2008 Mike Lockwood <lockwood@android.com> staging: android: switch: switch class and GPIO drivers.

This adds the Android switch driver code to the staging tree.

[Note, this code was located in drivers/switch/ in the Android kernel
releases, but as that api wasn't generally accepted, and the interface
is working toward changing to the newly proposed extcon inteface, this
driver was placed here until the extcon code is merged into mainline and
the Android userspace code is converted over to using it. - gregkh]

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Mike Lockwood <lockwood@android.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Donggeun Kim <dg77.kim@samsung.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: MyungJoo Ham <myungjoo.ham@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: NeilBrown <neilb@suse.de>
Cc: Morten CHRISTIANSEN <morten.christiansen@stericsson.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
config
akefile
witch/Kconfig
witch/Makefile
witch/switch.h
witch/switch_class.c
witch/switch_gpio.c
277cdd01d6e831e2168cb3f2c082eecd7fcaac06 15-Dec-2011 Marco Navarra <fromenglish@gmail.com> Staging: android: fixed white spaces coding style issue in logger.c

This patch fixes some space-before-tabs warnings found by checkpatch tool on the staging android driver file logger.c

Signed-off-by: Marco Navarra <fromenglish@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
ogger.c
a6707f830e39ab5ef285d9155525eac5e500e55d 25-Oct-2011 Colin Cross <ccross@android.com> staging: android: ram_console: pass in a boot info string

Allow the board file to pass a boot info string through the
platform data that is appended to the /proc/last_kmsg file.

[moved the .h file to drivers/staging/android/ to be self-contained - gregkh]

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
am_console.c
am_console.h
2b374956f3afee5857c85b073d726be11f4d2e9b 12-Aug-2011 JP Abgrall <jpa@google.com> android: logger: bump up the logger buffer sizes

(port from common android-2.6.39
commit: 11430f16545205c614dd5bd58e4a7ee630fc0f9f)

events: (no change, 256)
main: 64 -> 256
radio: 64 -> 256
system: 64 -> 256

Signed-off-by: JP Abgrall <jpa@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
ogger.c
cae9bf11ef0d92875b222f994a2cfd723991435a 23-Jun-2011 Colin Cross <ccross@android.com> android: lowmemorykiller: Fix arguments to lowmem_shrink

The arguments to shrink functions have changed, update
lowmem_shrink to match.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
owmemorykiller.c
71b2c82bdf67ab24716c536e10de436169d3574c 24-Nov-2010 Arve Hjønnevåg <arve@android.com> staging: android: lowmemorykiller: Ignore shmem pages in page-cache

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
owmemorykiller.c
06a1074e1c789a777732f8c432d913b0fedb8ff5 22-Aug-2010 Colin Cross <ccross@google.com> staging: android: lowmemorykiller: Update arguments of shrinker for 2.6.35

Signed-off-by: Colin Cross <ccross@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
owmemorykiller.c
eb943f6be011b33455b767880e13c34a2bb96a5e 07-May-2010 San Mehat <san@google.com> staging: android: lowmemorykiller: Remove bitrotted codepath

Now that we're murder-synchronous, this code path will never be
called (and if it does, it doesn't tell us anything useful other
than we killed a task that was already being killed by somebody
else but hadn't gotten its' signal yet)

Signed-off-by: San Mehat <san@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
owmemorykiller.c
58526090ece3582516e62779739a7d665a74708c 01-May-2010 Christopher Lais <chris+android@zenthought.org> staging: binder: Fix memory corruption via page aliasing

binder_deferred_release was not unmapping the page from the buffer
before freeing it, causing memory corruption. This only happened
when page(s) had not been freed by binder_update_page_range, which
properly unmaps the pages.

This only happens on architectures with VIPT aliasing.

To reproduce, create a program which opens, mmaps, munmaps, then closes
the binder very quickly. This should leave a page allocated when the
binder is released. When binder_deferrred_release is called on the
close, the page will remain mapped to the address in the linear
proc->buffer. Later, we may map the same physical page to a different
virtual address that has different coloring, and this may cause
aliasing to occur.

PAGE_POISONING will greatly increase your chances of noticing any
problems.

Signed-off-by: Christopher Lais <chris+android@zenthought.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
4755b72e261478b48337e0e54c8448cbea32c5c8 05-May-2010 San Mehat <san@google.com> staging: android: lowmemkiller: Substantially reduce overhead during reclaim

This patch optimizes lowmemkiller to not do any work when it has an outstanding
kill-request. This greatly reduces the pressure on the task_list lock
(improving interactivity), as well as improving the vmscan performance
when under heavy memory pressure (by up to 20x in tests).

Note: For this enhancement to work, you need CONFIG_PROFILING

Signed-off-by: San Mehat <san@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
owmemorykiller.c
4964cd41cd966502c1e0c5bc929ed15c175f8218 27-Apr-2010 San Mehat <san@google.com> staging: android: lowmemorykiller: Don't try to kill the same pid over and over

Under certain circumstances, a process can take awhile to
handle a sig-kill (especially if it's in a scheduler group with
a very low share ratio). When this occurs, lowmemkiller returns
to vmscan indicating the process memory has been freed - even
though the process is still waiting to die. Since the memory
hasn't actually freed, lowmemkiller is called again shortly after,
and picks the same process to die; regardless of the fact that
it has already been 'scheduled' to die and the memory has already
been reported to vmscan as having been freed.

Solution is to check fatal_signal_pending() on the selected
task, and if it's already pending destruction return; indicating
to vmscan that no resources were freed on this pass.

Signed-off-by: San Mehat <san@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
owmemorykiller.c
3c762a49b12073c96f6a55b4dfc8b6a2a45fedff 23-Apr-2010 Arve Hjønnevåg <arve@android.com> Staging: android: binder: Create dedicated workqueue for binder deferred work

Some drivers flush the global workqueue when closed. This would deadlock if
the last reference to the file was released from the binder.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
8bfe15f3de0af92fd822b7475878bddc93fa490d 17-Apr-2010 Mike Lockwood <lockwood@android.com> Staging: android: timed_gpio: Properly discard invalid timeout values.

The timed output device never previously checked the return value of sscanf,
resulting in an uninitialized int being passed to enable() if input value
was invalid.

Signed-off-by: Mike Lockwood <lockwood@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
imed_output.c
16b665543864904714f028b1d349f5d905f39afb 29-Apr-2009 Arve Hjønnevåg <arve@android.com> staging: android: binder: Move debugging information from procfs to debugfs

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
5249f4883045de494916db7b1a6d6e1e422e9a0b 29-Apr-2009 Arve Hjønnevåg <arve@android.com> binder: Use seq_file for debug interface.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
3537cdaa16205d2af7e1195276c786f22bada574 24-Feb-2010 San Mehat <san@google.com> android: logger: Add new system log for framework/system log messages

Signed-off-by: San Mehat <san@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
ogger.c
ogger.h
0445f1548fc66a72f3b91cdbe8f26b120245efd1 07-Jan-2010 Arve Hjønnevåg <arve@android.com> Staging: android: timed_gpio: Request gpios.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
imed_gpio.c
81057ec1ded5ddf15149c3b266f414c0fbde5530 18-Dec-2009 Arve Hjønnevåg <arve@android.com> Staging: android: ram_console: Start ram console earlier

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
am_console.c
fdfc8089429b58b4ac901926fe83fa85b0b7bfc1 17-Sep-2009 San Mehat <san@google.com> staging: android: ramconsole: Ensure ramconsole does not get cluttered by apanic threads

[Note, this is part of a patch from Sam, just the drivers/staging/
portion, that adds a function that the apanic code calls, but the apanic
code isn't here, so just include part of this to make merges and diffs
easier and this keeps things self-contained - gregkh]

Signed-off-by: San Mehat <san@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
am_console.c
e59bbb8ea3fb5794c09e48490a74b673aee4adc2 30-Nov-2011 Greg Kroah-Hartman <gregkh@suse.de> Revert "Staging: android: mark subsystem as broken"

This reverts commit 2cdf99ce2b9418c9d7c5f907195cfac421375520.

It now builds, so this can be reverted.

Cc: Arve Hjønnevåg <arve@android.com>
Cc: Brian Swetland <swetland@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
config
c11a166cd4c19664355e0e3d9c04cfa7ee4aa9f4 16-Apr-2010 Colin Cross <ccross@android.com> android-common: Fix slab.h includes for 2.6.34-rc4

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
ogger.c
c1b197ae67a201e404df9084cfd544eb8cb2e8a6 21-Apr-2010 Arve Hjønnevåg <arve@android.com> android-common: include linux/slab.h

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
imed_gpio.c
23687af9317c9c01d4609667d3566af7f5e71e65 28-Nov-2009 Corentin Chary <corentincj@iksaif.net> staging/android: fix build issues

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
ogger.c
owmemorykiller.c
355b0502f6efea0ff9492753888772c96972d2a3 30-Nov-2011 Greg Kroah-Hartman <gregkh@suse.de> Revert "Staging: android: delete android drivers"

This reverts commit b0a0ccfad85b3657fe999805df65f5cfe634ab8a.

Turns out I was wrong, we want these in the tree.

Note, I've disabled the drivers from the build at the moment, so other
patches can be applied to fix some build issues due to internal api
changes since the code was removed from the tree.

Cc: Arve Hjønnevåg <arve@android.com>
Cc: Brian Swetland <swetland@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
config
akefile
ODO
inder.c
inder.h
ogger.c
ogger.h
owmemorykiller.c
am_console.c
imed_gpio.c
imed_gpio.h
imed_output.c
imed_output.h
b0a0ccfad85b3657fe999805df65f5cfe634ab8a 06-Oct-2009 Greg Kroah-Hartman <gregkh@suse.de> Staging: android: delete android drivers

These drivers are no longer being developed and the original authors
seem to have abandonded them and hence, do not want them in the mainline
kernel tree.

So sad :(

Cc: Brian Swetland <swetland@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
config
akefile
ODO
inder.c
inder.h
ogger.c
ogger.h
owmemorykiller.c
am_console.c
imed_gpio.c
imed_gpio.h
imed_output.c
imed_output.h
2cdf99ce2b9418c9d7c5f907195cfac421375520 27-Oct-2009 Greg Kroah-Hartman <gregkh@suse.de> Staging: android: mark subsystem as broken

It's causing lots of build errors, so just mark it as broken. It is
scheduled to be removed in 2.6.33 anyway.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
config
a5ca2dfc4ebd33e18f981f562833c39efdc2585c 14-Aug-2009 Julia Lawall <julia@diku.dk> staging: Make some structures static

This was done using a semantic patch (http://coccinelle.lip6.fr/) that
checks that the declaration is not inside a function definition, that the
defined variable is not exported using EXPORTED_SYMBOL, etc, and that the
defined variable does not occur in any other file. If these conditions
hold, static is added before the declaration.

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
0984e56a65a29ad0700c5abf657327e73929ea1f 31-Jul-2009 Randy Dunlap <randy.dunlap@oracle.com> Staging: android: lowmemorykiller: fix module param errors

Move module_params to near the end of the source file so that
their references are already known/defined. Fixes build errors:

drivers/staging/android/lowmemorykiller.c: In function '__check_cost':
drivers/staging/android/lowmemorykiller.c:60: error: 'lowmem_shrinker' undeclared (first use in this function)
drivers/staging/android/lowmemorykiller.c: At top level:
drivers/staging/android/lowmemorykiller.c:60: error: 'lowmem_shrinker' undeclared here (not in a function)
drivers/staging/android/lowmemorykiller.c:60: warning: type defaults to 'int' in declaration of 'type name'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
owmemorykiller.c
10626434f473a7b4b0a21f427b301d3dd0db65a8 05-Jul-2009 Daniel Walker <dwalker@fifo99.com> Staging: android: binder: partial checkpatch cleanup

Clean up 3 or so checkpatch errors from one of my prior patches.

Signed-off-by: Daniel Walker <dwalker@fifo99.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Brian Swetland <swetland@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
272bb3d8759448b2017aee149d226d7bf2d2bbb7 05-Jul-2009 Daniel Walker <dwalker@fifo99.com> Staging: android: lowmemorykiller: delete the decription file

Move the lowmemorykiller.txt into the actual source file which is really the
correct place for it, and delete lowmemorykiller.txt.

Signed-off-by: Daniel Walker <dwalker@fifo99.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Brian Swetland <swetland@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
owmemorykiller.c
owmemorykiller.txt
edd540ea92954f896bfb7ee0ebf5dfdde6e6cb41 05-Jul-2009 Daniel Walker <dwalker@fifo99.com> Staging: android: lowmemorykiller: remove a predefine

I moved the struct shrinker down so that the predefine isn't needed.

Signed-off-by: Daniel Walker <dwalker@fifo99.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Brian Swetland <swetland@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
owmemorykiller.c
707636ff4bd4057b8fb9c1e6cc68885014623b17 05-Jul-2009 Daniel Walker <dwalker@fifo99.com> Staging: android: binder: cleanup some long lines

This file has a lot of long line problems due to the massive indent issues
that exist. This just cleans up some of the really really long ones.

Signed-off-by: Daniel Walker <dwalker@fifo99.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Brian Swetland <swetland@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
8683b987285e4542dd79192054ee4591b8cc7700 12-Jun-2009 Daniel Walker <dwalker@fifo99.com> staging: android: binder: clean up for all the stat statments

An initial cleanup of all the binder_stat statements. The binder
command and return stats still need some assistance tho.

Signed-off-by: Daniel Walker <dwalker@fifo99.com>
Cc: Brian Swetland <swetland@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
39e420e0a918e7d2123e26a3617568fe2b6af8c6 12-Jun-2009 Daniel Walker <dwalker@fifo99.com> staging: android: binder: global variable cleanup.

Replaced a manual hlist_head declaration with a macro based one.
Also reorganized the globals to be grouped better.

Signed-off-by: Daniel Walker <dwalker@fifo99.com>
Cc: Brian Swetland <swetland@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
fd0a2f07d9b37fa52ece5bdec4f1130e080c1f51 12-Jun-2009 Daniel Walker <dwalker@fifo99.com> staging: android: binder: add enum usage in function arguments

Declare the binder_deferred_state enum, and use the new enum
for one of the binder_defer_work function arguments. This
should keep the argument within the confines of the enum
instead of the whole int range.

Signed-off-by: Daniel Walker <dwalker@fifo99.com>
Cc: Brian Swetland <swetland@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
9980318e5405fe34a8f7e3af439647a729d10014 12-Jun-2009 Daniel Walker <dwalker@fifo99.com> staging: android: binder: remove a predefine

I removed the binder_transaction_buffer_release predefine, and put
the actual function in place of it.

Signed-off-by: Daniel Walker <dwalker@fifo99.com>
Cc: Brian Swetland <swetland@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
df56cb1f37415f16a187738ee9e3c03e2106e305 12-Jun-2009 Daniel Walker <dwalker@fifo99.com> staging: android: binder: move debugging mask into a macro

I moved the continual,

if (binder_debug_mask & mask)
printk()

into a single macro so it's all in one place. It could be refined further
from there.

Signed-off-by: Daniel Walker <dwalker@fifo99.com>
Cc: Brian Swetland <swetland@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
a6a9f81ccc9f5c86ccc22bbed1960a57d0316e8b 17-Jun-2009 David Rientjes <rientjes@google.com> Staging: android: lowmemorykiller.c: fix it for "oom: move oom_adj value from task_struct to mm_struct"

I'm about to merge "oom: move oom_adj value from task_struct to
mm_struct", and this fixup is needed to repair linux-next's
drivers/staging/android/lowmemorykiller.c.

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
owmemorykiller.c
d604fc995e7d222b043b33676f64e8b855fa596f 04-Jun-2009 Greg Kroah-Hartman <gregkh@suse.de> Staging: android: fix Kconfig issues

Wrap all ANDROID config items with a #if to keep from asking if you want
specific Android drivers even if you say N to CONFIG_ANDROID

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
config
3dffc8271f778b9ac8eb6985c99f23cef7a753d6 12-May-2009 Greg Kroah-Hartman <gregkh@suse.de> Staging: android: binder: fix up some checkpatch warnings

This cleans up the majority of the checkpatch warnings in the android
binder driver. All that is left now is a bunch of too-long-line stuff.


Cc: San Mehat <san@android.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
e93daf9f8d94b9dc31a66e3ae76d7fdf80b1cb7d 12-May-2009 Greg Kroah-Hartman <gregkh@suse.de> Staging: android: ram_console: fix up remaining checkpatch warnings

This cleans up the last of the checkpatch warnings in the android
ram_console driver.


Cc: San Mehat <san@android.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
am_console.c
66b20608c9e98a0a29806bd47b30565927fdbbd8 12-May-2009 Greg Kroah-Hartman <gregkh@suse.de> Staging: android: logger: fix up remaining checkpatch warnings

This cleans up the last of the checkpatch warnings in the android logger
driver.


Cc: San Mehat <san@android.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
ogger.c
1dbb5765acc7a6fe4bc1957c001037cc9d02ae03 12-May-2009 Greg Kroah-Hartman <gregkh@suse.de> Staging: android: lowmemorykiller: fix up remaining checkpatch warnings

This cleans up the last of the checkpatch warnings in the android
lowmemorykiller driver.


Cc: San Mehat <san@android.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
owmemorykiller.c
241e12879be74fdfadf3abc820a2e3c455599c3c 05-May-2009 Mike Lockwood <lockwood@android.com> Staging: android: timed_gpio: Separate timed_output class into a separate driver.

Signed-off-by: Mike Lockwood <lockwood@android.com>
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
config
akefile
imed_gpio.c
imed_gpio.h
imed_output.c
imed_output.h
5d14a573a4da521d4ed7acd0c7d8a975887b2dd2 12-May-2009 David Rientjes <rientjes@google.com> Staging: android: lowmemorykiller: fix possible android low memory killer NULL pointer

get_mm_rss() atomically dereferences the actual without checking for a
NULL pointer, which is possible since task_lock() is not held.

Cc: San Mehat <san@android.com>
Cc: Arve Hjønnevåg <arve@android.com>
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
owmemorykiller.c
34006e11ee406daa98aaf685d2de80c70e68decf 12-May-2009 David Rientjes <rientjes@google.com> Staging: android: lowmemorykiller: cleanup android low memory killer

Clean up the code in lowmem_shrink() for the Android low memory killer so
that it follows the kernel coding style.

It's unnecessary to check for p->oomkilladj >= min_adj if the selected
task's oomkilladj score is stored since get_mm_rss() will always be
greater than zero.

Cc: San Mehat <san@android.com>
Cc: Arve Hjønnevåg <arve@android.com>
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
owmemorykiller.c
31d59a4198f3f07da8250dfb5b698eacfaf612e5 12-May-2009 Arve Hjønnevåg <arve@android.com> Staging: android: lowmemorykiller: Don't count free space unless it meets the specified limit by itself

From: Arve Hjønnevåg <arve@android.com>

This allows processes to be killed when the kernel evict cache pages in
an attempt to get more contiguous free memory.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Cc: David Rientjes <rientjes@google.com>
Cc: San Mehat <san@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
owmemorykiller.c
f501d00144328ca9e0521d159cf80ff5c9d21d77 12-May-2009 Arve Hjønnevåg <arve@android.com> Staging: android: lowmemorykiller: Only iterate over process list when needed.

Use NR_ACTIVE plus NR_INACTIVE as a size estimate for our fake cache
instead the sum of rss. Neither method is accurate.

Also skip the process scan, if the amount of memory available is above
the largest threshold set.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Cc: David Rientjes <rientjes@google.com>
Cc: San Mehat <san@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
owmemorykiller.c
861a0dcc397f3e94024cc311086799393ec517df 07-Apr-2009 Arve Hjønnevåg <arve@android.com> Staging: binder: Defer flush and release operations to avoid deadlocks.

If a transaction that contains a file descriptor fails on a later object,
the new file descriptor needs to be closed. If this is a binder file
descriptor we would deadlock in flush. If there were no other references to
the file at this point release would also be called.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
0cf24a7dc9123ddf63c413b6d4b38017b19db713 07-Apr-2009 Arve Hjønnevåg <arve@android.com> Staging: binder: Prevent the wrong thread from adding a transaction to the stack.

If a thread is part of a transaction stack, it is only allowed to make
another call if it was the target of the top transaction on the stack.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
7af7467efa64affc6505375ceac97d68cfb58e94 07-Apr-2009 Arve Hjønnevåg <arve@android.com> Staging: binder: Cast to uintptr_t instead of size_t when aligning pointers

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
282ca175d4c440ec4d74bc622ee497e5b3530ce5 07-Apr-2009 Arve Hjønnevåg <arve@android.com> Staging: binder: Keep a reference to the files_struct while the driver is mmapped

This prevents breaking fget_light if a single threaded application
allows incoming file descriptors (in replies or on nodes).
Should also prevent inserting a file in the wrong files_struct if the
receving process execs in the middle of a transaction (between
task_get_unused_fd_flags and task_fd_install).

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
ea5c4cc68e2b5f4ec41d666376d3606d4d5c3426 07-Apr-2009 Arve Hjønnevåg <arve@android.com> Staging: binder: Add more offset validation.

Check that datasize is not smaller than one flat_binder_object.
Check that offsets are aligned.
Check that offsets_size is aligned.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
4ddfc911e39a01f95ad9765d3b9e6f43e14eeff4 07-Apr-2009 Arve Hjønnevåg <arve@android.com> Staging: binder: mmap fixes.

Only allow a binder file pointer to be mmapped once. The buffer management
code cannot deal with more then one area.
Also remove leftover mutex_unlock if mmap fails.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
85e0b0cbbfc17e7f7baa9e76f9a937249108fc52 07-Apr-2009 Arve Hjønnevåg <arve@android.com> Staging: binder: Don't create two proc entries with the same name if the driver is opened twice in one process.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
1d8cbcf5d66b1f23f776a2c10ef9574a338cd109 07-Apr-2009 Arve Hjønnevåg <arve@android.com> Staging: binder: Remove VM_EXEC check.

Many platforms do not support mappings without VM_EXEC.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
bdd345d8560ab09162edd7c8fb64b7eb280a70d2 17-Feb-2009 Randy Dunlap <randy.dunlap@oracle.com> Staging: Android: fix more printk formats

Fix more android ram_console printk format warnings:

drivers/staging/android/ram_console.c:238: warning: format '%d' expects type 'int', but argument 3 has type 'size_t'
drivers/staging/android/ram_console.c:238: warning: format '%d' expects type 'int', but argument 4 has type 'size_t'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
am_console.c
7fce939942ba642b40d1d26581e824871eb3b081 11-Feb-2009 Randy Dunlap <randy.dunlap@oracle.com> Staging: android: ram_console: fix printk format warning

Fix android printk format warnings:

linux-next-20090209/drivers/staging/android/ram_console.c:228: warning: format '%d' expects type 'int', but argument 3 has type 'size_t'
linux-next-20090209/drivers/staging/android/ram_console.c:228: warning: format '%d' expects type 'int', but argument 4 has type 'size_t'
linux-next-20090209/drivers/staging/android/ram_console.c:326: warning: format '%x' expects type 'unsigned int', but argument 2 has type 'size_t'
linux-next-20090209/drivers/staging/android/ram_console.c:326: warning: format '%x' expects type 'unsigned int', but argument 3 has type 'size_t'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
am_console.c
45eb7ae173a444884bb05bb842f07b2ab57aef41 11-Feb-2009 Randy Dunlap <randy.dunlap@oracle.com> Staging: android: binder: fix printk format warnings

Fix printk format warnings in android binder:

drivers/staging/android/binder.c:2652: warning: format '%lx' expects type 'long unsigned int', but argument 7 has type 'pgprotval_t'
drivers/staging/android/binder.c:2659: warning: format '%lx' expects type 'long unsigned int', but argument 7 has type 'pgprotval_t'
drivers/staging/android/binder.c:2680: warning: format '%lx' expects type 'long unsigned int', but argument 7 has type 'pgprotval_t'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
d88dfb8dc4bfb66066e7c68727c219faaa541206 05-Feb-2009 Greg Kroah-Hartman <gregkh@suse.de> Staging: android: fix up units in timed_gpio

The last build fix I did messed up the units of the sysfs file.

This puts them back to be milliseconds, like they originally were.


Thanks to Juha Motorsportcom for pointing this out.

Reported-by: Juha Motorsportcom <juha_motorsportcom@luukku.com>
Cc: Mike Lockwood <lockwood@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
imed_gpio.c
5701c0519b7a357a602fda5c96f26197ecfc4c85 31-Jan-2009 Arve Hjønnevåg <arve@android.com> Staging: android: ram_console: Disable ECC when early init is enabled and validate buffer size

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
config
am_console.c
1176e83aff6f15b6ae4d1b53c16124884ad29363 18-Jan-2009 Oleg Nesterov <oleg@redhat.com> Staging: android: task_get_unused_fd_flags: fix the wrong usage of tsk->signal

Compile tested.

task_struct->signal is not protected by RCU, the code is bogus.
Change the code to take ->siglock to pin ->signal.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Brian Swetland <swetland@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
191805ac41a63929003faa33365027d3fb924d71 15-Jan-2009 Arve Hjønnevåg <arve@android.com> Staging: android: Add lowmemorykiller documentation.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
owmemorykiller.txt
07960058f0ce77ddc3027d3e45a5de1fb977334f 29-Jan-2009 Greg Kroah-Hartman <gregkh@suse.de> Staging: android: fix build error on 64bit boxes

ktime_t isn't ment to directly access on all arches, so use the proper
conversion functions instead to figure out what time is remaining.

Reported-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Mike Lockwood <lockwood@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
imed_gpio.c
2d0db6bf5010c26beb1ccbd4ee50991fd2c05d90 09-Jan-2009 Arve Hjønnevåg <arve@android.com> Staging: android: timed_gpio: Fix build to build on kernels after 2.6.25.

Reported-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Mike Lockwood <lockwood@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
imed_gpio.c
c171ac36b74f6c90bc7a03c309136ba175314b6d 09-Jan-2009 Arve Hjønnevåg <arve@android.com> Staging: android: binder: fix arm build errors

Reported-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
7a9c67a6ad2e6911e7ebdae34a75835c537d6e84 21-Dec-2008 Greg Kroah-Hartman <gregkh@suse.de> Staging: android: binder: fix build errors

This fixes the build errors and warnings in the binder driver. It can't
be a module, due to a lack of some of the symbols being exported.

Also added a MODULE_LICENSE(), as it was missing.

Cc: Arve Hjønnevåg <arve@android.com>
Cc: Brian Swetland <swetland@google.com>
Cc: Robert Love <rlove@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
config
inder.c
08b88cc7844bf984e2e474134c207bb2c46c007d 20-Dec-2008 San Mehat <san@android.com> Staging: android: add lowmemorykiller driver

From: San Mehat <san@android.com>
Cc: Brian Swetland <swetland@google.com>
Cc: Robert Love <rlove@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
config
akefile
owmemorykiller.c
1fa7026ff026012f3a819b49d44dd6267997f379 20-Dec-2008 Greg Kroah-Hartman <gregkh@suse.de> Staging: android: remove dummy android.c driver

There are files now in the drivers/staging/android/ directory, so the
dummy android.c file can be safely removed.

Cc: Robert Love <rlove@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
akefile
ODO
ndroid.c
653d1290be3bb04688514bec92c11eb6b7c324a7 23-Dec-2008 Mike Lockwood <lockwood@android.com> Staging: android: timed_gpio: Rename android_timed_gpio to timed_gpio

Signed-off-by: Mike Lockwood <lockwood@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
ndroid_timed_gpio.h
imed_gpio.c
imed_gpio.h
99f41131b8d82cde1a84fec5b93ce31632552f0b 20-Dec-2008 Mike Lockwood <lockwood@android.com> Staging: android: add timed_gpio driver

driver for GPIOs that turn back off after a delay

From: Mike Lockwood <lockwood@android.com>
Signed-off-by: Brian Swetland <swetland@google.com>
Cc: Robert Love <rlove@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
config
akefile
ndroid_timed_gpio.h
imed_gpio.c
adc567e8a9c25f08e91eb18b83bdaa5ff9705919 20-Dec-2008 Arve Hjønnevåg <arve@android.com> Staging: android: add ram_console driver

Doesn't quite link properly under all configurations, and it has way too
many different build options, but it's a start.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Brian Swetland <swetland@google.com>
Cc: Robert Love <rlove@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
config
akefile
am_console.c
875f194c48ddae3797f8d61e98aacd8a8ecef927 20-Dec-2008 Robert Love <rlove@google.com> Staging: android: add logging driver

Signed-off-by: Robert Love <rlove@google.com>
Signed-off-by: Brian Swetland <swetland@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
config
akefile
ogger.c
ogger.h
9279bcc31698842961a30bb05b00aef7236dd728 05-Jan-2009 J.R. Mauro <jrm8005@gmail.com> staging: android: binder: Fix use of euid

Task credentials were moved and must be accessed through task_struct.cred

Signed-off-by: J.R. Mauro <jrm8005@gmail.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Brian Swetland <swetland@google.com>
Cc: Robert Love <rlove@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
a2bf2153cb2a2de341b6a87cb644870a5bde2a9d 05-Jan-2009 J.R. Mauro <jrm8005@gmail.com> Staging: android: binder: Fix gcc warnings about improper format specifiers for size_t in printk

Use the proper format specifiers for printing size_t values.

Signed-off-by: J.R. Mauro <jrm8005@gmail.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Brian Swetland <swetland@google.com>
Cc: Robert Love <rlove@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
inder.c
457b9a6f09f011ebcb9b52cc203a6331a6fc2de7 20-Dec-2008 Arve Hjønnevåg <arve@android.com> Staging: android: add binder driver

It builds, but not as a module, and with lots of warnings.

I also had to fix up a few syntax errors to get it to build
properly, I'm doubting that anyone has built it in a while :(

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Brian Swetland <swetland@google.com>
Cc: Robert Love <rlove@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
config
akefile
inder.c
inder.h
6dc9c9e8b0b51abd9a332f5f4767df729848d579 20-Dec-2008 Greg Kroah-Hartman <gregkh@suse.de> Staging: add android framework

This prepares us to start adding the android drivers
to the build.

The dummy android.c file will go away in the next few patches, as it
will not be needed once drivers/staging/android/ has a driver in it.

Cc: Robert Love <rlove@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
config
akefile
ndroid.c