patch-2.3.27 linux/drivers/isdn/avmb1/kcapi.c

Next file: linux/drivers/isdn/avmb1/t1isa.c
Previous file: linux/drivers/isdn/avmb1/capiutil.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.26/linux/drivers/isdn/avmb1/kcapi.c linux/drivers/isdn/avmb1/kcapi.c
@@ -1,11 +1,25 @@
 /*
- * $Id: kcapi.c,v 1.6 1999/07/20 06:41:49 calle Exp $
+ * $Id: kcapi.c,v 1.10 1999/10/26 15:30:32 calle Exp $
  * 
  * Kernel CAPI 2.0 Module
  * 
  * (c) Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de)
  * 
  * $Log: kcapi.c,v $
+ * Revision 1.10  1999/10/26 15:30:32  calle
+ * Generate error message if user want to add card, but driver module is
+ * not loaded.
+ *
+ * Revision 1.9  1999/10/11 22:04:12  keil
+ * COMPAT_NEED_UACCESS (no include in isdn_compat.h)
+ *
+ * Revision 1.8  1999/09/10 17:24:18  calle
+ * Changes for proposed standard for CAPI2.0:
+ * - AK148 "Linux Exention"
+ *
+ * Revision 1.7  1999/09/04 06:20:05  keil
+ * Changes from kernel set_current_state()
+ *
  * Revision 1.6  1999/07/20 06:41:49  calle
  * Bugfix: After the redesign of the AVM B1 driver, the driver didn't even
  *         compile, if not selected as modules.
@@ -57,7 +71,7 @@
 #include <linux/tqueue.h>
 #include <linux/capi.h>
 #include <linux/kernelcapi.h>
-#include <linux/isdn_compat.h>
+#include <asm/uaccess.h>
 #include "capicmd.h"
 #include "capiutil.h"
 #include "capilli.h"
@@ -65,7 +79,7 @@
 #include <linux/b1lli.h>
 #endif
 
-static char *revision = "$Revision: 1.6 $";
+static char *revision = "$Revision: 1.10 $";
 
 /* ------------------------------------------------------------- */
 
@@ -119,7 +133,7 @@
 /* ------------------------------------------------------------- */
 
 static struct capi_version driver_version = {2, 0, 1, 1<<4};
-static char driver_serial[CAPI_SERIAL_LEN] = "4711";
+static char driver_serial[CAPI_SERIAL_LEN] = "0004711";
 static char capi_manufakturer[64] = "AVM Berlin";
 
 #define APPL(a)		   (&applications[(a)-1])
@@ -719,7 +733,7 @@
 
 /* -------- Notifier ------------------------------------------ */
 
-static void notify_up(__u16 contr)
+static void notify_up(__u32 contr)
 {
 	struct capi_interface_user *p;
 
@@ -730,7 +744,7 @@
 	}
 }
 
