]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/isdn/hardware/avm/c4.c
pcmcia: use pcmcia_loop_config in ISDN pcmcia drivers
[linux-2.6-omap-h63xx.git] / drivers / isdn / hardware / avm / c4.c
index d58f927e766a4a95f9c942be039e6ae3071be210..9df1d3f66c879e750201e9e16f8d8cbf4d14ccbb 100644 (file)
@@ -678,7 +678,9 @@ static irqreturn_t c4_handle_interrupt(avmcard *card)
                 for (i=0; i < card->nr_controllers; i++) {
                        avmctrl_info *cinfo = &card->ctrlinfo[i];
                        memset(cinfo->version, 0, sizeof(cinfo->version));
+                       spin_lock_irqsave(&card->lock, flags);
                        capilib_release(&cinfo->ncci_head);
+                       spin_unlock_irqrestore(&card->lock, flags);
                        capi_ctr_reseted(&cinfo->capi_ctrl);
                }
                card->nlogcontr = 0;
@@ -727,6 +729,7 @@ static void c4_send_init(avmcard *card)
 {
        struct sk_buff *skb;
        void *p;
+       unsigned long flags;
 
        skb = alloc_skb(15, GFP_ATOMIC);
        if (!skb) {
@@ -744,12 +747,15 @@ static void c4_send_init(avmcard *card)
        skb_put(skb, (u8 *)p - (u8 *)skb->data);
 
        skb_queue_tail(&card->dma->send_queue, skb);
+       spin_lock_irqsave(&card->lock, flags);
        c4_dispatch_tx(card);
+       spin_unlock_irqrestore(&card->lock, flags);
 }
 
 static int queue_sendconfigword(avmcard *card, u32 val)
 {
        struct sk_buff *skb;
+       unsigned long flags;
        void *p;
 
        skb = alloc_skb(3+4, GFP_ATOMIC);
@@ -766,7 +772,9 @@ static int queue_sendconfigword(avmcard *card, u32 val)
        skb_put(skb, (u8 *)p - (u8 *)skb->data);
 
        skb_queue_tail(&card->dma->send_queue, skb);
+       spin_lock_irqsave(&card->lock, flags);
        c4_dispatch_tx(card);
+       spin_unlock_irqrestore(&card->lock, flags);
        return 0;
 }
 
@@ -986,7 +994,9 @@ static void c4_release_appl(struct capi_ctr *ctrl, u16 appl)
        struct sk_buff *skb;
        void *p;
 
+       spin_lock_irqsave(&card->lock, flags);
        capilib_release_appl(&cinfo->ncci_head, appl);
+       spin_unlock_irqrestore(&card->lock, flags);
 
        if (ctrl->cnr == card->cardnr) {
                skb = alloc_skb(7, GFP_ATOMIC);
@@ -1019,7 +1029,8 @@ static u16 c4_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
        u16 retval = CAPI_NOERROR;
        unsigned long flags;
 
-       if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) {
+       spin_lock_irqsave(&card->lock, flags);
+       if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) {
                retval = capilib_data_b3_req(&cinfo->ncci_head,
                                             CAPIMSG_APPID(skb->data),
                                             CAPIMSG_NCCI(skb->data),
@@ -1027,10 +1038,9 @@ static u16 c4_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
        }
        if (retval == CAPI_NOERROR) {
                skb_queue_tail(&card->dma->send_queue, skb);
-               spin_lock_irqsave(&card->lock, flags);
                c4_dispatch_tx(card);
-               spin_unlock_irqrestore(&card->lock, flags);
        }
+       spin_unlock_irqrestore(&card->lock, flags);
        return retval;
 }
 
@@ -1078,11 +1088,11 @@ static int c4_read_proc(char *page, char **start, off_t off,
        default: s = "???"; break;
        }
        len += sprintf(page+len, "%-16s %s\n", "type", s);
-       if ((s = cinfo->version[VER_DRIVER]) != 0)
+       if ((s = cinfo->version[VER_DRIVER]) != NULL)
           len += sprintf(page+len, "%-16s %s\n", "ver_driver", s);
-       if ((s = cinfo->version[VER_CARDTYPE]) != 0)
+       if ((s = cinfo->version[VER_CARDTYPE]) != NULL)
           len += sprintf(page+len, "%-16s %s\n", "ver_cardtype", s);
-       if ((s = cinfo->version[VER_SERIAL]) != 0)
+       if ((s = cinfo->version[VER_SERIAL]) != NULL)
           len += sprintf(page+len, "%-16s %s\n", "ver_serial", s);
 
        if (card->cardtype != avm_m1) {
@@ -1157,7 +1167,7 @@ static int c4_add_card(struct capicardparams *p, struct pci_dev *dev,
        }
 
        card->mbase = ioremap(card->membase, 128);
-       if (card->mbase == 0) {
+       if (card->mbase == NULL) {
                printk(KERN_NOTICE "c4: can't remap memory at 0x%lx\n",
                       card->membase);
                retval = -EIO;
@@ -1281,9 +1291,9 @@ static int __init c4_init(void)
        char rev[32];
        int err;
 
-       if ((p = strchr(revision, ':')) != 0 && p[1]) {
+       if ((p = strchr(revision, ':')) != NULL && p[1]) {
                strlcpy(rev, p + 2, 32);
-               if ((p = strchr(rev, '$')) != 0 && p > rev)
+               if ((p = strchr(rev, '$')) != NULL && p > rev)
                   *(p-1) = 0;
        } else
                strcpy(rev, "1.0");