generic: add irq_desc in function in parameter
So we could remove some duplicated calling to irq_desc v2: make sure irq_desc in init/main.c is not used without generic_hardirqs Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
@@ -189,6 +189,7 @@ u64 arch_irq_stat(void)
|
|||||||
asmlinkage unsigned int do_IRQ(struct pt_regs *regs)
|
asmlinkage unsigned int do_IRQ(struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
struct pt_regs *old_regs = set_irq_regs(regs);
|
struct pt_regs *old_regs = set_irq_regs(regs);
|
||||||
|
struct irq_desc *desc;
|
||||||
|
|
||||||
/* high bit used in ret_from_ code */
|
/* high bit used in ret_from_ code */
|
||||||
unsigned vector = ~regs->orig_ax;
|
unsigned vector = ~regs->orig_ax;
|
||||||
@@ -202,8 +203,9 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs)
|
|||||||
stack_overflow_check(regs);
|
stack_overflow_check(regs);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (likely(__irq_to_desc(irq)))
|
desc = __irq_to_desc(irq);
|
||||||
generic_handle_irq(irq);
|
if (likely(desc))
|
||||||
|
generic_handle_irq_desc(irq, desc);
|
||||||
else {
|
else {
|
||||||
if (!disable_apic)
|
if (!disable_apic)
|
||||||
ack_APIC_irq();
|
ack_APIC_irq();
|
||||||
|
@@ -315,10 +315,8 @@ extern unsigned int __do_IRQ(unsigned int irq);
|
|||||||
* irqchip-style controller then we call the ->handle_irq() handler,
|
* irqchip-style controller then we call the ->handle_irq() handler,
|
||||||
* and it calls __do_IRQ() if it's attached to an irqtype-style controller.
|
* and it calls __do_IRQ() if it's attached to an irqtype-style controller.
|
||||||
*/
|
*/
|
||||||
static inline void generic_handle_irq(unsigned int irq)
|
static inline void generic_handle_irq_desc(unsigned int irq, struct irq_desc *desc)
|
||||||
{
|
{
|
||||||
struct irq_desc *desc = irq_to_desc(irq);
|
|
||||||
|
|
||||||
#ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
|
#ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
|
||||||
desc->handle_irq(irq, desc);
|
desc->handle_irq(irq, desc);
|
||||||
#else
|
#else
|
||||||
@@ -329,6 +327,11 @@ static inline void generic_handle_irq(unsigned int irq)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void generic_handle_irq(unsigned int irq)
|
||||||
|
{
|
||||||
|
generic_handle_irq_desc(irq, irq_to_desc(irq));
|
||||||
|
}
|
||||||
|
|
||||||
/* Handling of unhandled and spurious interrupts: */
|
/* Handling of unhandled and spurious interrupts: */
|
||||||
extern void note_interrupt(unsigned int irq, struct irq_desc *desc,
|
extern void note_interrupt(unsigned int irq, struct irq_desc *desc,
|
||||||
int action_ret);
|
int action_ret);
|
||||||
|
@@ -590,6 +590,13 @@ void pre_alloc_dyn_array(void)
|
|||||||
if (da->init_work)
|
if (da->init_work)
|
||||||
da->init_work(da);
|
da->init_work(da);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
#ifdef CONFIF_GENERIC_HARDIRQS
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; i < NR_IRQS; i++)
|
||||||
|
irq_desc[i].irq = i;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -197,6 +197,21 @@ struct irq_desc *irq_to_desc(unsigned int irq)
|
|||||||
* we run out of pre-allocate ones, allocate more
|
* we run out of pre-allocate ones, allocate more
|
||||||
*/
|
*/
|
||||||
printk(KERN_DEBUG "try to get more irq_desc %d\n", nr_irq_desc);
|
printk(KERN_DEBUG "try to get more irq_desc %d\n", nr_irq_desc);
|
||||||
|
{
|
||||||
|
/* double check if some one mess up the list */
|
||||||
|
struct irq_desc *desc;
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
desc = &sparse_irqs[0];
|
||||||
|
while (desc) {
|
||||||
|
printk(KERN_DEBUG "found irq_desc for irq %d\n", desc->irq);
|
||||||
|
if (desc->next)
|
||||||
|
printk(KERN_DEBUG "found irq_desc for irq %d and next will be irq %d\n", desc->irq, desc->next->irq);
|
||||||
|
desc = desc->next;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
printk(KERN_DEBUG "all preallocted %d\n", count);
|
||||||
|
}
|
||||||
|
|
||||||
total_bytes = sizeof(struct irq_desc) * nr_irq_desc;
|
total_bytes = sizeof(struct irq_desc) * nr_irq_desc;
|
||||||
if (after_bootmem)
|
if (after_bootmem)
|
||||||
@@ -221,6 +236,21 @@ struct irq_desc *irq_to_desc(unsigned int irq)
|
|||||||
|
|
||||||
desc->irq = irq;
|
desc->irq = irq;
|
||||||
desc_pri->next = desc;
|
desc_pri->next = desc;
|
||||||
|
{
|
||||||
|
/* double check if some one mess up the list */
|
||||||
|
struct irq_desc *desc;
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
desc = &sparse_irqs[0];
|
||||||
|
while (desc) {
|
||||||
|
printk(KERN_DEBUG "1 found irq_desc for irq %d\n", desc->irq);
|
||||||
|
if (desc->next)
|
||||||
|
printk(KERN_DEBUG "1 found irq_desc for irq %d and next will be irq %d\n", desc->irq, desc->next->irq);
|
||||||
|
desc = desc->next;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
printk(KERN_DEBUG "1 all preallocted %d\n", count);
|
||||||
|
}
|
||||||
|
|
||||||
return desc;
|
return desc;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user