ARM: Fix "Make low-level printk work" to use a separate config option

Signed-off-by: Arve Hjønnevåg <arve@android.com>
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.

Change-Id: I53636d4ec46d8dc5e694697aaf2d62b98bd78cb1
Signed-off-by: John Stultz <john.stultz@linaro.org>
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.

Change-Id: I56da5624fca3bed4ee24806b6ec39de903543341
Signed-off-by: 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.

Change-Id: I96c7142637638991f3a9af9be7cfbb50f79f3803
Signed-off-by: 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.

Change-Id: I8451c2dae4bf85841015c016640684ac28430a5a
Signed-off-by: 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.

Change-Id: Id9b07f1196b2bafe04636fa1aa46dfc84d003cf0
Signed-off-by: Colin Cross <ccross@android.com>
video: adf: make device node names less hierarchical

adf/foobar/device -> adf0
adf/foobar/interface1 -> adf-interface0.1
adf/foobar/overlay-engine1 -> adf-overlay-engine0.1

Change-Id: I7af7f84ce3f101ecb02f448070c200ff3e03f2ec
Signed-off-by: Greg Hackmann <ghackmann@google.com>
video: adf: remove PAGE_SIZE from userspace-facing header

Systems may define PAGE_SIZE in userspace limits.h but don't have to.
PAGE_SIZE was picked as an arbitrary "reasonable" limit so just use 4096
instead.

Change-Id: I9555e39aba64a3a70f61eb6ded2a4129ab236ce0
Signed-off-by: Greg Hackmann <ghackmann@google.com>
video: adf: fix ADF_MAX_ATTACHMENTS declaration

Userspace-facing ADF_MAX_ATTACHMENTS must be in terms of
userspace-facing struct adf_attachment_config

Change-Id: Iaaddcd6366f13b3e52eb3911efcfff8a61e0b225
Signed-off-by: Greg Hackmann <ghackmann@google.com>
video: adf: validate dpms state passed to blank

Change-Id: I3a4228d50fc4a2553b3e92e5675a94cbc6e71b8a
Signed-off-by: Greg Hackmann <ghackmann@google.com>
video: adf: fix fbdev blank -> dpms state mapping

Change-Id: I96132a1b7275d389a6d0ba8899c6be838b63c422
Signed-off-by: Greg Hackmann <ghackmann@google.com>