fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / isdn / hisax / config.c
index df9d652..17ec0b7 100644 (file)
@@ -17,7 +17,6 @@
 #include <linux/types.h>
 #include <linux/stddef.h>
 #include <linux/timer.h>
-#include <linux/config.h>
 #include <linux/init.h>
 #include "hisax.h"
 #include <linux/module.h>
@@ -25,7 +24,6 @@
 #include <linux/workqueue.h>
 #include <linux/interrupt.h>
 #define HISAX_STATUS_BUFSIZE 4096
-#define INCLUDE_INLINE_FUNCS
 
 /*
  * This structure array contains one entry per card. An entry looks
@@ -229,14 +227,6 @@ const char *CardType[] = {
 #define DEFAULT_CFG {5,0x2E0,0,0}
 #endif
 
-
-#ifdef CONFIG_HISAX_AMD7930
-#undef DEFAULT_CARD
-#undef DEFAULT_CFG
-#define DEFAULT_CARD ISDN_CTYPE_AMD7930
-#define DEFAULT_CFG {12,0x3e0,0,0}
-#endif
-
 #ifdef CONFIG_HISAX_NICCY
 #undef DEFAULT_CARD
 #undef DEFAULT_CFG
@@ -547,10 +537,6 @@ extern int setup_hfcpci(struct IsdnCard *card);
 extern int setup_hfcsx(struct IsdnCard *card);
 #endif
 
-#if CARD_AMD7930
-extern int setup_amd7930(struct IsdnCard *card);
-#endif
-
 #if CARD_NICCY
 extern int setup_niccy(struct IsdnCard *card);
 #endif
@@ -633,7 +619,8 @@ static int HiSax_readstatus(u_char __user *buf, int len, int id, int channel)
                count = cs->status_end - cs->status_read + 1;
                if (count >= len)
                        count = len;
-               copy_to_user(p, cs->status_read, count);
+               if (copy_to_user(p, cs->status_read, count))
+                       return -EFAULT;
                cs->status_read += count;
                if (cs->status_read > cs->status_end)
                        cs->status_read = cs->status_buf;
@@ -644,7 +631,8 @@ static int HiSax_readstatus(u_char __user *buf, int len, int id, int channel)
                                cnt = HISAX_STATUS_BUFSIZE;
                        else
                                cnt = count;
-                       copy_to_user(p, cs->status_read, cnt);
+                       if (copy_to_user(p, cs->status_read, cnt))
+                               return -EFAULT;
                        p += cnt;
                        cs->status_read += cnt % HISAX_STATUS_BUFSIZE;
                        count -= cnt;
@@ -869,14 +857,13 @@ static int checkcard(int cardnr, char *id, int *busy_flag, struct module *lockow
        struct IsdnCard *card = cards + cardnr;
        struct IsdnCardState *cs;
 
-       cs = kmalloc(sizeof(struct IsdnCardState), GFP_ATOMIC);
+       cs = kzalloc(sizeof(struct IsdnCardState), GFP_ATOMIC);
        if (!cs) {
                printk(KERN_WARNING
                       "HiSax: No memory for IsdnCardState(card %d)\n",
                       cardnr + 1);
                goto out;
        }
-       memset(cs, 0, sizeof(struct IsdnCardState));
        card->cs = cs;
        spin_lock_init(&cs->statlock);
        spin_lock_init(&cs->lock);
@@ -1064,11 +1051,6 @@ static int checkcard(int cardnr, char *id, int *busy_flag, struct module *lockow
                ret = setup_niccy(card);
                break;
 #endif
-#if CARD_AMD7930
-       case ISDN_CTYPE_AMD7930:
-               ret = setup_amd7930(card);
-               break;
-#endif
 #if CARD_ISURF
        case ISDN_CTYPE_ISURF:
                ret = setup_isurf(card);
@@ -1137,7 +1119,6 @@ static int checkcard(int cardnr, char *id, int *busy_flag, struct module *lockow
        cs->tx_skb = NULL;
        cs->tx_cnt = 0;
        cs->event = 0;
-       cs->tqueue.data = cs;
 
        skb_queue_head_init(&cs->rq);
        skb_queue_head_init(&cs->sq);
@@ -1438,7 +1419,6 @@ static int __init HiSax_init(void)
                        break;
                case ISDN_CTYPE_ELSA_PCI:
                case ISDN_CTYPE_NETJET_S:
-               case ISDN_CTYPE_AMD7930:
                case ISDN_CTYPE_TELESPCI:
                case ISDN_CTYPE_W6692:
                case ISDN_CTYPE_NETJET_U:
@@ -1554,7 +1534,7 @@ static void hisax_b_l2l1(struct PStack *st, int pr, void *arg);
 static int hisax_cardmsg(struct IsdnCardState *cs, int mt, void *arg);
 static int hisax_bc_setstack(struct PStack *st, struct BCState *bcs);
 static void hisax_bc_close(struct BCState *bcs);
-static void hisax_bh(struct IsdnCardState *cs);
+static void hisax_bh(struct work_struct *work);
 static void EChannel_proc_rcv(struct hisax_d_if *d_if);
 
 int hisax_register(struct hisax_d_if *hisax_d_if, struct hisax_b_if *b_if[],
@@ -1586,7 +1566,7 @@ int hisax_register(struct hisax_d_if *hisax_d_if, struct hisax_b_if *b_if[],
        hisax_d_if->cs = cs;
        cs->hw.hisax_d_if = hisax_d_if;
        cs->cardmsg = hisax_cardmsg;
-       INIT_WORK(&cs->tqueue, (void *)(void *)hisax_bh, cs);
+       INIT_WORK(&cs->tqueue, hisax_bh);
        cs->channel[0].d_st->l2.l2l1 = hisax_d_l2l1;
        for (i = 0; i < 2; i++) {
                cs->bcs[i].BC_SetStack = hisax_bc_setstack;
@@ -1618,8 +1598,10 @@ static void hisax_sched_event(struct IsdnCardState *cs, int event)
        schedule_work(&cs->tqueue);
 }
 
-static void hisax_bh(struct IsdnCardState *cs)
+static void hisax_bh(struct work_struct *work)
 {
+       struct IsdnCardState *cs =
+               container_of(work, struct IsdnCardState, tqueue);
        struct PStack *st;
        int pr;
 
@@ -1723,11 +1705,11 @@ static void hisax_b_l1l2(struct hisax_if *ifc, int pr, void *arg)
                hisax_b_sched_event(bcs, B_RCVBUFREADY);
                break;
        case PH_DATA | CONFIRM:
-               bcs->tx_cnt -= (int) arg;
+               bcs->tx_cnt -= (long)arg;
                if (test_bit(FLG_LLI_L1WAKEUP,&bcs->st->lli.flag)) {
                        u_long  flags;
                        spin_lock_irqsave(&bcs->aclock, flags);
-                       bcs->ackcnt += (int) arg;
+                       bcs->ackcnt += (long)arg;
                        spin_unlock_irqrestore(&bcs->aclock, flags);
                        schedule_event(bcs, B_ACKPENDING);
                }
@@ -1791,7 +1773,7 @@ static void hisax_b_l2l1(struct PStack *st, int pr, void *arg)
 
        switch (pr) {
        case PH_ACTIVATE | REQUEST:
-               B_L2L1(b_if, pr, (void *) st->l1.mode);
+               B_L2L1(b_if, pr, (void *)(unsigned long)st->l1.mode);
                break;
        case PH_DATA | REQUEST:
        case PH_PULL | INDICATION:
@@ -1877,7 +1859,7 @@ static void EChannel_proc_rcv(struct hisax_d_if *d_if)
 #ifdef CONFIG_PCI
 #include <linux/pci.h>
 
-static struct pci_device_id hisax_pci_tbl[] __initdata = {
+static struct pci_device_id hisax_pci_tbl[] __devinitdata = {
 #ifdef CONFIG_HISAX_FRITZPCI
        {PCI_VENDOR_ID_AVM,      PCI_DEVICE_ID_AVM_A1,           PCI_ANY_ID, PCI_ANY_ID},
 #endif