[svn-commits] sruffell: linux/trunk r4791 - in /linux/trunk: drivers/dahdi/ drivers/dahdi/w...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Aug 19 15:14:06 CDT 2008


Author: sruffell
Date: Tue Aug 19 15:14:06 2008
New Revision: 4791

URL: http://svn.digium.com/view/dahdi?view=rev&rev=4791
Log:
Couple of fixes for the transcoder:

- In dahdi_transcode.c,  Embed the identifiation number, assigned sequentially
  when the transcoders are registered, in the transcoder structure. This allows
  DAHDI_TC_GETINFO to work as expected even though the transcoders are rotated
  on the list in order to spread the load. 

- In wctc4xxp, fix bug where all transcoders are named tc400b0.

Modified:
    linux/trunk/drivers/dahdi/dahdi_transcode.c
    linux/trunk/drivers/dahdi/wctc4xxp/base.c
    linux/trunk/include/dahdi/kernel.h

Modified: linux/trunk/drivers/dahdi/dahdi_transcode.c
URL: http://svn.digium.com/view/dahdi/linux/trunk/drivers/dahdi/dahdi_transcode.c?view=diff&rev=4791&r1=4790&r2=4791
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi_transcode.c (original)
+++ linux/trunk/drivers/dahdi/dahdi_transcode.c Tue Aug 19 15:14:06 2008
@@ -59,10 +59,10 @@
 
 	memset(tc, 0, size);
 	strcpy(tc->name, "<unspecified>");
+	INIT_LIST_HEAD(&tc->node);
 	tc->numchannels = numchans;
-	for (x=0;x<tc->numchannels;x++) {
+	for (x=0; x < tc->numchannels; x++) {
 		init_waitqueue_head(&tc->channels[x].ready);
-		INIT_LIST_HEAD(&tc->node);
 		tc->channels[x].parent = tc;
 	}
 
@@ -93,6 +93,8 @@
 /* Register a transcoder */
 int dahdi_transcoder_register(struct dahdi_transcoder *tc)
 {
+	static int count = 0;
+	tc->pos = count++;
 	spin_lock(&translock);
 	BUG_ON(is_on_list(&tc->node, &trans));
 	list_add_tail(&tc->node, &trans);
@@ -287,7 +289,6 @@
 static long dahdi_tc_getinfo(unsigned long data)
 {
 	struct dahdi_transcoder_info info;
-	unsigned int x;
 	struct dahdi_transcoder *cur;
 	struct dahdi_transcoder *tc = NULL;
 	
@@ -295,10 +296,9 @@
 		return -EFAULT;
 	}
 
-	x = 0;
 	spin_lock(&translock);
 	list_for_each_entry(cur, &trans, node) {
-		if (x++ == info.tcnum) {
+		if (cur->pos == info.tcnum) {
 			tc = cur;
 			break;
 		} 

Modified: linux/trunk/drivers/dahdi/wctc4xxp/base.c
URL: http://svn.digium.com/view/dahdi/linux/trunk/drivers/dahdi/wctc4xxp/base.c?view=diff&rev=4791&r1=4790&r2=4791
==============================================================================
--- linux/trunk/drivers/dahdi/wctc4xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wctc4xxp/base.c Tue Aug 19 15:14:06 2008
@@ -441,7 +441,6 @@
 	char board_name[40];
 	const char *variety;
 	int pos;
-	int cards;
 	struct list_head node;
 	spinlock_t reglock;
 	wait_queue_head_t waitq;
@@ -1744,6 +1743,10 @@
 			   "%d bytes.\n", count, G723_5K_BYTES);
 			return -EINVAL;
 		}
+		cpvt->timestamp = G723_SAMPLES;
+	} else {
+		/* Same for ulaw and alaw */
+		cpvt->timestamp = G729_SAMPLES; 
 	}
 
 	if (!(cmd = wctc4xxp_create_rtp_cmd(wc, dtc, count))) {
@@ -2854,7 +2857,7 @@
 }
 
 /**
- * 	Insert an struct wcdte on the global list in sorted order
+ * Insert an struct wcdte on the global list in sorted order
  *
  */
 static int __devinit
@@ -2867,12 +2870,16 @@
 	list_for_each_entry(cur, &wctc4xxp_list, node) {
 		if (cur->pos != pos) {
 			/* Add the new entry before the one here */
-			list_add_tail(&wc->node, &wctc4xxp_list);
+			list_add_tail(&wc->node, &cur->node);
 			break;
 		}
 		else {
 			++pos;
 		}
+	}
+	/* If we didn't already add the new entry to the list, add it now */
+	if (list_empty(&wc->node)) {
+		list_add_tail(&wc->node, &wctc4xxp_list);
 	}
 	spin_unlock(&wctc4xxp_list_lock);
 	return pos;
@@ -3237,13 +3244,6 @@
 int __init wctc4xxp_init(void)
 {
 	int res;
-#	ifndef CONFIG_WCDTE_NETWORK_IF
-	if (debug & (DTE_DEBUG_NETWORK_IF|DTE_DEBUG_NETWORK_EARLY)) {
-		printk(KERN_WARNING "%s: The Network interface was not compiled into the driver.\n", THIS_MODULE->name);
-		debug &= ~(DTE_DEBUG_NETWORK_IF|DTE_DEBUG_NETWORK_EARLY);
-	}
-#	endif
-
 #	if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
 	cmd_cache = kmem_cache_create(THIS_MODULE->name, sizeof(struct tcb), 0, 
 	                              SLAB_HWCACHE_ALIGN, NULL, NULL);

Modified: linux/trunk/include/dahdi/kernel.h
URL: http://svn.digium.com/view/dahdi/linux/trunk/include/dahdi/kernel.h?view=diff&rev=4791&r1=4790&r2=4791
==============================================================================
--- linux/trunk/include/dahdi/kernel.h (original)
+++ linux/trunk/include/dahdi/kernel.h Tue Aug 19 15:14:06 2008
@@ -667,6 +667,7 @@
 
 struct dahdi_transcoder {
 	struct list_head node;
+	int pos;
 	char name[80];
 	int numchannels;
 	unsigned int srcfmts;




More information about the svn-commits mailing list