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.

Bug: 9261835
Change-Id: If1322e981d29c889a56cdc9dfcbc6df2729a45e9
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Squashed update of kernel from 3.4.47 to 3.4.48
apache: Change to correct camera sensor for this phone
misc: uidstat: avoid create_stat() race and blockage.

* create_stat() race would lead to:
  [   58.132324] proc_dir_entry 'uid_stat/10061' already registered

* blocking kmalloc reported by sbranden
 tcp_read_sock()
  uid_stat_tcp_rcv()
    create_stat()
      kmalloc(GFP_KERNEL)

Signed-off-by: JP Abgrall <jpa@google.com>
Fix problems of the squashed update to 3.4.48 kernel version by reverting "mm/pagewalk.c: walk_page_range should avoid VM_PFNMAP areas"

This reverts commit:
https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/?id=c8a097fd8d73584d7c1577e0aee41c2a177394f7

The changes made by this commit caused kernel panics while performing
memory operations with subsequent hangs, reboots or shutdowns.
Squashed update of BFQ-v6 to BFQ-v6r1

- Fix use-after-free of queues in __bfq_bfqq_expire(). It may happen that
  a call to bfq_del_bfqq_busy() puts the last reference taken on a queue
  and frees it. Subsequent accesses to that same queue would result in a
  use-after-free. Make sure that a queue that has just been deleted from
  busy is no more touched.
- Use the uninitialized_var() macro when needed. It may happen that a
  variable is initialized in a function that is called by the function
  that defined it. Use the uninitialized_var() macro in these cases.
cpufreq: interactive: handle errors from cpufreq_frequency_table_target

Add checks for error return from cpufreq_frequency_table_target, and be
less noisy on the existing call with an error check.  CPU hotplug and
system shutdown may cause this call to return -EINVAL.

Bug: 8613560
Change-Id: Id78d8829920462c0db1c7e14e717d91740d6cb44
Signed-off-by: Todd Poynor <toddpoynor@google.com>
cpufreq: interactive: reduce chance of zero time delta on load eval

Reschedule load sampling timer after timestamp of sample start taken,
hold spinlock across entire sequence to avoid preemption.  Avoid the
WARN for zero time delta in the load sampling timer function.

Change-Id: Idc10a756f09141decb6df92669521a1ebf0dbc10
Signed-off-by: Todd Poynor <toddpoynor@google.com>
cpufreq: interactive: avoid underflow on active time calculation

Check for idle time delta less than elapsed time delta, avoid
underflow computing active time.

Change-Id: I3e4c6ef1ad794eec49ed379c0c50fa727fd6ad28
Signed-off-by: Minsung Kim <ms925.kim@samsung.com>
Squashed update of kernel from 3.4.48 to 3.4.49
net: wireless: bcmdhd: Disable SUPPORT_PM2_ONLY and DISABLE_FW_ROAM_SUSPEND

Should provide better battery savings.
net: wireless: bcmdhd: Fixed data CRC errors

It is probable that enable the CMD14 in sd bus, creates problems.
In the old version of the driver is used only in the BCM4330 chipset.

dmesg:
<3>[  127.747741] mmc0: Data CRC error
<3>[  127.747863] msmsdcc_data_err: opcode 0x00000035
<3>[  127.747924] msmsdcc_data_err: blksz 4, blocks 1
Squashed update of BFQ-v6r1 to BFQ-v6r2
set the DEFAULT_GAMMA_LEVEL from 160CD to 20CD
this fixes the high brightness for a sec when turning on the display
video: msm: lcdc_s6e63m0: Corrected an unmanaged gamma for autobrightness

Inside the "s6e63m0_set_elvss" method the management of GAMMA_20CD is missing inside the switch block:
case GAMMA_30CD ... GAMMA_100CD
should be
case GAMMA_20CD ... GAMMA_100CD

Have been corrected also some wrong comments.
input: keyboard: cypress-touchkey: Some changes and code cleanup

- Use only one pointer to cypress_touchkey_devdata, instead of three
- Register the early suspend only when needed (CONFIG_HAS_EARLYSUSPEND)
- Removed unuseful code and commented code
- Code reindented for better readability
input: keyboard: cypress-touchkey: Customizable timeout for touchkeys backlight

This commit adds a sysfs customizable timeout parameter for the touchkeys backlight.
The parameter could be found at the following path:
/sys/class/misc/notification/bl_timeout
input: keyboard: cypress-touchkey: Manage the timeout of touchkeys backlight after a touchscreen press
input: keyboard: cypress-touchkey: Customizable activation status of touchkeys backlight on touchscreen press

This commit adds a sysfs customizable status parameter to enable/disable
the touchkeys backlight on a touchscreen press.
The parameter could be found at the following path:
/sys/class/misc/notification/touchlight_enabled
power: fuelgauge_max17043: Remove trailing spaces