[svn-commits] sruffell: branch 1.4 r4491 - in /branches/1.4/kernel: zaptel.h zttranscode.c

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


Author: sruffell
Date: Tue Aug 19 15:14:25 2008
New Revision: 4491

URL: http://svn.digium.com/view/zaptel?view=rev&rev=4491
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:
    branches/1.4/kernel/zaptel.h
    branches/1.4/kernel/zttranscode.c

Modified: branches/1.4/kernel/zaptel.h
URL: http://svn.digium.com/view/zaptel/branches/1.4/kernel/zaptel.h?view=diff&rev=4491&r1=4490&r2=4491
==============================================================================
--- branches/1.4/kernel/zaptel.h (original)
+++ branches/1.4/kernel/zaptel.h Tue Aug 19 15:14:25 2008
@@ -1744,6 +1744,7 @@
 struct zt_transcoder {
 	struct list_head node;
 	char name[80];
+	int pos;
 	int numchannels;
 	unsigned int srcfmts;
 	unsigned int dstfmts;

Modified: branches/1.4/kernel/zttranscode.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/kernel/zttranscode.c?view=diff&rev=4491&r1=4490&r2=4491
==============================================================================
--- branches/1.4/kernel/zttranscode.c (original)
+++ branches/1.4/kernel/zttranscode.c Tue Aug 19 15:14:25 2008
@@ -60,9 +60,9 @@
 	memset(tc, 0, size);
 	strcpy(tc->name, "<unspecified>");
 	tc->numchannels = numchans;
+	INIT_LIST_HEAD(&tc->node);
 	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 zt_transcoder_register(struct zt_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 zt_tc_getinfo(unsigned long data)
 {
 	struct zt_transcoder_info info;
-	unsigned int x;
 	struct zt_transcoder *cur;
 	struct zt_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;
 		} 




More information about the svn-commits mailing list