Skip to content

Commit ebf9ff7

Browse files
Boris BrezillonKAGA-KOKO
authored andcommitted
genirq: Provide irq_gc_{lock_irqsave,unlock_irqrestore}() helpers
Some irqchip drivers need to take the generic chip lock outside of the irq context. Provide the irq_gc_{lock_irqsave,unlock_irqrestore}() helpers to allow one to disable irqs while entering a critical section protected by gc->lock. Note that we do not provide optimized version of these helpers for !SMP, because they are not called from the hot-path. [ tglx: Added a comment when these helpers should be [not] used ] Signed-off-by: Boris Brezillon <[email protected]> Cc: Jason Cooper <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Nicolas Ferre <[email protected]> Cc: [email protected] Cc: Alexandre Belloni <[email protected]> Link: http://lkml.kernel.org/r/1473775109-4192-1-git-send-email-boris.brezillon@free-electrons.com Signed-off-by: Thomas Gleixner <[email protected]>
1 parent 9395452 commit ebf9ff7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

include/linux/irq.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,16 @@ static inline void irq_gc_lock(struct irq_chip_generic *gc) { }
945945
static inline void irq_gc_unlock(struct irq_chip_generic *gc) { }
946946
#endif
947947

948+
/*
949+
* The irqsave variants are for usage in non interrupt code. Do not use
950+
* them in irq_chip callbacks. Use irq_gc_lock() instead.
951+
*/
952+
#define irq_gc_lock_irqsave(gc, flags) \
953+
raw_spin_lock_irqsave(&(gc)->lock, flags)
954+
955+
#define irq_gc_unlock_irqrestore(gc, flags) \
956+
raw_spin_unlock_irqrestore(&(gc)->lock, flags)
957+
948958
static inline void irq_reg_writel(struct irq_chip_generic *gc,
949959
u32 val, int reg_offset)
950960
{

0 commit comments

Comments
 (0)