PM / Sleep: Do not check wakeup too often in try_to_freeze_tasks()

Use the observation that it is more efficient to check the wakeup
variable once before the loop reporting tasks that were not
frozen in try_to_freeze_tasks() than to do that in every step of that
loop.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

Conflicts:

	kernel/power/process.c

Change-Id: I0bd9e71b638e565773f4861899ca175f82f2a4cc
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
Signed-off-by: Darescu Ionut <johnny@esi.ro>
diag: Improve handling of IOCTLs

DIAG kernel driver interacts with user space processes using
IOCTLS. This change adds conditions to avoid potential integer
over/underflow, incorrect buffer copy.

CVE-2012-4220
CVE-2012-4221

Change-Id: If62cbdc953d67436a0a785f43f263a2cb0a76973
CRs-Fixed: 385352
CRs-Fixed: 385349
Signed-off-by: Ravi Aravamudhan <aravamud@codeaurora.org>
Signed-off-by: Darescu Ionut <johnny@esi.ro>
lib: genalloc: Change chunk allocation to vmalloc

Change the chunk allocation from kmalloc to vmalloc for
allocations greater than a page. This allows large
chunks to be allocated from physically non-contiguous
memory and increases the chance of the allocation
succeeding.

(cherry picked from commit 0614b96dc8e4c8a0dd0db41aec5a79daa3bdf091)

Conflicts:

	lib/genalloc.c

(cherry picked from commit 64cf7183f37df623bec8f46348b11c5781d3b0cc)

Change-Id: Ied97c888b967c4433519cb47e972f7a0f2281d71
CRs-fixed: 387655
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Darescu Ionut <johnny@esi.ro>
msm_serial_hs_hwreg.h: Correcting the even parity and odd parity bits

Currently parity bits are defined to be used with UART_DM_MR2
register with PARITY_MODE Bit as below :
EVEN_PARTIY = 1 and ODD_PARITY = 2
With these values, UART functionality doesn't work after enabling parity.
Hence adding correct used PARITY_MODE bits value as
EVEN_PARITY = 2 and ODD_PARITY = 1
after confirming with UART hardware programming guide.

(cherry picked from commit fd40e5f6313fbc74e8897927be1004faa5d9df08)

Change-Id: I90fa8384d434abd42dc46c917d39e8de1f540993
CRs-Fixed: 410377
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
Signed-off-by: Darescu Ionut <johnny@esi.ro>
cpufreq: Add cpu utilization statistics to aid decisions made by userspace.

Understanding system load as seen by cpufreq can help userspace
algorithms make better decisions to improve system responsiveness.
One such example would be the MP decision algorithm which mines
various system info to make decisions on hotplugging in/out
the additional cores.

CRs-fixed: 344675
Signed-off-by: Anitha Anand <anithas@codeaurora.org>
(cherry picked from commit cbeef6aafc4964c4a6cfafd26b23eaccd40804b4)

Change-Id: I7b4450ed7b3bf8196870717e1907fd93c5cfbe98
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
Signed-off-by: Darescu Ionut <johnny@esi.ro>
msm: memory: Use standard cache routines

Convert custom clean, flush, and invalidate cache routines to use
standard ARM cache routines.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit 29bb4d5fa7a285c8fb5d5db55225dab700b80419)

Change-Id: I2c83c27e55811a42fdfdbca08c3db772c5c83e15
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
Signed-off-by: Darescu Ionut <johnny@esi.ro>
fs: fat: rate limit the kernel messages

If FAT formatted SD card gets removed without unmounting,
FAT file system may throw many kernel error messages which
could too much traffic for console driver and can sometimes
even cause the system to trigger watchdog timeout.

This patch converts the printk to printk_ratelimited to rate
limit the error messages from FAT fs.

CRs-fixed: 368446
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
(cherry picked from commit a872b71069d717ced1a2de642afa0693d1bb9448)

Change-Id: I3ace0ffc5a0119641dff8084adccf7ed780c7900
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
Signed-off-by: Darescu Ionut <johnny@esi.ro>
msm: clock-8960/8660: Support 32/64MHz prng clock frequency plan

Add support for both the 32MHz and the 64MHz prng frequencies.
Some bootloaders configure the PRNG to 32MHz and others choose
64MHz. Support both so that we always vote for the correct
voltage

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
(cherry picked from commit 842a1f6b0eb8ecf40f97fa020fa004745ba1ab48)

Conflicts:

	arch/arm/mach-msm/clock-8960.c
	arch/arm/mach-msm/clock-8x60.c

Change-Id: I732aaa78d2019d6fefd90456f67ca27db1be9874
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Darescu Ionut <johnny@esi.ro>
arm: show present cpu instead of online cpu in /proc/cpuinfo

Some userspace applications use /proc/cpuinfo to determine how many CPUs
the system has. CPU hotplug can offline a CPU at runtime and causing the
offline CPU not present in /proc/cpuinfo if we only show online cpu in
/proc/cpuinfo.

CRs-Fixed: 354430
Signed-off-by: Jin Hong <jinh@codeaurora.org>
(cherry picked from commit 1e28794d0ff00fc6567d68b5b4e863b0745cfe20)

Change-Id: I3b38472b690bb3dba67ada74f60cce79ed0b2a7d
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
Signed-off-by: Darescu Ionut <johnny@esi.ro>
msm_fb: display: Update video format on fps change

Added check for frame rate change. Corner case if there is no
change in xres,yres and pixclock.

CRs-Fixed: 356328
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
(cherry picked from commit 1b92af6e05320b6f5858a0e4b5c9aa40e54a9b54)

Change-Id: I43cb099068ef4c69a364b142eb3c34a3fc426db6
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
Signed-off-by: Darescu Ionut <johnny@esi.ro>
vidc: Free shared memory when video core is in error.

When the video core is in error, the core times out.
At this instant, all the client buffers are freed,
but the shared memory is not freed. Free the shared
memory in this case.

CRs-Fixed: 357990
Signed-off-by: Deepak Kotur <dkotur@codeaurora.org>
(cherry picked from commit 17ca3688442f000d925287251456ef4a3eb63db3)

Change-Id: I7695d4b101d8b769276a73100de9cb2495d1ccb9
Signed-off-by: Gopal G Goberu <ggober@codeaurora.org>
Signed-off-by: Darescu Ionut <johnny@esi.ro>
vidc: Send port reconfiguration for interlaced clips.

Component is not getting port reconfiguration request
from driver for an interlaced clip. Fix it by
modifying the condition for triggering the
reconfiguration request.

CRs-Fixed: 352456
Change-Id: I65ce5987f31915f45a13767965918b61e32db7a7
Signed-off-by: Rajeshwar Kurapaty <rkurapat@codeaurora.org>
(cherry picked from commit c264eed1e7debb50c97159784307de23bdfc3a3b)
Signed-off-by: Darescu Ionut <johnny@esi.ro>
vidc: Move metadata shared input mem to firmware heap.

Metadata shared input is used to communicate between
the video code and video driver, hence make this buffer
as uncached and allocate it from firmware heap.

(cherry picked from commit c6802266a867fbd1e8fd03ca87b28ea8c0561f3e)

Change-Id: Ib7e5383c530c71f27f313698ffd61cf0d0cafe2c
Signed-off-by: Deepak Kotur <dkotur@codeaurora.org>
Signed-off-by: Darescu Ionut <johnny@esi.ro>