genirq: fix handle_nested_irq for lazy disable

When lazy disabling is implemented and an interrupt is disabled the
genirq code ends up marking it as IRQ_DISABLED in the descriptor.
The interrupt stays enabled in the controller.  If the interrupt
fires after disabling, the flow handlers namely handle_level_irq and
handle_edge_irq mask the interrupt in the controller.

This is not the case with handle_nested_irq. The interrupt stays enabled in
the controller and if it were a level interrupt it keeps firing only to be
ignored by handle_nested_irq.

Update handle_nested_irq to mask such an interrupt.

CRs-Fixed: 300931
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>

Conflicts:

	kernel/irq/chip.c
genirq: chip: set pending only for edge interrupts

The IRQS_PENDING flag is meant to record an edge interrupt trigger event
when that interrupt is disabled.

When an edge triggered interrupt is enabled, check_irq_resend() retriggers
that irq and resets the flag to zero if set. Note that check_irq_resend()
only does this for edge triggered interrupts.

For level triggered interrupts it is expected that the interrupt remains
active and doesn't need this PENDING flag assistance from software for
re-triggering it.

However, handle_fasteoi_irq flow handler sets the PENDING flag even for
a disabled level interrupt. This causes an adverse effect if that level
interrupt is marked wakeup. The suspend code sees the pending flag on a
wakeup interrupt and aborts suspend whereas check_irq_resend does not reset
it to 0 (as it is a level interrupt). The end result is that the PENDING
flag on this level triggered wakeup interrupt never clears and the system
 keeps aborting suspend.

Fix this by setting IRQS_PENDING flag only for edge interrupts in the
handle_fasteoi_irq.

CRs-Fixed: 314344
Change-Id: I775d40f434f9309fd9672bae372b0f0fb5b91627
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
genirq: implement read_irq_line for interrupt lines

Some drivers need to know what the status of the interrupt line is.
This is especially true for drivers that register a handler with
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING and in the handler they
need to know which edge transition it was invoked for. Provide a way
for these handlers to read the logical status of the line after their
handler was invoked. If the line reads high it was called for a
rising edge and if the line reads low it was called for a falling edge.

The irq_read_line callback in the chip allows the controller to provide
the real time status of this line. Controllers that can read the status
of an interrupt line should implement this by doing necessary
hardware reads and return the logical state of the line.

Interrupt controllers based on the slow bus architecture should conduct
the transaction in this callback. The genirq code will call the chip's
bus lock prior to calling irq_read_line. Obviously since the transaction
would be completed before returning from irq_read_line it need not do
any transactions in the bus unlock call.

Change-Id: I3c8746706530bba14a373c671d22ee963b84dfab
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
(cherry picked from commit ed3e47cb88b61859da3c221f22b509ebe0433218)

Conflicts:

	include/linux/interrupt.h
genirq: explicitly mask a freed irq

When an interrupt is freed, the shutdown or the disable callback
is called for that interrupt. These calls might not be implemented
or even if they were, might not mask the interrupt.

Explicitly mask the interrupt when it is freed. If not masked, the
interrupt could trigger, set the pending bit in the irq controller
and cause unnecessary wakeup or exits from idle power collapse.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>

Conflicts:

	kernel/irq/manage.c
base: sync: signal a sync pt when not adding to the active_list

A sync point that is not added to the active_list will never signal
in sync_timeline_signal thus causing sync_fence_wait to deadlock or
block until the timeout expired.

Change-Id: I75168d0eec874bf70dd8c28db9508dd8fc1077d3
Signed-off-by: Jeff Boody <jboody@codeaurora.org>
cpufreq: fix interactive bug during hotplug

When a new cpu is added and if does not enter idle
for long, the interactive timer is not started and hence
the cpu remains at lowest frequecny, despite the system
load. This impacts mainly benchmarks. Starting a timer
at governor start to handle low frequency.

Change-Id: I8ac9705b9f166a95715c985efacd2ae8ef387cb7
Signed-off-by: Narayanan Gopalakrishnan <nargop@codeaurora.org>
cpufreq: interactive: Fix blocked task warnings