-static void notify_down(__u16 contr)
+static void notify_down(__u32 contr)
 {
 	struct capi_interface_user *p;
         printk(KERN_NOTICE "kcapi: notify down contr %d\n", contr);
@@ -742,7 +756,7 @@
 
 static void notify_handler(void *dummy)
 {
-	__u16 contr;
+	__u32 contr;
 
 	for (contr=1; VALID_CARD(contr); contr++)
 		 if (test_and_clear_bit(contr, &notify_up_set))
@@ -984,14 +998,14 @@
 /* -------- CAPI2.0 Interface ---------------------------------- */
 /* ------------------------------------------------------------- */
 
-static int capi_installed(void)
+static __u16 capi_isinstalled(void)
 {
 	int i;
 	for (i = 0; i < CAPI_MAXCONTR; i++) {
 		if (cards[i].cardstate == CARD_RUNNING)
-			return 1;
+			return CAPI_NOERROR;
 	}
-	return 0;
+	return CAPI_REGNOTINSTALLED;
 }
 
 static __u16 capi_register(capi_register_params * rparam, __u16 * applidp)
@@ -1053,7 +1067,7 @@
 static __u16 capi_put_message(__u16 applid, struct sk_buff *skb)
 {
 	struct capi_ncci *np;
-	int contr;
+	__u32 contr;
 	int showctl = 0;
 	__u8 cmd, subcmd;
 
@@ -1131,53 +1145,53 @@
 	return CAPI_NOERROR;
 }
 
-static __u16 capi_get_manufacturer(__u16 contr, __u8 buf[CAPI_MANUFACTURER_LEN])
+static __u16 capi_get_manufacturer(__u32 contr, __u8 buf[CAPI_MANUFACTURER_LEN])
 {
 	if (contr == 0) {
 		strncpy(buf, capi_manufakturer, CAPI_MANUFACTURER_LEN);
 		return CAPI_NOERROR;
 	}
 	if (!VALID_CARD(contr) || CARD(contr)->cardstate != CARD_RUNNING) 
-		return 0x2002;
+		return CAPI_REGNOTINSTALLED;
 
 	strncpy(buf, CARD(contr)->manu, CAPI_MANUFACTURER_LEN);
 	return CAPI_NOERROR;
 }
 
-static __u16 capi_get_version(__u16 contr, struct capi_version *verp)
+static __u16 capi_get_version(__u32 contr, struct capi_version *verp)
 {
 	if (contr == 0) {
 		*verp = driver_version;
 		return CAPI_NOERROR;
 	}
 	if (!VALID_CARD(contr) || CARD(contr)->cardstate != CARD_RUNNING) 
-		return 0x2002;
+		return CAPI_REGNOTINSTALLED;
 
 	memcpy((void *) verp, &CARD(contr)->version, sizeof(capi_version));
 	return CAPI_NOERROR;
 }
 
-static __u16 capi_get_serial(__u16 contr, __u8 serial[CAPI_SERIAL_LEN])
+static __u16 capi_get_serial(__u32 contr, __u8 serial[CAPI_SERIAL_LEN])
 {
 	if (contr == 0) {
 		strncpy(serial, driver_serial, CAPI_SERIAL_LEN);
 		return CAPI_NOERROR;
 	}
 	if (!VALID_CARD(contr) || CARD(contr)->cardstate != CARD_RUNNING) 
-		return 0x2002;
+		return CAPI_REGNOTINSTALLED;
 
 	strncpy((void *) serial, CARD(contr)->serial, CAPI_SERIAL_LEN);
 	return CAPI_NOERROR;
 }
 
-static __u16 capi_get_profile(__u16 contr, struct capi_profile *profp)
+static __u16 capi_get_profile(__u32 contr, struct capi_profile *profp)
 {
 	if (contr == 0) {
 		profp->ncontroller = ncards;
 		return CAPI_NOERROR;
 	}
 	if (!VALID_CARD(contr) || CARD(contr)->cardstate != CARD_RUNNING) 
-		return 0x2002;
+		return CAPI_REGNOTINSTALLED;
 
 	memcpy((void *) profp, &CARD(contr)->profile,
 			sizeof(struct capi_profile));
@@ -1219,7 +1233,12 @@
 			case AVM_CARDTYPE_T1: driver = t1isa_driver; break;
 			default: driver = 0;
 		}
-		if (!driver || !driver->add_card) {
+		if (!driver) {
+			printk(KERN_ERR "kcapi: driver not loaded.\n");
+			return -EIO;
+		}
+		if (!driver->add_card) {
+			printk(KERN_ERR "kcapi: driver has no add card function.\n");
 			return -EIO;
 		}
 
@@ -1277,7 +1296,7 @@
 
 		while (card->cardstate != CARD_RUNNING) {
 
-			current->state = TASK_INTERRUPTIBLE;
+			set_current_state(TASK_INTERRUPTIBLE);
 			schedule_timeout(HZ/10);	/* 0.1 sec */
 
 			if (signal_pending(current))
@@ -1302,7 +1321,7 @@
 
 		while (card->cardstate > CARD_DETECTED) {
 
-			current->state = TASK_INTERRUPTIBLE;
+			set_current_state(TASK_INTERRUPTIBLE);
 			schedule_timeout(HZ/10);	/* 0.1 sec */
 
 			if (signal_pending(current))
@@ -1355,7 +1374,7 @@
 
 		while (card->cardstate != CARD_FREE) {
 
-			current->state = TASK_INTERRUPTIBLE;
+			set_current_state(TASK_INTERRUPTIBLE);
 			schedule_timeout(HZ/10);	/* 0.1 sec */
 
 			if (signal_pending(current))
@@ -1404,7 +1423,7 @@
 
 struct capi_interface avmb1_interface =
 {
-	capi_installed,
+	capi_isinstalled,
 	capi_register,
 	capi_release,
 	capi_put_message,
@@ -1479,6 +1498,12 @@
 #ifdef CONFIG_ISDN_DRV_AVMB1_B1PCMCIA
 extern int b1pcmcia_init(void);
 #endif
+#ifdef CONFIG_ISDN_DRV_AVMB1_T1PCI
+extern int t1pci_init(void);
+#endif
+#ifdef CONFIG_ISDN_DRV_AVMB1_C4
+extern int c4_init(void);
+#endif
 #endif
 
 /*
@@ -1527,6 +1552,12 @@
 #endif
 #ifdef CONFIG_ISDN_DRV_AVMB1_B1PCMCIA
 	(void)b1pcmcia_init();
+#endif
+#ifdef CONFIG_ISDN_DRV_AVMB1_T1PCI
+	(void)t1pci_init();
+#endif
+#ifdef CONFIG_ISDN_DRV_AVMB1_C4
+	(void)c4_init();
 #endif
 #endif
 	return 0;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)