Skip to content

Commit 3cfa648

Browse files
daeseokyoungregkh
authored andcommitted
staging: dgap: Simplify to set a module type
It is same manner with setting a board type. After allocating a type of "MNODE", get a token value set to "module.type". Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f6aa016 commit 3cfa648

2 files changed

Lines changed: 7 additions & 20 deletions

File tree

‎drivers/staging/dgap/dgap.c‎

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6388,6 +6388,7 @@ static int dgap_parsefile(char **in)
63886388
for (; ;) {
63896389
int board_type = 0;
63906390
int conc_type = 0;
6391+
int module_type = 0;
63916392

63926393
rc = dgap_gettok(in);
63936394
if (rc == 0) {
@@ -6762,24 +6763,15 @@ static int dgap_parsefile(char **in)
67626763
else
67636764
brd->u.board.module1++;
67646765

6765-
break;
6766-
6767-
case PORTS: /* ports type EBI module */
6768-
if (p->type != MNODE) {
6769-
dgap_err("ports only valid for EBI modules");
6766+
module_type = dgap_gettok(in);
6767+
if (module_type == 0 || module_type != PORTS ||
6768+
module_type != MODEM) {
6769+
dgap_err("failed to set a type of module");
67706770
return -1;
67716771
}
6772-
p->u.module.type = PORTS;
6773-
p->u.module.v_type = 1;
6774-
break;
67756772

6776-
case MODEM: /* ports type EBI module */
6777-
if (p->type != MNODE) {
6778-
dgap_err("modem only valid for modem modules");
6779-
return -1;
6780-
}
6781-
p->u.module.type = MODEM;
6782-
p->u.module.v_type = 1;
6773+
p->u.module.type = module_type;
6774+
67836775
break;
67846776

67856777
case CABLE:
@@ -7207,10 +7199,6 @@ static int dgap_checknode(struct cnode *p)
72077199
return 0;
72087200

72097201
case MNODE:
7210-
if (p->u.module.v_type == 0) {
7211-
dgap_err("EBI module type not specified");
7212-
return 1;
7213-
}
72147202
if (p->u.module.v_nport == 0) {
72157203
dgap_err("number of ports on EBI module not specified");
72167204
return 1;

‎drivers/staging/dgap/dgap.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,6 @@ struct cnode {
12191219
char *id;
12201220
char *idstr;
12211221
long start;
1222-
char v_type;
12231222
char v_nport;
12241223
char v_id;
12251224
char v_start;

0 commit comments

Comments
 (0)