sched: core: Ignore idle tasks

Don't calculate average loads for idle tasks, return early instead.
 msm: limiter: Cleanup debug prints

Signed-off-by: Pranav Vashi <neobuddy89@gmail.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>
Signed-off-by: Pranav Vashi <neobuddy89@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>
Signed-off-by: Pranav Vashi <neobuddy89@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>
Signed-off-by: Pranav Vashi <neobuddy89@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>
Signed-off-by: Pranav Vashi <neobuddy89@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>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Revert "sched: core: Ignore idle tasks"

This reverts commit fa0759f7e0eaec6feb866526ff60e54735ad38fa.
sched: Skip load update for idle task

Load statistics for idle tasks is not useful in any manner. Skip load
update for such idle tasks.

CRs-Fixed: 665706
Change-Id: If3a908bad7fbb42dcb3d0a1d073a3750cf32fcf9
Signed-off-by: Srivatsa Vaddagiri <vatsa@codeaurora.org>
Update LINARO 2014.06 Tool Chain self compiled for LG Cortex-a15 Neon.
net/bridge/br_multicast.c: fix: include/net/ipv6.h:362:27: warning: '*((void *)&ip+4)'& '*((void *)&ip+8)' may be used uninitialized in this function

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
drivers/mfd/wcd9xxx-core.c: fix: warning: array subscript is below array bounds

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
Fixes to kernel code inits after checking build with -O3
msm: hotplug: Add control for max_cpus_online while suspend

* Recent findings hints that all sibling cores going offline
  while suspend introduces glitch in music playback with
  DSP Manager.
* This patch allows user to select no. of possible CPUs
  that can be allowed to go online when device is suspended.
* If max_online_cpus_susp is set to 1, there is no need to
  keep hotplug function working, so we simply flush
  workqueue and bring down sibling cores when device is
  suspended after suspend_defer_time.
* For other values of max_online_cpus_susp, hotplug will be
  functional with max_online_cpus = max_online_cpus_susp
  when device is suspended after suspend_defer_time.
* We set default value of max_online_cpus_susp to 2 to help
  with issue of audio glitch while using DSP Manager.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
intelli_plug: Add max_cpus_online_susp and remove wakeboost

* max_cpus_online_susp is added for same reason and in same
  way as that in MSM Hotplug.
* wakeboost is removed. It was just placebo, never worked
  actually. Also, if we are gonna implement it, we will
  implement it via MSM Limiter driver since our max_freq
  is controlled by that driver.
* Rewrite bits for resume and suspend to make more sense.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
 intelli_plug: Rewrite suspend architecture

* Add support for multiple suspend architectures.
* Add suspend_defer_time attribute.
* Improve driver initialization.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>

Dorimanx Note:
Cleaned file from 80 chars lines + white space.
msm: limiter: Increase constraints prior changing limits

* In very rare instance, resume function causes wdog to reset
  on MSM board and hence a reboot.
* So let resume function execute and restore limits only if
  required.
* Increase suspend defer time to 10 seconds.
  (which is same as that of MSM Hotplug)

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
MSM HOTPLUG: Cleanups. Thanks NEO :)
rtmutex: Handle deadlock detection smarter

Even in the case when deadlock detection is not requested by the
caller, we can detect deadlocks. Right now the code stops the lock
chain walk and keeps the waiter enqueued, even on itself. Silly not to
yell when such a scenario is detected and to keep the waiter enqueued.

Return -EDEADLK unconditionally and handle it at the call sites.

The futex calls return -EDEADLK. The non futex ones dequeue the
waiter, throw a warning and put the task into a schedule loop.

Tagged for stable as it makes the code more robust.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Brad Mouring <bmouring@ni.com>
Link: http://lkml.kernel.org/r/20140605152801.836501969@linutronix.de
Cc: stable@vger.kernel.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
rtmutex: Detect changes in the pi lock chain

When we walk the lock chain, we drop all locks after each step. So the
lock chain can change under us before we reacquire the locks. That's
harmless in principle as we just follow the wrong lock path. But it
can lead to a false positive in the dead lock detection logic:

T0 holds L0
T0 blocks on L1 held by T1
T1 blocks on L2 held by T2
T2 blocks on L3 held by T3
T4 blocks on L4 held by T4

Now we walk the chain

lock T1 -> lock L2 -> adjust L2 -> unlock T1 ->
     lock T2 ->  adjust T2 ->  drop locks

T2 times out and blocks on L0

Now we continue:

lock T2 -> lock L0 -> deadlock detected, but it's not a deadlock at all.

Brad tried to work around that in the deadlock detection logic itself,
but the more I looked at it the less I liked it, because it's crystal
ball magic after the fact.

We actually can detect a chain change very simple:

lock T1 -> lock L2 -> adjust L2 -> unlock T1 -> lock T2 -> adjust T2 ->

     next_lock = T2->pi_blocked_on->lock;

drop locks

T2 times out and blocks on L0

Now we continue:

lock T2 ->

     if (next_lock != T2->pi_blocked_on->lock)
     	   return;

So if we detect that T2 is now blocked on a different lock we stop the
chain walk. That's also correct in the following scenario:

lock T1 -> lock L2 -> adjust L2 -> unlock T1 -> lock T2 -> adjust T2 ->

     next_lock = T2->pi_blocked_on->lock;

drop locks

T3 times out and drops L3
T2 acquires L3 and blocks on L4 now

Now we continue:

lock T2 ->

     if (next_lock != T2->pi_blocked_on->lock)
     	   return;

We don't have to follow up the chain at that point, because T2
propagated our priority up to T4 already.

[ Folded a cleanup patch from peterz ]

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reported-by: Brad Mouring <bmouring@ni.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20140605152801.930031935@linutronix.de
Cc: stable@vger.kernel.org
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>