[svn-commits] sruffell: linux/trunk r10243 - /linux/trunk/drivers/dahdi/wcte12xp/base.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Oct 20 15:53:00 CDT 2011


Author: sruffell
Date: Thu Oct 20 15:52:56 2011
New Revision: 10243

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10243
Log:
wcte12xp: Deprecate 't1e1override' module parameter in favor of 'default_linemode'.

't1e1override' isn't immediately apparent what it is supposed to do by the
name. Instead 'default_linemode' module parameter can be set to "auto", "t1",
or "e1" to make it clear.

Signed-off-by: Shaun Ruffell <sruffell at digium.com>
Acked-by: Michael Spiceland <mspiceland at digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks at digium.com>

Modified:
    linux/trunk/drivers/dahdi/wcte12xp/base.c

Modified: linux/trunk/drivers/dahdi/wcte12xp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wcte12xp/base.c?view=diff&rev=10243&r1=10242&r2=10243
==============================================================================
--- linux/trunk/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/trunk/drivers/dahdi/wcte12xp/base.c Thu Oct 20 15:52:56 2011
@@ -55,13 +55,18 @@
 #error VOICEBUS_SFRAME_SIZE != SFRAME_SIZE
 #endif
 
+#ifndef pr_fmt
+#define pr_fmt(fmt)             KBUILD_MODNAME ": " fmt
+#endif
+
 static int debug;
 static int j1mode = 0;
 static int alarmdebounce = 2500; /* LOF/LFA def to 2.5s AT&T TR54016*/
 static int losalarmdebounce = 2500; /* LOS def to 2.5s AT&T TR54016*/
 static int aisalarmdebounce = 2500; /* AIS(blue) def to 2.5s AT&T TR54016*/
 static int yelalarmdebounce = 500; /* RAI(yellow) def to 0.5s AT&T devguide */
-static int t1e1override = -1;
+static int t1e1override = -1; /* deprecated */
+static char *default_linemode = "auto"; /* 'auto', 'e1', or 't1' */
 static int latency = VOICEBUS_DEFAULT_LATENCY;
 static unsigned int max_latency = VOICEBUS_DEFAULT_MAXLATENCY;
 static int vpmsupport = 1;
@@ -1866,20 +1871,23 @@
 	int x;
 
 	/* T1 or E1 */
-	if (t1e1override > -1) {
-		if (t1e1override)
+	if (-1 != t1e1override) {
+		pr_info("t1e1override is deprecated. Please use 'spantype'.\n");
+		wc->spantype = (t1e1override) ? TYPE_E1 : TYPE_T1;
+	} else {
+		if (!strcasecmp(default_linemode, "e1")) {
 			wc->spantype = TYPE_E1;
-		else
+		} else if (!strcasecmp(default_linemode, "t1")) {
 			wc->spantype = TYPE_T1;
-	} else {
-		u8 pins;
-		res = t1_getpins(wc, &pins);
-		if (res)
-			return res;
-
-		wc->spantype = (pins & 0x01) ? TYPE_T1 : TYPE_E1;
-	}
-	debug_printk(wc, 1, "spantype: %s\n", 1 == wc->spantype ? "T1" : "E1");
+		} else {
+			u8 pins;
+			res = t1_getpins(wc, &pins);
+			if (res)
+				return res;
+			wc->spantype = (pins & 0x01) ? TYPE_T1 : TYPE_E1;
+		}
+	}
+	debug_printk(wc, 1, "linemode: %s\n", 1 == wc->spantype ? "T1" : "E1");
 	
 	/* what version of the FALC are we using? */
 	reg = t1_setreg(wc, 0x4a, 0xaa);
@@ -2793,6 +2801,16 @@
 	if (!cmd_cache)
 		return -ENOMEM;
 
+	if (-1 != t1e1override) {
+		pr_info("'t1e1override' is deprecated. "
+			"Please use 'default_linemode' instead\n");
+	} else if (strcasecmp(default_linemode, "auto") &&
+		   strcasecmp(default_linemode, "t1") &&
+		   strcasecmp(default_linemode, "e1")) {
+		pr_err("'%s' is an unknown span type.", default_linemode);
+		default_linemode = "auto";
+		return -EINVAL;
+	}
 	res = dahdi_pci_module(&te12xp_driver);
 	if (res) {
 		kmem_cache_destroy(cmd_cache);
@@ -2811,6 +2829,9 @@
 
 module_param(debug, int, S_IRUGO | S_IWUSR);
 module_param(t1e1override, int, S_IRUGO | S_IWUSR);
+module_param(default_linemode, charp, S_IRUGO);
+MODULE_PARM_DESC(default_linemode, "\"auto\"(default), \"e1\", or \"t1\". "
+		 "\"auto\" will use the value from the hardware jumpers.");
 module_param(j1mode, int, S_IRUGO | S_IWUSR);
 module_param(alarmdebounce, int, S_IRUGO | S_IWUSR);
 module_param(losalarmdebounce, int, S_IRUGO | S_IWUSR);




More information about the svn-commits mailing list