vserver 1.9.5.x5
[linux-2.6.git] / drivers / isdn / capi / capidrv.c
index 44efe19..d10c8b8 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/kernelcapi.h>
 #include <linux/ctype.h>
 #include <linux/init.h>
+#include <linux/moduleparam.h>
 
 #include <linux/isdn/capiutil.h>
 #include <linux/isdn/capicmd.h>
@@ -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);
@@ -2057,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;
@@ -2064,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);
@@ -2076,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",