提交 40f08a72 编写于 作者: T Thomas Gleixner

isdn: hisax: Replace the bogus access to irq stats

Abusing irq stats in a driver for counting interrupts is a horrible
idea and not safe with shared interrupts. Replace it by a local
interrupt counter.

Noticed by the attempt to remove the irq stats export.
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
Reviewed-by: NIngo Molnar <mingo@elte.hu>
上级 154cd387
...@@ -801,6 +801,16 @@ static void closecard(int cardnr) ...@@ -801,6 +801,16 @@ static void closecard(int cardnr)
ll_unload(csta); ll_unload(csta);
} }
static irqreturn_t card_irq(int intno, void *dev_id)
{
struct IsdnCardState *cs = dev_id;
irqreturn_t ret = cs->irq_func(intno, cs);
if (ret == IRQ_HANDLED)
cs->irq_cnt++;
return ret;
}
static int init_card(struct IsdnCardState *cs) static int init_card(struct IsdnCardState *cs)
{ {
int irq_cnt, cnt = 3, ret; int irq_cnt, cnt = 3, ret;
...@@ -809,10 +819,10 @@ static int init_card(struct IsdnCardState *cs) ...@@ -809,10 +819,10 @@ static int init_card(struct IsdnCardState *cs)
ret = cs->cardmsg(cs, CARD_INIT, NULL); ret = cs->cardmsg(cs, CARD_INIT, NULL);
return(ret); return(ret);
} }
irq_cnt = kstat_irqs(cs->irq); irq_cnt = cs->irq_cnt = 0;
printk(KERN_INFO "%s: IRQ %d count %d\n", CardType[cs->typ], printk(KERN_INFO "%s: IRQ %d count %d\n", CardType[cs->typ],
cs->irq, irq_cnt); cs->irq, irq_cnt);
if (request_irq(cs->irq, cs->irq_func, cs->irq_flags, "HiSax", cs)) { if (request_irq(cs->irq, card_irq, cs->irq_flags, "HiSax", cs)) {
printk(KERN_WARNING "HiSax: couldn't get interrupt %d\n", printk(KERN_WARNING "HiSax: couldn't get interrupt %d\n",
cs->irq); cs->irq);
return 1; return 1;
...@@ -822,8 +832,8 @@ static int init_card(struct IsdnCardState *cs) ...@@ -822,8 +832,8 @@ static int init_card(struct IsdnCardState *cs)
/* Timeout 10ms */ /* Timeout 10ms */
msleep(10); msleep(10);
printk(KERN_INFO "%s: IRQ %d count %d\n", printk(KERN_INFO "%s: IRQ %d count %d\n",
CardType[cs->typ], cs->irq, kstat_irqs(cs->irq)); CardType[cs->typ], cs->irq, cs->irq_cnt);
if (kstat_irqs(cs->irq) == irq_cnt) { if (cs->irq_cnt == irq_cnt) {
printk(KERN_WARNING printk(KERN_WARNING
"%s: IRQ(%d) getting no interrupts during init %d\n", "%s: IRQ(%d) getting no interrupts during init %d\n",
CardType[cs->typ], cs->irq, 4 - cnt); CardType[cs->typ], cs->irq, 4 - cnt);
......
...@@ -959,6 +959,7 @@ struct IsdnCardState { ...@@ -959,6 +959,7 @@ struct IsdnCardState {
u_long event; u_long event;
struct work_struct tqueue; struct work_struct tqueue;
struct timer_list dbusytimer; struct timer_list dbusytimer;
unsigned int irq_cnt;
#ifdef ERROR_STATISTIC #ifdef ERROR_STATISTIC
int err_crc; int err_crc;
int err_tx; int err_tx;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册