Running a kernel that never enables the interactive cpufreq
will eventually hit the following warning:

INFO: task kinteractiveup:112 blocked for more than 120 seconds.
kinteractiveup  D c07ae3a4  7072   112      2 0x00000000
[<c07ae3a4>] (__schedule+0x4e4/0x5c4) from [<c00a1b8c>] (kthread+0x70/0x94)
[<c00a1b8c>] (kthread+0x70/0x94) from [<c000f368>]
(kernel_thread_exit+0x0/0x8)

due to the fact that the kthread is never woken up after being
forked. Kick the thread to its idle loop so that it can
schedule() and move out of the D state.

Change-Id: Idc490e707d9a14dd143306a8ee1c2241320d29d5
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Revert "ARM: Make low-level printk work"

This reverts commit ffdcd796e23c86d2cfeb25cb2d140f11d5fd6411.
This feature is replaced by passing 'earlyprintk' on the
kernel command line.

Change-Id: I2d4f2812e39b1c7afc061f106863b63710762fa7
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
base: sync: include struct seq_file to fix compile warning

Fixes missing declaration for struct seq_file.

Change-Id: Id77c47fad3bbee56d0dbe4a85f56f6f388e686d6
Signed-off-by: Jeff Boody <jboody@codeaurora.org>
ARM: SMP: send IPI in backtrace only for SMP

