diff options
Diffstat (limited to 'drivers/isdn/hysdn/boardergo.c')
-rw-r--r-- | drivers/isdn/hysdn/boardergo.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/drivers/isdn/hysdn/boardergo.c b/drivers/isdn/hysdn/boardergo.c index 160f22fa5941..82e42a80dc4b 100644 --- a/drivers/isdn/hysdn/boardergo.c +++ b/drivers/isdn/hysdn/boardergo.c | |||
@@ -45,11 +45,10 @@ ergo_interrupt(int intno, void *dev_id) | |||
45 | if (!card->irq_enabled) | 45 | if (!card->irq_enabled) |
46 | return IRQ_NONE; /* other device interrupting or irq switched off */ | 46 | return IRQ_NONE; /* other device interrupting or irq switched off */ |
47 | 47 | ||
48 | save_flags(flags); | 48 | spin_lock_irqsave(&card->hysdn_lock, flags); /* no further irqs allowed */ |
49 | cli(); /* no further irqs allowed */ | ||
50 | 49 | ||
51 | if (!(bytein(card->iobase + PCI9050_INTR_REG) & PCI9050_INTR_REG_STAT1)) { | 50 | if (!(bytein(card->iobase + PCI9050_INTR_REG) & PCI9050_INTR_REG_STAT1)) { |
52 | restore_flags(flags); /* restore old state */ | 51 | spin_unlock_irqrestore(&card->hysdn_lock, flags); /* restore old state */ |
53 | return IRQ_NONE; /* no interrupt requested by E1 */ | 52 | return IRQ_NONE; /* no interrupt requested by E1 */ |
54 | } | 53 | } |
55 | /* clear any pending ints on the board */ | 54 | /* clear any pending ints on the board */ |
@@ -61,7 +60,7 @@ ergo_interrupt(int intno, void *dev_id) | |||
61 | /* start kernel task immediately after leaving all interrupts */ | 60 | /* start kernel task immediately after leaving all interrupts */ |
62 | if (!card->hw_lock) | 61 | if (!card->hw_lock) |
63 | schedule_work(&card->irq_queue); | 62 | schedule_work(&card->irq_queue); |
64 | restore_flags(flags); | 63 | spin_unlock_irqrestore(&card->hysdn_lock, flags); |
65 | return IRQ_HANDLED; | 64 | return IRQ_HANDLED; |
66 | } /* ergo_interrupt */ | 65 | } /* ergo_interrupt */ |
67 | 66 | ||
@@ -83,10 +82,9 @@ ergo_irq_bh(hysdn_card * card) | |||
83 | 82 | ||
84 | dpr = card->dpram; /* point to DPRAM */ | 83 | dpr = card->dpram; /* point to DPRAM */ |
85 | 84 | ||
86 | save_flags(flags); | 85 | spin_lock_irqsave(&card->hysdn_lock, flags); |
87 | cli(); | ||
88 | if (card->hw_lock) { | 86 | if (card->hw_lock) { |
89 | restore_flags(flags); /* hardware currently unavailable */ | 87 | spin_unlock_irqrestore(&card->hysdn_lock, flags); /* hardware currently unavailable */ |
90 | return; | 88 | return; |
91 | } | 89 | } |
92 | card->hw_lock = 1; /* we now lock the hardware */ | 90 | card->hw_lock = 1; /* we now lock the hardware */ |
@@ -120,7 +118,7 @@ ergo_irq_bh(hysdn_card * card) | |||
120 | card->hw_lock = 0; /* free hardware again */ | 118 | card->hw_lock = 0; /* free hardware again */ |
121 | } while (again); /* until nothing more to do */ | 119 | } while (again); /* until nothing more to do */ |
122 | 120 | ||
123 | restore_flags(flags); | 121 | spin_unlock_irqrestore(&card->hysdn_lock, flags); |
124 | } /* ergo_irq_bh */ | 122 | } /* ergo_irq_bh */ |
125 | 123 | ||
126 | 124 | ||
@@ -137,8 +135,7 @@ ergo_stopcard(hysdn_card * card) | |||
137 | #ifdef CONFIG_HYSDN_CAPI | 135 | #ifdef CONFIG_HYSDN_CAPI |
138 | hycapi_capi_stop(card); | 136 | hycapi_capi_stop(card); |
139 | #endif /* CONFIG_HYSDN_CAPI */ | 137 | #endif /* CONFIG_HYSDN_CAPI */ |
140 | save_flags(flags); | 138 | spin_lock_irqsave(&card->hysdn_lock, flags); |
141 | cli(); | ||
142 | val = bytein(card->iobase + PCI9050_INTR_REG); /* get actual value */ | 139 | val = bytein(card->iobase + PCI9050_INTR_REG); /* get actual value */ |
143 | val &= ~(PCI9050_INTR_REG_ENPCI | PCI9050_INTR_REG_EN1); /* mask irq */ | 140 | val &= ~(PCI9050_INTR_REG_ENPCI | PCI9050_INTR_REG_EN1); /* mask irq */ |
144 | byteout(card->iobase + PCI9050_INTR_REG, val); | 141 | byteout(card->iobase + PCI9050_INTR_REG, val); |
@@ -147,7 +144,7 @@ ergo_stopcard(hysdn_card * card) | |||
147 | card->state = CARD_STATE_UNUSED; | 144 | card->state = CARD_STATE_UNUSED; |
148 | card->err_log_state = ERRLOG_STATE_OFF; /* currently no log active */ | 145 | card->err_log_state = ERRLOG_STATE_OFF; /* currently no log active */ |
149 | 146 | ||
150 | restore_flags(flags); | 147 | spin_unlock_irqrestore(&card->hysdn_lock, flags); |
151 | } /* ergo_stopcard */ | 148 | } /* ergo_stopcard */ |
152 | 149 | ||
153 | /**************************************************************************/ | 150 | /**************************************************************************/ |
@@ -162,12 +159,11 @@ ergo_set_errlog_state(hysdn_card * card, int on) | |||
162 | card->err_log_state = ERRLOG_STATE_OFF; /* must be off */ | 159 | card->err_log_state = ERRLOG_STATE_OFF; /* must be off */ |
163 | return; | 160 | return; |
164 | } | 161 | } |
165 | save_flags(flags); | 162 | spin_lock_irqsave(&card->hysdn_lock, flags); |
166 | cli(); | ||
167 | 163 | ||
168 | if (((card->err_log_state == ERRLOG_STATE_OFF) && !on) || | 164 | if (((card->err_log_state == ERRLOG_STATE_OFF) && !on) || |
169 | ((card->err_log_state == ERRLOG_STATE_ON) && on)) { | 165 | ((card->err_log_state == ERRLOG_STATE_ON) && on)) { |
170 | restore_flags(flags); | 166 | spin_unlock_irqrestore(&card->hysdn_lock, flags); |
171 | return; /* nothing to do */ | 167 | return; /* nothing to do */ |
172 | } | 168 | } |
173 | if (on) | 169 | if (on) |
@@ -175,7 +171,7 @@ ergo_set_errlog_state(hysdn_card * card, int on) | |||
175 | else | 171 | else |
176 | card->err_log_state = ERRLOG_STATE_STOP; /* request stop */ | 172 | card->err_log_state = ERRLOG_STATE_STOP; /* request stop */ |
177 | 173 | ||
178 | restore_flags(flags); | 174 | spin_unlock_irqrestore(&card->hysdn_lock, flags); |
179 | schedule_work(&card->irq_queue); | 175 | schedule_work(&card->irq_queue); |
180 | } /* ergo_set_errlog_state */ | 176 | } /* ergo_set_errlog_state */ |
181 | 177 | ||
@@ -356,8 +352,7 @@ ergo_waitpofready(struct HYSDN_CARD *card) | |||
356 | 352 | ||
357 | if (card->debug_flags & LOG_POF_RECORD) | 353 | if (card->debug_flags & LOG_POF_RECORD) |
358 | hysdn_addlog(card, "ERGO: pof boot success"); | 354 | hysdn_addlog(card, "ERGO: pof boot success"); |
359 | save_flags(flags); | 355 | spin_lock_irqsave(&card->hysdn_lock, flags); |
360 | cli(); | ||
361 | 356 | ||
362 | card->state = CARD_STATE_RUN; /* now card is running */ | 357 | card->state = CARD_STATE_RUN; /* now card is running */ |
363 | /* enable the cards interrupt */ | 358 | /* enable the cards interrupt */ |
@@ -370,7 +365,7 @@ ergo_waitpofready(struct HYSDN_CARD *card) | |||
370 | dpr->ToHyInt = 1; | 365 | dpr->ToHyInt = 1; |
371 | dpr->ToPcInt = 1; /* interrupt to E1 for all cards */ | 366 | dpr->ToPcInt = 1; /* interrupt to E1 for all cards */ |
372 | 367 | ||
373 | restore_flags(flags); | 368 | spin_unlock_irqrestore(&card->hysdn_lock, flags); |
374 | if ((hynet_enable & (1 << card->myid)) | 369 | if ((hynet_enable & (1 << card->myid)) |
375 | && (i = hysdn_net_create(card))) | 370 | && (i = hysdn_net_create(card))) |
376 | { | 371 | { |
@@ -408,7 +403,7 @@ ergo_releasehardware(hysdn_card * card) | |||
408 | free_irq(card->irq, card); /* release interrupt */ | 403 | free_irq(card->irq, card); /* release interrupt */ |
409 | release_region(card->iobase + PCI9050_INTR_REG, 1); /* release all io ports */ | 404 | release_region(card->iobase + PCI9050_INTR_REG, 1); /* release all io ports */ |
410 | release_region(card->iobase + PCI9050_USER_IO, 1); | 405 | release_region(card->iobase + PCI9050_USER_IO, 1); |
411 | vfree(card->dpram); | 406 | iounmap(card->dpram); |
412 | card->dpram = NULL; /* release shared mem */ | 407 | card->dpram = NULL; /* release shared mem */ |
413 | } /* ergo_releasehardware */ | 408 | } /* ergo_releasehardware */ |
414 | 409 | ||
@@ -448,6 +443,7 @@ ergo_inithardware(hysdn_card * card) | |||
448 | card->waitpofready = ergo_waitpofready; | 443 | card->waitpofready = ergo_waitpofready; |
449 | card->set_errlog_state = ergo_set_errlog_state; | 444 | card->set_errlog_state = ergo_set_errlog_state; |
450 | INIT_WORK(&card->irq_queue, (void *) (void *) ergo_irq_bh, card); | 445 | INIT_WORK(&card->irq_queue, (void *) (void *) ergo_irq_bh, card); |
446 | card->hysdn_lock = SPIN_LOCK_UNLOCKED; | ||
451 | 447 | ||
452 | return (0); | 448 | return (0); |
453 | } /* ergo_inithardware */ | 449 | } /* ergo_inithardware */ |