msm: smd_pkt: Fix wakelock concurrency issue

In failure conditions, some clients violate the SMD PKT restriction of
single-threaded access resulting in overlapping open requests which
corrupt the wakelock list.

Move the wakelock initialization into the channel mutex to prevent
concurrent access from corrupting the wakelock.

CRs-Fixed: 374644
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>

(cherry picked from commit b399a4fbce9c9b20ef258e3245e916cd9ce788e2)

Conflicts:

	arch/arm/mach-msm/smd_pkt.c

Change-Id: I43df498cbf3480b8e345900be49c16afc4669f4a
Signed-off-by: Subrahmanyam Uppala <csuppal@codeaurora.org>
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
mmc: msm_sdcc: Fix race in disabling sdcc core irq

o Assume SDCC driver has SDIO clients attached and
  runtime clock gating has turned off the SDCC clocks.

o Now, if the SDIO client driver has initiated a request
  to SDCC and since the clocks are turned off, mmc framework
  tries to turn them on calling msmsdcc_set_ios().

o msmsdcc_set_ios() tries to disable the core irq first and
  reenable after the clocks are turned on. While in process
  of disabling the irq, if there is an asynchronous notification
  from SDIO client h/w, it will preempt ongoing disable and run
  msmsdcc_irq() which internally does disable_irq_nosync() since
  the clocks are still off.

o While the control returns to msmsdcc_set_ios() from preemption
  it will continue disabling the core irq (even though
  host->sdcc_irq_disabled = 1). In effect, calls disable_irq()
  twice increasing the irq desc->depth to 2.

o The enable_irq() API enables the irq in h/w if and only if
  desc->depth = 1, and hence become a noop if it is called with
  desc->depth = 2 causing sdcc failure because the interrupts
  are not enabled in h/w.

Fix the above race condition by making sure disable irq is done
atomically.

CRs-Fixed: 357406
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
(cherry picked from commit b72586253db2ac7105f6dea45418ce5c50e2fcac)

Change-Id: I63a30978941746a48221cb7d4b7860956001329a
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
mmc: msm_sdcc: Fix deadlock while resuming sdcc from userspace

The runtime power management of sdcc can be controlled by
userspace with auto/on modes by writing into
/sys/devices/platform/msm_sdcc.1/power/control entry.
"auto" mode allows runtime pm suspend to happen.
"on" mode forbids runtime suspend of sdcc and also take care
of resuming the device if already suspended. During this resume
process there is a deadlock as described below:

o User writes "on" into control parameter.

o The sysfs write triggers a rpm_resume() (assume sdcc is
  already suspended, hence rpm_resume() tries to wake it up).

o rpm_resume() -> msmsdcc_runtime_resume() -> mmc_claim_host()
  -> msmsdcc_enable() -> pm_runtime_get_sync() -> rpm_resume()
  -> wait for previous rpm_resume() completion which cause deadlock.

CRs-Fixed: 372071
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
(cherry picked from commit 112bd758e0992f1c7de4531e6530db5e49d6f21f)

Change-Id: I87538826bacd36971deeec4ff7f36aa5782b328e
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
hwmon: pm8xxx-adc: Remove wakelocks

The PM8xxx ADC interrupt is configured as a
wakeable interrupt. Therefore the system can suspend
and still have the end of conversion interrupt be
serviced.

Add a timeout in the wait_for_completion in case
the end of conversion event is not received. This
is to rule out any side affects if a missed interrupt
occurs.

Change-Id: Iad36ad4fb7e550e563f0bf7803d3e5e861b7aacd
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
bluetooth: Check for hcon during during sock_close

It is possible that during BT OFF operation the hcon
could be released from a tasklet context while we are
trying to send the l2cap disconnect req. Make sure
that hcon is valid before dereferencing it during
l2cap disconnect req.

CRs-fixed: 383345
Change-Id: Icb12c62560013b5ebb047c1c5d4bfe04b3a793ef
Signed-off-by: Sunny Kapdi <sunnyk@codeaurora.org>
misc: pmic8058-xoadc: Fix section mismatches

The remove function is called from the probe function for any
error that occurs. Beyond just triggering a section mismatch this
also leads to incorrect operations occurring on error and a memory
leak as well. Fix all of this with devm_kzalloc and proper
ordering of the probe routine. We do hit a point of no return in
the probe, but that's existed for a long time so this isn't any
worse.

WARNING: vmlinux.o(.devinit.text+0x12d0): Section mismatch in
reference from the function pm8058_xoadc_probe() to the function
.devexit.text:pm8058_xoadc_teardown()
The function __devinit pm8058_xoadc_probe() references
a function __devexit pm8058_xoadc_teardown().
This is often seen when error handling in the init function
uses functionality in the exit path.
The fix is often to remove the __devexit annotation of
pm8058_xoadc_teardown() so it may be used outside an exit
section.

Change-Id: I416b58ec12e3474149fb3fad49969cd162275633
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
lib/string: use glibc version

the performance of memcpy and memmove of the general version is very
inefficient, this patch improved them.

Signed-off-by: Miao Xie <miaox*******>
adapted by faux123 for 3.0.13 kernel
slub.c: little tweak for performance improvements
block: strict rq_affinity
Makefile: vfp: compile as neon
ARM: SMP: use a timing out completion for cpu hotplug - from Russel King
dhd_linux.c: add my wifi power management module feature from my other device's kernels. Y to enable it and N to disable it
OC: Removed some freqs
GPU: Updates iofractions
GOV: Updated pegasusQ