Commit 6b108049 authored by Mike Frysinger's avatar Mike Frysinger

Blackfin: ints-priority: unify duplicate vec to irq lookup logic

Seems the ipipe code just copied & pasted the existing irq lookup logic,
so pull the logic out of do_irq() and into a local helper, and convert
the two users over to that.
Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
parent e9e334c3
...@@ -1304,50 +1304,54 @@ int __init init_arch_irq(void) ...@@ -1304,50 +1304,54 @@ int __init init_arch_irq(void)
#ifdef CONFIG_DO_IRQ_L1 #ifdef CONFIG_DO_IRQ_L1
__attribute__((l1_text)) __attribute__((l1_text))
#endif #endif
void do_irq(int vec, struct pt_regs *fp) static int vec_to_irq(int vec)
{ {
if (vec == EVT_IVTMR_P) { struct ivgx *ivg = ivg7_13[vec - IVG7].ifirst;
vec = IRQ_CORETMR; struct ivgx *ivg_stop = ivg7_13[vec - IVG7].istop;
} else { unsigned long sic_status[3];
struct ivgx *ivg = ivg7_13[vec - IVG7].ifirst;
struct ivgx *ivg_stop = ivg7_13[vec - IVG7].istop; if (likely(vec == EVT_IVTMR_P))
#if defined(SIC_ISR0) return IRQ_CORETMR;
unsigned long sic_status[3];
if (smp_processor_id()) { #ifdef SIC_ISR
sic_status[0] = bfin_read_SIC_IMASK() & bfin_read_SIC_ISR();
#else
if (smp_processor_id()) {
# ifdef SICB_ISR0 # ifdef SICB_ISR0
/* This will be optimized out in UP mode. */ /* This will be optimized out in UP mode. */
sic_status[0] = bfin_read_SICB_ISR0() & bfin_read_SICB_IMASK0(); sic_status[0] = bfin_read_SICB_ISR0() & bfin_read_SICB_IMASK0();
sic_status[1] = bfin_read_SICB_ISR1() & bfin_read_SICB_IMASK1(); sic_status[1] = bfin_read_SICB_ISR1() & bfin_read_SICB_IMASK1();
# endif # endif
} else { } else {
sic_status[0] = bfin_read_SIC_ISR0() & bfin_read_SIC_IMASK0(); sic_status[0] = bfin_read_SIC_ISR0() & bfin_read_SIC_IMASK0();
sic_status[1] = bfin_read_SIC_ISR1() & bfin_read_SIC_IMASK1(); sic_status[1] = bfin_read_SIC_ISR1() & bfin_read_SIC_IMASK1();
} }
# ifdef SIC_ISR2 #endif
sic_status[2] = bfin_read_SIC_ISR2() & bfin_read_SIC_IMASK2(); #ifdef SIC_ISR2
# endif sic_status[2] = bfin_read_SIC_ISR2() & bfin_read_SIC_IMASK2();
for (;; ivg++) { #endif
if (ivg >= ivg_stop)
return;
if (sic_status[(ivg->irqno - IVG7) / 32] & ivg->isrflag)
break;
}
#else
unsigned long sic_status;
sic_status = bfin_read_SIC_IMASK() & bfin_read_SIC_ISR();
for (;; ivg++) { for (;; ivg++) {
if (ivg >= ivg_stop) if (ivg >= ivg_stop)
return; return -1;
if (sic_status & ivg->isrflag) #ifdef SIC_ISR
break; if (sic_status[0] & ivg->isrflag)
} #else
if (sic_status[(ivg->irqno - IVG7) / 32] & ivg->isrflag)
#endif #endif
vec = ivg->irqno; return ivg->irqno;
} }
asm_do_IRQ(vec, fp); }
#ifdef CONFIG_DO_IRQ_L1
__attribute__((l1_text))
#endif
void do_irq(int vec, struct pt_regs *fp)
{
int irq = vec_to_irq(vec);
if (irq == -1)
return;
asm_do_IRQ(irq, fp);
} }
#ifdef CONFIG_IPIPE #ifdef CONFIG_IPIPE
...@@ -1385,37 +1389,9 @@ asmlinkage int __ipipe_grab_irq(int vec, struct pt_regs *regs) ...@@ -1385,37 +1389,9 @@ asmlinkage int __ipipe_grab_irq(int vec, struct pt_regs *regs)
struct ivgx *ivg = ivg7_13[vec-IVG7].ifirst; struct ivgx *ivg = ivg7_13[vec-IVG7].ifirst;
int irq, s = 0; int irq, s = 0;
if (likely(vec == EVT_IVTMR_P)) irq = vec_to_irq(vec);
irq = IRQ_CORETMR; if (irq == -1)
else { return 0;
#if defined(SIC_ISR0)
unsigned long sic_status[3];
sic_status[0] = bfin_read_SIC_ISR0() & bfin_read_SIC_IMASK0();
sic_status[1] = bfin_read_SIC_ISR1() & bfin_read_SIC_IMASK1();
# ifdef SIC_ISR2
sic_status[2] = bfin_read_SIC_ISR2() & bfin_read_SIC_IMASK2();
# endif
for (;; ivg++) {
if (ivg >= ivg_stop)
return 0;
if (sic_status[(ivg->irqno - IVG7) / 32] & ivg->isrflag)
break;
}
#else
unsigned long sic_status;
sic_status = bfin_read_SIC_IMASK() & bfin_read_SIC_ISR();
for (;; ivg++) {
if (ivg >= ivg_stop)
return 0;
if (sic_status & ivg->isrflag)
break;
}
#endif
irq = ivg->irqno;
}
if (irq == IRQ_SYSTMR) { if (irq == IRQ_SYSTMR) {
#if !defined(CONFIG_GENERIC_CLOCKEVENTS) || defined(CONFIG_TICKSOURCE_GPTMR0) #if !defined(CONFIG_GENERIC_CLOCKEVENTS) || defined(CONFIG_TICKSOURCE_GPTMR0)
......
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