diff options
Diffstat (limited to 'kernel/zttranscode.c')
-rw-r--r-- | kernel/zttranscode.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/kernel/zttranscode.c b/kernel/zttranscode.c index 23a5dc8..cc26492 100644 --- a/kernel/zttranscode.c +++ b/kernel/zttranscode.c @@ -60,9 +60,9 @@ struct zt_transcoder *zt_transcoder_alloc(int numchans) 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 @@ static int is_on_list(struct list_head *entry, struct list_head *head) /* 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_allocate(struct file *file, unsigned long data) 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 @@ static long zt_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; } |