genirq: Provide status modifier
Provide a irq_desc.status modifier function to cleanup the direct access to irq_desc in arch and driver code. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
3a3856d00c
commit
442471848f
|
@ -72,6 +72,10 @@ typedef void (*irq_flow_handler_t)(unsigned int irq,
|
||||||
#define IRQ_ONESHOT 0x08000000 /* IRQ is not unmasked after hardirq */
|
#define IRQ_ONESHOT 0x08000000 /* IRQ is not unmasked after hardirq */
|
||||||
#define IRQ_NESTED_THREAD 0x10000000 /* IRQ is nested into another, no own handler thread */
|
#define IRQ_NESTED_THREAD 0x10000000 /* IRQ is nested into another, no own handler thread */
|
||||||
|
|
||||||
|
#define IRQF_MODIFY_MASK \
|
||||||
|
(IRQ_TYPE_SENSE_MASK | IRQ_NOPROBE | IRQ_NOREQUEST | \
|
||||||
|
IRQ_NOAUTOEN | IRQ_MOVE_PCNTXT | IRQ_LEVEL)
|
||||||
|
|
||||||
#ifdef CONFIG_IRQ_PER_CPU
|
#ifdef CONFIG_IRQ_PER_CPU
|
||||||
# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
|
# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
|
||||||
# define IRQ_NO_BALANCING_MASK (IRQ_PER_CPU | IRQ_NO_BALANCING)
|
# define IRQ_NO_BALANCING_MASK (IRQ_PER_CPU | IRQ_NO_BALANCING)
|
||||||
|
@ -289,8 +293,27 @@ set_irq_chained_handler(unsigned int irq,
|
||||||
|
|
||||||
extern void set_irq_nested_thread(unsigned int irq, int nest);
|
extern void set_irq_nested_thread(unsigned int irq, int nest);
|
||||||
|
|
||||||
extern void set_irq_noprobe(unsigned int irq);
|
void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set);
|
||||||
extern void set_irq_probe(unsigned int irq);
|
|
||||||
|
static inline void irq_set_status_flags(unsigned int irq, unsigned long set)
|
||||||
|
{
|
||||||
|
irq_modify_status(irq, 0, set);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void irq_clear_status_flags(unsigned int irq, unsigned long clr)
|
||||||
|
{
|
||||||
|
irq_modify_status(irq, clr, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void set_irq_noprobe(unsigned int irq)
|
||||||
|
{
|
||||||
|
irq_modify_status(irq, 0, IRQ_NOPROBE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void set_irq_probe(unsigned int irq)
|
||||||
|
{
|
||||||
|
irq_modify_status(irq, IRQ_NOPROBE, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/* Handle dynamic irq creation and destruction */
|
/* Handle dynamic irq creation and destruction */
|
||||||
extern unsigned int create_irq_nr(unsigned int irq_want, int node);
|
extern unsigned int create_irq_nr(unsigned int irq_want, int node);
|
||||||
|
|
|
@ -851,32 +851,20 @@ set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip,
|
||||||
__set_irq_handler(irq, handle, 0, name);
|
__set_irq_handler(irq, handle, 0, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_irq_noprobe(unsigned int irq)
|
void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set)
|
||||||
{
|
{
|
||||||
struct irq_desc *desc = irq_to_desc(irq);
|
struct irq_desc *desc = irq_to_desc(irq);
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
if (!desc) {
|
if (!desc)
|
||||||
printk(KERN_ERR "Trying to mark IRQ%d non-probeable\n", irq);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
/* Sanitize flags */
|
||||||
|
set &= IRQF_MODIFY_MASK;
|
||||||
|
clr &= IRQF_MODIFY_MASK;
|
||||||
|
|
||||||
raw_spin_lock_irqsave(&desc->lock, flags);
|
raw_spin_lock_irqsave(&desc->lock, flags);
|
||||||
desc->status |= IRQ_NOPROBE;
|
desc->status &= ~clr;
|
||||||
raw_spin_unlock_irqrestore(&desc->lock, flags);
|
desc->status |= set;
|
||||||
}
|
|
||||||
|
|
||||||
void set_irq_probe(unsigned int irq)
|
|
||||||
{
|
|
||||||
struct irq_desc *desc = irq_to_desc(irq);
|
|
||||||
unsigned long flags;
|
|
||||||
|
|
||||||
if (!desc) {
|
|
||||||
printk(KERN_ERR "Trying to mark IRQ%d probeable\n", irq);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
raw_spin_lock_irqsave(&desc->lock, flags);
|
|
||||||
desc->status &= ~IRQ_NOPROBE;
|
|
||||||
raw_spin_unlock_irqrestore(&desc->lock, flags);
|
raw_spin_unlock_irqrestore(&desc->lock, flags);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue