Commit 4af83545 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/irq: Refactor irq_soft_mask_{set,or}_return()

This partialy reapply commit ef5b570d ("powerpc/irq: Don't
open code irq_soft_mask helpers") which was reverted by
commit 684c68d9 ("Revert "powerpc/irq: Don't open code
irq_soft_mask helpers"")

irq_soft_mask_set_return() and irq_soft_mask_or_return()
are overset of irq_soft_mask_set().

Have them use irq_soft_mask_set() instead of duplicating it.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: default avatarNicholas Piggin <npiggin@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/18473da42362ee8f07bce36b9caef8ba77d7633f.1663656054.git.christophe.leroy@csgroup.eu
parent 605ba9ee
...@@ -157,36 +157,18 @@ static inline notrace void irq_soft_mask_set(unsigned long mask) ...@@ -157,36 +157,18 @@ static inline notrace void irq_soft_mask_set(unsigned long mask)
static inline notrace unsigned long irq_soft_mask_set_return(unsigned long mask) static inline notrace unsigned long irq_soft_mask_set_return(unsigned long mask)
{ {
unsigned long flags; unsigned long flags = irq_soft_mask_return();
#ifdef CONFIG_PPC_IRQ_SOFT_MASK_DEBUG irq_soft_mask_set(mask);
WARN_ON(mask && !(mask & IRQS_DISABLED));
#endif
asm volatile(
"lbz %0,%1(13); stb %2,%1(13)"
: "=&r" (flags)
: "i" (offsetof(struct paca_struct, irq_soft_mask)),
"r" (mask)
: "memory");
return flags; return flags;
} }
static inline notrace unsigned long irq_soft_mask_or_return(unsigned long mask) static inline notrace unsigned long irq_soft_mask_or_return(unsigned long mask)
{ {
unsigned long flags, tmp; unsigned long flags = irq_soft_mask_return();
asm volatile( irq_soft_mask_set(flags | mask);
"lbz %0,%2(13); or %1,%0,%3; stb %1,%2(13)"
: "=&r" (flags), "=r" (tmp)
: "i" (offsetof(struct paca_struct, irq_soft_mask)),
"r" (mask)
: "memory");
#ifdef CONFIG_PPC_IRQ_SOFT_MASK_DEBUG
WARN_ON((mask | flags) && !((mask | flags) & IRQS_DISABLED));
#endif
return flags; return flags;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment