X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=drivers%2Fisdn%2Fcapi%2Fcapidrv.c;h=d10c8b82e6aaeac3587361efb531cb92de5ef150;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=150e31d32b2c18ec7d8ea442d4ae7eaf44091947;hpb=9bf4aaab3e101692164d49b7ca357651eb691cb6;p=linux-2.6.git diff --git a/drivers/isdn/capi/capidrv.c b/drivers/isdn/capi/capidrv.c index 150e31d32..d10c8b82e 100644 --- a/drivers/isdn/capi/capidrv.c +++ b/drivers/isdn/capi/capidrv.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -40,7 +41,7 @@ static int debugmode = 0; MODULE_DESCRIPTION("CAPI4Linux: Interface to ISDN4Linux"); MODULE_AUTHOR("Carsten Paeth"); MODULE_LICENSE("GPL"); -MODULE_PARM(debugmode, "i"); +module_param(debugmode, uint, 0); /* -------- type definitions ----------------------------------------- */ @@ -139,7 +140,7 @@ typedef struct capidrv_bchan capidrv_bchan; /* -------- data definitions ----------------------------------------- */ static capidrv_data global; -static spinlock_t global_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(global_lock); static void handle_dtrace_data(capidrv_contr *card, int send, int level2, u8 *data, u16 len); @@ -512,7 +513,8 @@ static void send_message(capidrv_contr * card, _cmsg * cmsg) len = CAPIMSG_LEN(cmsg->buf); skb = alloc_skb(len, GFP_ATOMIC); memcpy(skb_put(skb, len), cmsg->buf, len); - capi20_put_message(&global.ap, skb); + if (capi20_put_message(&global.ap, skb) != CAPI_NOERROR) + kfree_skb(skb); } /* -------- state machine -------------------------------------------- */ @@ -2056,6 +2058,10 @@ static int capidrv_addcontr(u16 contr, struct capi_profile *profp) return -1; } card->myid = card->interface.channels; + memset(card->bchans, 0, sizeof(capidrv_bchan) * card->nbchan); + for (i = 0; i < card->nbchan; i++) { + card->bchans[i].contr = card; + } spin_lock_irqsave(&global_lock, flags); card->next = global.contr_list; @@ -2063,11 +2069,6 @@ static int capidrv_addcontr(u16 contr, struct capi_profile *profp) global.ncontr++; spin_unlock_irqrestore(&global_lock, flags); - memset(card->bchans, 0, sizeof(capidrv_bchan) * card->nbchan); - for (i = 0; i < card->nbchan; i++) { - card->bchans[i].contr = card; - } - cmd.command = ISDN_STAT_RUN; cmd.driver = card->myid; card->interface.statcallb(&cmd); @@ -2075,10 +2076,9 @@ static int capidrv_addcontr(u16 contr, struct capi_profile *profp) card->cipmask = 0x1FFF03FF; /* any */ card->cipmask2 = 0; - send_listen(card); - card->listentimer.data = (unsigned long)card; card->listentimer.function = listentimerfunc; + send_listen(card); mod_timer(&card->listentimer, jiffies + 60*HZ); printk(KERN_INFO "%s: now up (%d B channels)\n",