[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.2 / 3.2.15 / 0019-genirq-Adjust-irq-thread-affinity-on-IRQ_SET_MASK_OK.patch
1 From a62ad6cb0e0456a184ba7678d456a14cd33dfeea Mon Sep 17 00:00:00 2001
2 From: Jiang Liu <liuj97@gmail.com>
3 Date: Fri, 30 Mar 2012 23:11:33 +0800
4 Subject: [PATCH 19/60] genirq: Adjust irq thread affinity on
5 IRQ_SET_MASK_OK_NOCOPY return value
7 commit f5cb92ac82d06cb583c1f66666314c5c0a4d7913 upstream.
9 irq_move_masked_irq() checks the return code of
10 chip->irq_set_affinity() only for 0, but IRQ_SET_MASK_OK_NOCOPY is
11 also a valid return code, which is there to avoid a redundant copy of
12 the cpumask. But in case of IRQ_SET_MASK_OK_NOCOPY we not only avoid
13 the redundant copy, we also fail to adjust the thread affinity of an
14 eventually threaded interrupt handler.
16 Handle IRQ_SET_MASK_OK (==0) and IRQ_SET_MASK_OK_NOCOPY(==1) return
17 values correctly by checking the valid return values seperately.
19 Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
20 Cc: Jiang Liu <liuj97@gmail.com>
21 Cc: Keping Chen <chenkeping@huawei.com>
22 Link: http://lkml.kernel.org/r/1333120296-13563-2-git-send-email-jiang.liu@huawei.com
23 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25 ---
26 kernel/irq/migration.c | 10 +++++++---
27 1 file changed, 7 insertions(+), 3 deletions(-)
29 diff --git a/kernel/irq/migration.c b/kernel/irq/migration.c
30 index 4742090..c3c8975 100644
31 --- a/kernel/irq/migration.c
32 +++ b/kernel/irq/migration.c
33 @@ -43,12 +43,16 @@ void irq_move_masked_irq(struct irq_data *idata)
34 * masking the irqs.
35 */
36 if (likely(cpumask_any_and(desc->pending_mask, cpu_online_mask)
37 - < nr_cpu_ids))
38 - if (!chip->irq_set_affinity(&desc->irq_data,
39 - desc->pending_mask, false)) {
40 + < nr_cpu_ids)) {
41 + int ret = chip->irq_set_affinity(&desc->irq_data,
42 + desc->pending_mask, false);
43 + switch (ret) {
44 + case IRQ_SET_MASK_OK:
45 cpumask_copy(desc->irq_data.affinity, desc->pending_mask);
46 + case IRQ_SET_MASK_OK_NOCOPY:
47 irq_set_thread_affinity(desc);
48 }
49 + }
51 cpumask_clear(desc->pending_mask);
52 }
53 --
54 1.7.9.5