--- /dev/null
+From e69b742a6793dc5bf16f6eedca534d4bc10d68b2 Mon Sep 17 00:00:00 2001
+From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Date: Mon, 26 Sep 2011 19:37:57 +0000
+Subject: powerpc/ptrace: Fix build with gcc 4.6
+
+From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+
+commit e69b742a6793dc5bf16f6eedca534d4bc10d68b2 upstream.
+
+gcc (rightfully) complains that we are accessing beyond the
+end of the fpr array (we do, to access the fpscr).
+
+The only sane thing to do (whether anything in that code can be
+called remotely sane is debatable) is to special case fpscr and
+handle it as a separate statement.
+
+I initially tried to do it it by making the array access conditional
+to index < PT_FPSCR and using a 3rd else leg but for some reason gcc
+was unable to understand it and still spewed the warning.
+
+So I ended up with something a tad more intricated but it seems to
+build on 32-bit and on 64-bit with and without VSX.
+
+Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Signed-off-by: Michael Neuling <mikey@neuling.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/powerpc/kernel/ptrace.c | 18 ++++++++++++++----
+ 1 file changed, 14 insertions(+), 4 deletions(-)
+
+--- a/arch/powerpc/kernel/ptrace.c
++++ b/arch/powerpc/kernel/ptrace.c
+@@ -1497,9 +1497,14 @@ long arch_ptrace(struct task_struct *chi
+ if (index < PT_FPR0) {
+ tmp = ptrace_get_reg(child, (int) index);
+ } else {
++ unsigned int fpidx = index - PT_FPR0;
++
+ flush_fp_to_thread(child);
+- tmp = ((unsigned long *)child->thread.fpr)
+- [TS_FPRWIDTH * (index - PT_FPR0)];
++ if (fpidx < (PT_FPSCR - PT_FPR0))
++ tmp = ((unsigned long *)child->thread.fpr)
++ [fpidx * TS_FPRWIDTH];
++ else
++ tmp = child->thread.fpscr.val;
+ }
+ ret = put_user(tmp, datalp);
+ break;
+@@ -1525,9 +1530,14 @@ long arch_ptrace(struct task_struct *chi
+ if (index < PT_FPR0) {
+ ret = ptrace_put_reg(child, index, data);
+ } else {
++ unsigned int fpidx = index - PT_FPR0;
++
+ flush_fp_to_thread(child);
+- ((unsigned long *)child->thread.fpr)
+- [TS_FPRWIDTH * (index - PT_FPR0)] = data;
++ if (fpidx < (PT_FPSCR - PT_FPR0))
++ ((unsigned long *)child->thread.fpr)
++ [fpidx * TS_FPRWIDTH] = data;
++ else
++ child->thread.fpscr.val = data;
+ ret = 0;
+ }
+ break;
--- /dev/null
+From fc4b514f2727f74a4587c31db87e0e93465518c3 Mon Sep 17 00:00:00 2001
+From: Tejun Heo <tj@kernel.org>
+Date: Tue, 4 Dec 2012 07:40:39 -0800
+Subject: workqueue: convert BUG_ON()s in __queue_delayed_work() to WARN_ON_ONCE()s
+
+From: Tejun Heo <tj@kernel.org>
+
+commit fc4b514f2727f74a4587c31db87e0e93465518c3 upstream.
+
+8852aac25e ("workqueue: mod_delayed_work_on() shouldn't queue timer on
+0 delay") unexpectedly uncovered a very nasty abuse of delayed_work in
+megaraid - it allocated work_struct, casted it to delayed_work and
+then pass that into queue_delayed_work().
+
+Previously, this was okay because 0 @delay short-circuited to
+queue_work() before doing anything with delayed_work. 8852aac25e
+moved 0 @delay test into __queue_delayed_work() after sanity check on
+delayed_work making megaraid trigger BUG_ON().
+
+Although megaraid is already fixed by c1d390d8e6 ("megaraid: fix
+BUG_ON() from incorrect use of delayed work"), this patch converts
+BUG_ON()s in __queue_delayed_work() to WARN_ON_ONCE()s so that such
+abusers, if there are more, trigger warning but don't crash the
+machine.
+
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Cc: Xiaotian Feng <xtfeng@gmail.com>
+Signed-off-by: Shuah Khan <shuah.khan@hp.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ kernel/workqueue.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/kernel/workqueue.c
++++ b/kernel/workqueue.c
+@@ -1145,8 +1145,8 @@ int queue_delayed_work_on(int cpu, struc
+ if (!test_and_set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))) {
+ unsigned int lcpu;
+
+- BUG_ON(timer_pending(timer));
+- BUG_ON(!list_empty(&work->entry));
++ WARN_ON_ONCE(timer_pending(timer));
++ WARN_ON_ONCE(!list_empty(&work->entry));
+
+ timer_stats_timer_set_start_info(&dwork->timer);
+