From dfaff26c68032ba4837575ec48ea11ebf8f44b96 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Tue, 19 Aug 2008 20:14:06 +0000 Subject: 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. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@4791 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/dahdi_transcode.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/dahdi/dahdi_transcode.c') diff --git a/drivers/dahdi/dahdi_transcode.c b/drivers/dahdi/dahdi_transcode.c index 24e6c35..92120a3 100644 --- a/drivers/dahdi/dahdi_transcode.c +++ b/drivers/dahdi/dahdi_transcode.c @@ -59,10 +59,10 @@ struct dahdi_transcoder *dahdi_transcoder_alloc(int numchans) memset(tc, 0, size); strcpy(tc->name, ""); + INIT_LIST_HEAD(&tc->node); tc->numchannels = numchans; - for (x=0;xnumchannels;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 @@ static int is_on_list(struct list_head *entry, struct list_head *head) /* 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_allocate(struct file *file, unsigned long data) 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 @@ static long dahdi_tc_getinfo(unsigned long data) 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; } -- cgit v1.2.3