Bug in backtrace leads to NULL Pointer dereference with CONFIG_SMP_ON_UP
while sending IPI, fix it.
-----------------------------------------------------------------
[  301.992943] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[  302.023626] pgd = c0004000
[  302.033985] [00000000] *pgd=00000000
[  302.048057] Internal error: Oops: 80000007 [#1] PREEMPT SMP ARM
[  302.070273] Modules linked in:
[  302.082206] CPU: 0    Not tainted  (3.4.0+ #12)
[  302.099386] PC is at 0x0
[  302.109251] LR is at smp_send_all_cpu_backtrace+0x88/0xe4
[  302.129993] pc : [<00000000>]    lr : [<c00144f0>]    psr: 20000193
[  302.130522] sp : c02edd80  ip : 00000000  fp : 7fffffff
[  302.173742] r10: 00000000  r9 : c02ee0c0  r8 : 19484bea
[  302.193789] r7 : 00002710  r6 : 00000000  r5 : 00000000  r4 : c031d034
[  302.218816] r3 : c030ad58  r2 : 00010001  r1 : 00000007  r0 : c031d044
[  302.243885] Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
[  302.272171] Control: 10c5387d  Table: 2f404059  DAC: 00000015
[  302.293986]
[  302.294243] LR: 0xc0014470:
[  302.310233] 4470  e3c20d7f e30d4034 e3c0303f e34c4031 e3a00000 e284101c e5935014 eb05c24f
[  302.341559] 4490  e2503000 18bd80f8 e30567a4 e34c6021 e1a01004 e1a00005 e5962000 e1a06003
[  302.372890] 44b0  e3027710 e592e000 e5a1e010 eb05b841 e1a01005 e30a05bc e34c0027 eb07ed21
[  302.404222] 44d0  eb07ec87 e30a05e0 e34c0027 eb07ed1d e1a00004 e490c010 e3a01007 e12fff3c
[  302.435554] 44f0  ea000008 eb05bcab e594c010 e30605b0 e3400666 e31c000f 0a000009 eb05bca5
[  302.466888] 4510  e1560007 0a000006 e5941010 e2863001 e30605b0 e2836001 e311000f e3400666
[  302.498220] 4530  1affffef e3a00000 e59f1008 eb05b821 f57ff05f e8bd80f8 c031d050 e30537a8
[  302.529555] 4550  e34c3021 e92d4ff0 e5938000 e3067750 e30495c8 e30f6d00 e24dd00c e241b001
[  302.560973]
[  302.561235] SP: 0xc02edd00:
[  302.577222] dd00  392e3130 36353137 00205d36 00000000 c02edd7c c020f974 c02ca964 c02edd2c
[  302.608555] dd20  00000000 00000000 20000193 ffffffff c02edd6c c000eef8 c031d044 00000007
[  302.639897] dd40  00010001 c030ad58 c031d034 00000000 00000000 00002710 19484bea c02ee0c0
[  302.671221] dd60  00000000 7fffffff 00000000 c02edd80 c00144f0 00000000 20000193 ffffffff
[  302.702565] dd80  c030ad58 c05aca98 c0306764 c030dd00 c030dd00 c007c664 295f6000 00001dc6
[  302.733898] dda0  00000017 c0306970 00000000 c0306970 c02e9a98 19484bea 00000046 00000000
[  302.765220] ddc0  7fffffff c007cc58 c02ec000 c0307c80 00000000 00000000 19484bea c0033100
[  302.796555] dde0  c05ac888 c05ac888 c0341c40 c0305f40 19484bea c0060f78 c05ac888 c05ac738
[  302.827969]
[  302.828233] R0: 0xc031cfc4:
[  302.844218] cfc4  006c3776 00000000 c027eb38 00000000 410fc051 00000000 00000000 00000000
[  302.875563] cfe4  00000000 00000000 00000000 00000000 00000000 00000000 00000000 c030cac0
[  302.906895] d004  c0308d90 00000000 003.299225] ad98  00000004 ffffffff 00000000 00000001 00000000 00000000
ffffffff 00000001
[  303.330564] adb8  00000000 00000000 c030adc0 c030adc0 00000000 00000001 c0280068 c028006c
[  303.361958]
[  303.362221] R4: 0xc031cfb4:
[  303.378221] cfb4  00000000 00000000 00000000 c001e658 006c3776 0000ee000)
[  303.936303] dd80: c030ad58 c05aca98 c0306764 c030dd00 c030dd00 c007c664 295f6000 00001dc6
[  303.967588] dda0: 00000017 c0306970 00000000 c0306970 c02e9a98 19484bea 00000046 00000000
[  303.998940] ddc0: 7fffffff c007cc58 c02ec000 c0307c80 00000000 00000000 19484bea c0033100
[  304.030275] 04.500235] dfc0: c02e55ec c02ca964 00000000 00000000 c02ca448 00000000 00000000 c02e55ec
[  304.531597] dfe0: 10c5387d c0305ea0 c02e55bc c0308d04 20204059 20208040 00000000 00000000
[  304.563391] [<c00144f0>] (smp_send_all_cpu_backtrace+0x88/0xe4) from [<c007c664>] (__rcu_pending+0x17c/0x5ac)
[  30406] [<c0010108>] (handle_IRQ+0x5c/0xc0) from [<c0008530>] (gic_handle_irq+0x48/0xe8)
[  305.033405] [<c0008530>] (gic_handle_irq+0x48/0xe8) from [<c000ee00>] (__irq_svc+0x40/0x70)
[  305.064749] Exception stack(0xc02edf48 to 0xc02edf90)
[  305.084483] df40:                   00000000 00000000 a00000c02ee0c0  r8 : 80000007
[  305.544476] r7 : c0307c80  r6 : c02edb7c  r5 : c0305ef8  r4 : 000f4240
[  305.569465] r3 : 00000000  r2 : c031d034  r1 : 00000006  r0 : c02edb7c
[  305.594485] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
[  305.622824] Control: 10c5387d  Table: 2f408 00010000 c02ec000 c02ec2f0 0000000b c027bb60 c02edd38 00000000
[  306.414224] dbdc  00000000 80000007 00000000 00000000 c001addc 80000007 00000000 c02edd38
[  306.445623]
[  306.445886] R2: 0xc031cfb4:
[  306.461894] cfb4  00000000 00000000 00000000 c001e658 006c3776 00000000 c027eb38 00000000
[ bc  c02ec008 00010000 c02ec000 c02ec2f0 0000000b c027bb60 c02edd38 00000000
[  307.215227] dbdc  00000000 80000007 00000000 00000000 c001addc 80000007 00000000 c02edd38
[  307.246620]
[  307.246883] R7: 0xc0307c00:
[  307.262891] 7c00  c01b95ac c0213788 c01b95b8 c0213794 c01b9664 c02137a0 c01b966c b80: c031f380 c02edd38
00000000 c020f7ac c02ee0c0 c02edbbc 7fffffff c02ec2f0
[  308.150942] dba0: c02edd38 00000000 c0307c80 80000007 c031d018 c0013394 c027a19c c02ec008
[  308.182258] dbc0: 00010000 c02ec000 c02ec2f0 0000000b c027bb60 c02edd38 00000000 00000000
[  308.213580] dbe0: 80000007 000000004aa54 00000046 c02eff00
[  308.934261] dec0: c02eff54 cfa00540 00000000 d0804010 410fc051 00000027 00000000 c0074a9c
[  308.965605] dee0: c02eff00 c02eff54 00000027 c0077680 c0306970 c02e9f44 00000027 c00743ec
[  308.996956] df00: 00000178 c0010108 c0305ec8 d080400c c02edf48 c0305ec8 d0804010 c00085364>]
(__rcu_pending+0x17c/0x5ac) from [<c007cc58>] (rcu_check_callbacks+0x1c4/0x1e0)
[  309.664887] [<c007cc58>] (rcu_check_callbacks+0x1c4/0x1e0) from [<c0033100>] (update_process_times+0x38/0x68)
[  309.702911] [<c0033100>] (update_process_times+0x38/0x68) from [<c0060f78>]
(tick_sched_timer+0x9c/0xk(0xc02edf48 to 0xc02edf90)

Change-Id: Icfd3585361c88ada6550f22b316af19e1a2b7721
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
char: dcc_tty: Update for spinlock changes

There is no longer a SPIN_LOCK_UNLOCKED macro; replace it with
__SPIN_LOCK_UNLOCKED so that lockdep can give the lock a name.
Also include spinlock.h so that this compiles.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
ppp: replace PPP_MTU with PPP_MRU

This replaces the uses of PPP_MTU with PPP_MRU
since both are identical.

Change-Id: Id5c1c590f4c04ab5d6b79da520b5c8eae01881e6
Signed-off-by: tirupathireddy <tirupath@codeaurora.org>
Revert "usb: gadget: rndis: Fix re-binding f_rndis"

This reverts commit 7f141c58da4a6c8920fd6d7051b832e3dec6b877.

This patch should not have been applied in the first place. The USB
string id index is limited to 255.  Function drivers are supposed
to allocate string id for the first time their bind is called.  There
is no API to release string id index.  If string id is reset in unbind,
we will run out of string id after multiple bind/unbind.

CRs-Fixed: 425501
Change-Id: Ia82a528f9e0af192063970a9227c9c739ed77f48
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
cpuidle: menu: Remove the unused get_loadavg function

The fuction get_loadavg was unused and this also caused
a warning during build. This change also removes it from
the allowed warnings white-list.

Change-Id: I85b184e1eb0ab8b3cf763cab87a30e140d00332b
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
binder: Quiet binder

The majority of the binder messages are not very informative
and useful to the reader. Make them available via debug
mechanisms.

Change-Id: Ie0d262372d10fd82b0743dfd79ce7d1de14ae143
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
ashmem: Move ashmem.h from staging to include/linux and export it

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
ashmem: Add cache flush routines to ashmem

Flush routines are required by msm architecture to properly
flush the cache based on cache architure.

Change-Id: Ic427a7393eccda794d681401fa7e3eb6807b0f0f
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
ashmem: Add routines to get in kernel reference to ashmem file

Add get_ashmem_file and put_ashmem_file routines in ashmem driver to get
and return file references to ashmem file from within the kernel.

Change-Id: Ifbb54f7c1aab90f6d656a10a3c40ca2b65ceb89a
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
include: Remove executable bit from sdio_func.h

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
gpu: ion: Loop on the handle count when destroying

When destroying a handle, all kernel mappings to that handle
should be destroyed. Other handles may still have references
and valid mappings to the buffer underneath which should not
be destroyed. Loop on the handle reference count, not the buffer
reference count to get rid of all kernel mappings for the handle.

Change-Id: I7dc5d6a86513fc5fa4e21110ceab434714ea2493
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>