Skip to content

Commit 50c4344

Browse files
elkabloKAGA-KOKO
authored andcommitted
irqchip/armada-370-xp: Use atomic_io_modify() instead of another spinlock
Use the dedicated atomic_io_modify() instead of a open coded spin_lock() + readl() + writel() + spin_unlock() sequence. This allows to drop the irq_controller_lock spinlock from the driver. Signed-off-by: Marek Behún <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Andrew Lunn <[email protected]>
1 parent b1c3875 commit 50c4344

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

drivers/irqchip/irq-armada-370-xp.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -461,24 +461,18 @@ static __init void armada_xp_ipi_init(struct device_node *node)
461461
set_smp_ipi_range(base_ipi, IPI_DOORBELL_END);
462462
}
463463

464-
static DEFINE_RAW_SPINLOCK(irq_controller_lock);
465-
466464
static int armada_xp_set_affinity(struct irq_data *d,
467465
const struct cpumask *mask_val, bool force)
468466
{
469467
irq_hw_number_t hwirq = irqd_to_hwirq(d);
470-
unsigned long reg, mask;
471468
int cpu;
472469

473470
/* Select a single core from the affinity mask which is online */
474471
cpu = cpumask_any_and(mask_val, cpu_online_mask);
475-
mask = 1UL << cpu_logical_map(cpu);
476472

477-
raw_spin_lock(&irq_controller_lock);
478-
reg = readl(main_int_base + ARMADA_370_XP_INT_SOURCE_CTL(hwirq));
479-
reg = (reg & (~ARMADA_370_XP_INT_SOURCE_CPU_MASK)) | mask;
480-
writel(reg, main_int_base + ARMADA_370_XP_INT_SOURCE_CTL(hwirq));
481-
raw_spin_unlock(&irq_controller_lock);
473+
atomic_io_modify(main_int_base + ARMADA_370_XP_INT_SOURCE_CTL(hwirq),
474+
ARMADA_370_XP_INT_SOURCE_CPU_MASK,
475+
BIT(cpu_logical_map(cpu)));
482476

483477
irq_data_update_effective_affinity(d, cpumask_of(cpu));
484478

0 commit comments

Comments
 (0)