summaryrefslogtreecommitdiff
path: root/drivers/dahdi/dahdi_transcode.c
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2008-08-19 20:14:06 +0000
committerShaun Ruffell <sruffell@digium.com>2008-08-19 20:14:06 +0000
commitdfaff26c68032ba4837575ec48ea11ebf8f44b96 (patch)
treea13d24508abaa9a7aa4c08ce04f85aa25506a6f5 /drivers/dahdi/dahdi_transcode.c
parent6d91df78df4200f1bd932bfb0d8d717b32c42492 (diff)
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
Diffstat (limited to 'drivers/dahdi/dahdi_transcode.c')
-rw-r--r--drivers/dahdi/dahdi_transcode.c10
1 files changed, 5 insertions, 5 deletions
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, "<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 @@ 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;
}