*/
static int dgap_gettok(char **in);
static char *dgap_getword(char **in);
-static struct cnode *dgap_newnode(int t);
static int dgap_checknode(struct cnode *p);
static void dgap_err(char *s);
case BOARD: /* board info */
if (dgap_checknode(p))
return -1;
- p->next = dgap_newnode(BNODE);
+
+ p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) {
dgap_err("out of memory");
return -1;
}
p = p->next;
+ p->type = BNODE;
p->u.board.status = kstrdup("No", GFP_KERNEL);
line = conc = NULL;
brd = p;
case TTYN: /* tty name prefix */
if (dgap_checknode(p))
return -1;
- p->next = dgap_newnode(TNODE);
+
+ p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) {
dgap_err("out of memory");
return -1;
}
+
p = p->next;
+ p->type = TNODE;
+
s = dgap_getword(in);
if (!s) {
dgap_err("unexpeced end of file");
case CU: /* cu name prefix */
if (dgap_checknode(p))
return -1;
- p->next = dgap_newnode(CUNODE);
+
+ p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) {
dgap_err("out of memory");
return -1;
}
+
p = p->next;
+ p->type = CUNODE;
+
s = dgap_getword(in);
if (!s) {
dgap_err("unexpeced end of file");
dgap_err("line not vaild for PC/em");
return -1;
}
- p->next = dgap_newnode(LNODE);
+
+ p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) {
dgap_err("out of memory");
return -1;
}
+
p = p->next;
+ p->type = LNODE;
conc = NULL;
line = p;
linecnt++;
dgap_err("must specify line info before concentrator");
return -1;
}
- p->next = dgap_newnode(CNODE);
+
+ p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) {
dgap_err("out of memory");
return -1;
}
+
p = p->next;
+ p->type = CNODE;
conc = p;
+
if (linecnt)
brd->u.board.conc2++;
else
return -1;
}
}
- p->next = dgap_newnode(MNODE);
+
+ p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) {
dgap_err("out of memory");
return -1;
}
p = p->next;
+ p->type = MNODE;
+
if (linecnt)
brd->u.board.module2++;
else
case PRINT: /* transparent print name prefix */
if (dgap_checknode(p))
return -1;
- p->next = dgap_newnode(PNODE);
+
+ p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) {
dgap_err("out of memory");
return -1;
}
+
p = p->next;
+ p->type = PNODE;
+
s = dgap_getword(in);
if (!s) {
dgap_err("unexpeced end of file");
case CMAJOR: /* major number */
if (dgap_checknode(p))
return -1;
- p->next = dgap_newnode(JNODE);
+
+ p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) {
dgap_err("out of memory");
return -1;
}
+
p = p->next;
+ p->type = JNODE;
+
s = dgap_getword(in);
if (!s) {
dgap_err("unexpected end of file");
case ALTPIN: /* altpin setting */
if (dgap_checknode(p))
return -1;
- p->next = dgap_newnode(ANODE);
+
+ p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) {
dgap_err("out of memory");
return -1;
}
+
p = p->next;
+ p->type = ANODE;
+
s = dgap_getword(in);
if (!s) {
dgap_err("unexpected end of file");
case USEINTR: /* enable interrupt setting */
if (dgap_checknode(p))
return -1;
- p->next = dgap_newnode(INTRNODE);
+
+ p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) {
dgap_err("out of memory");
return -1;
}
p = p->next;
+ p->type = INTRNODE;
s = dgap_getword(in);
if (!s) {
dgap_err("unexpected end of file");
case TTSIZ: /* size of tty structure */
if (dgap_checknode(p))
return -1;
- p->next = dgap_newnode(TSNODE);
+
+ p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) {
dgap_err("out of memory");
return -1;
}
+
p = p->next;
+ p->type = TSNODE;
+
s = dgap_getword(in);
if (!s) {
dgap_err("unexpected end of file");
case CHSIZ: /* channel structure size */
if (dgap_checknode(p))
return -1;
- p->next = dgap_newnode(CSNODE);
+
+ p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) {
dgap_err("out of memory");
return -1;
}
+
p = p->next;
+ p->type = CSNODE;
+
s = dgap_getword(in);
if (!s) {
dgap_err("unexpected end of file");
case BSSIZ: /* board structure size */
if (dgap_checknode(p))
return -1;
- p->next = dgap_newnode(BSNODE);
+
+ p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) {
dgap_err("out of memory");
return -1;
}
+
p = p->next;
+ p->type = BSNODE;
+
s = dgap_getword(in);
if (!s) {
dgap_err("unexpected end of file");
case UNTSIZ: /* sched structure size */
if (dgap_checknode(p))
return -1;
- p->next = dgap_newnode(USNODE);
+
+ p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) {
dgap_err("out of memory");
return -1;
}
+
p = p->next;
+ p->type = USNODE;
+
s = dgap_getword(in);
if (!s) {
dgap_err("unexpected end of file");
case F2SIZ: /* f2200 structure size */
if (dgap_checknode(p))
return -1;
- p->next = dgap_newnode(FSNODE);
+
+ p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) {
dgap_err("out of memory");
return -1;
}
+
p = p->next;
+ p->type = FSNODE;
+
s = dgap_getword(in);
if (!s) {
dgap_err("unexpected end of file");
case VPSIZ: /* vpix structure size */
if (dgap_checknode(p))
return -1;
- p->next = dgap_newnode(VSNODE);
+
+ p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next) {
dgap_err("out of memory");
return -1;
}
+
p = p->next;
+ p->type = VSNODE;
+
s = dgap_getword(in);
if (!s) {
dgap_err("unexpected end of file");
pr_err("dgap: parse: %s\n", s);
}
-/*
- * allocate a new configuration node of type t
- */
-static struct cnode *dgap_newnode(int t)
-{
- struct cnode *n;
-
- n = kzalloc(sizeof(struct cnode), GFP_KERNEL);
- if (n)
- n->type = t;
- return n;
-}
-
/*
* dgap_checknode: see if all the necessary info has been supplied for a node
* before creating the next node.