aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/common/gic.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/common/gic.c')
-rw-r--r--arch/arm/common/gic.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
index 4ddd0a6ac7ff..7bdd91766d65 100644
--- a/arch/arm/common/gic.c
+++ b/arch/arm/common/gic.c
@@ -179,22 +179,21 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
179{ 179{
180 void __iomem *reg = gic_dist_base(d) + GIC_DIST_TARGET + (gic_irq(d) & ~3); 180 void __iomem *reg = gic_dist_base(d) + GIC_DIST_TARGET + (gic_irq(d) & ~3);
181 unsigned int shift = (d->irq % 4) * 8; 181 unsigned int shift = (d->irq % 4) * 8;
182 unsigned int cpu = cpumask_first(mask_val); 182 unsigned int cpu = cpumask_any_and(mask_val, cpu_online_mask);
183 u32 val, mask, bit; 183 u32 val, mask, bit;
184 184
185 if (cpu >= 8) 185 if (cpu >= 8 || cpu >= nr_cpu_ids)
186 return -EINVAL; 186 return -EINVAL;
187 187
188 mask = 0xff << shift; 188 mask = 0xff << shift;
189 bit = 1 << (cpu + shift); 189 bit = 1 << (cpu + shift);
190 190
191 spin_lock(&irq_controller_lock); 191 spin_lock(&irq_controller_lock);
192 d->node = cpu;
193 val = readl_relaxed(reg) & ~mask; 192 val = readl_relaxed(reg) & ~mask;
194 writel_relaxed(val | bit, reg); 193 writel_relaxed(val | bit, reg);
195 spin_unlock(&irq_controller_lock); 194 spin_unlock(&irq_controller_lock);
196 195
197 return 0; 196 return IRQ_SET_MASK_OK;
198} 197}
199#endif 198#endif
200 199