isdn/sc: irq handler clean

* pass card number to irq handler

* use card number in irq handler to avoid looping through each adapter

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
This commit is contained in:
Jeff Garzik 2007-10-19 19:31:27 -04:00
parent 246f93f5cc
commit 080eb42f31
2 changed files with 4 additions and 16 deletions

View File

@ -334,7 +334,8 @@ static int __init sc_init(void)
*/ */
sc_adapter[cinst]->interrupt = irq[b]; sc_adapter[cinst]->interrupt = irq[b];
if (request_irq(sc_adapter[cinst]->interrupt, interrupt_handler, if (request_irq(sc_adapter[cinst]->interrupt, interrupt_handler,
IRQF_DISABLED, interface->id, NULL)) IRQF_DISABLED, interface->id,
(void *)(unsigned long) cinst))
{ {
kfree(sc_adapter[cinst]->channel); kfree(sc_adapter[cinst]->channel);
indicate_status(cinst, ISDN_STAT_UNLOAD, 0, NULL); /* Fix me */ indicate_status(cinst, ISDN_STAT_UNLOAD, 0, NULL); /* Fix me */

View File

@ -21,28 +21,15 @@
#include "card.h" #include "card.h"
#include <linux/interrupt.h> #include <linux/interrupt.h>
static int get_card_from_irq(int irq)
{
int i;
for(i = 0 ; i < cinst ; i++) {
if(sc_adapter[i]->interrupt == irq)
return i;
}
return -1;
}
/* /*
* *
*/ */
irqreturn_t interrupt_handler(int interrupt, void *cardptr) irqreturn_t interrupt_handler(int dummy, void *card_inst)
{ {
RspMessage rcvmsg; RspMessage rcvmsg;
int channel; int channel;
int card; int card = (int)(unsigned long) card_inst;
card = get_card_from_irq(interrupt);
if(!IS_VALID_CARD(card)) { if(!IS_VALID_CARD(card)) {
pr_debug("Invalid param: %d is not a valid card id\n", card); pr_debug("Invalid param: %d is not a valid card id\n", card);