stack IDs are now controller numbers

This commit is contained in:
Karsten Keil 2001-02-21 19:17:44 +00:00
parent 25765eb0aa
commit 9ca32005a5
1 changed files with 28 additions and 20 deletions

View File

@ -83,31 +83,39 @@ get_stack_profile(iframe_t *frm) {
} }
static int static int
get_free_stackid(void) { get_free_stackid(hisaxstack_t *mst) {
int id=1; int id=1;
hisaxstack_t *st, *cst; hisaxstack_t *st;
while(id) { if (!mst) {
st = hisax_stacklist; while(id<127) {
while (st) { st = hisax_stacklist;
if (st->id == id) while (st) {
break; if (st->id == id)
cst = st->child;
while (cst) {
if (cst->id == id)
break; break;
cst = cst->next; st = st->next;
} }
if (cst) if (st)
break; id++;
st = st->next; else
return(id);
}
return(0); /* 127 used controllers ??? */
} else { /* new child_id */
id = mst->id;
while(id<0x7fffffff) {
id += 0x00010000;
st = mst->child;
while (st) {
if (st->id == id)
break;
st = st->next;
}
if (!st)
return(id);
} }
if (st)
id++;
else
break;
} }
return(id); return(0);
} }
hisaxstack_t * hisaxstack_t *
@ -213,7 +221,7 @@ create_stack(hisaxinstance_t *inst, hisaxstack_t *master) {
} }
memset(newst, 0, sizeof(hisaxstack_t)); memset(newst, 0, sizeof(hisaxstack_t));
register_instance(newst, inst); register_instance(newst, inst);
newst->id = get_free_stackid(); newst->id = get_free_stackid(master);
if ((err = inst->obj->own_ctrl(newst, MGR_ADDLAYER | CONFIRM, NULL))) { if ((err = inst->obj->own_ctrl(newst, MGR_ADDLAYER | CONFIRM, NULL))) {
printk(KERN_ERR "hisax_stack register failed err %d\n", err); printk(KERN_ERR "hisax_stack register failed err %d\n", err);
kfree(newst); kfree(newst);