Skip to content

Commit f6aa016

Browse files
daeseokyoungregkh
authored andcommitted
staging: dgap: Simplify to set a concentrator type
It is same manner with setting a board type. For example of config file for concentrator, "conc ccon" or "conc epcon" After allocating a type of "CNODE" then set a type of concentrator. So remove cases in swith statement, just get a token from string and set to "conc.type". And also it doesn't need to "conc.v_type". Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 77a4492 commit f6aa016

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
@@ -6387,6 +6387,7 @@ static int dgap_parsefile(char **in)
63876387

63886388
for (; ;) {
63896389
int board_type = 0;
6390+
int conc_type = 0;
63906391

63916392
rc = dgap_gettok(in);
63926393
if (rc == 0) {
@@ -6719,24 +6720,15 @@ static int dgap_parsefile(char **in)
67196720
else
67206721
brd->u.board.conc1++;
67216722

6722-
break;
6723-
6724-
case CX: /* c/x type concentrator */
6725-
if (p->type != CNODE) {
6726-
dgap_err("cx only valid for concentrators");
6723+
conc_type = dgap_gettok(in);
6724+
if (conc_type == 0 || conc_type != CX ||
6725+
conc_type != EPC) {
6726+
dgap_err("failed to set a type of concentratros");
67276727
return -1;
67286728
}
6729-
p->u.conc.type = CX;
6730-
p->u.conc.v_type = 1;
6731-
break;
67326729

6733-
case EPC: /* epc type concentrator */
6734-
if (p->type != CNODE) {
6735-
dgap_err("cx only valid for concentrators");
6736-
return -1;
6737-
}
6738-
p->u.conc.type = EPC;
6739-
p->u.conc.v_type = 1;
6730+
p->u.conc.type = conc_type;
6731+
67406732
break;
67416733

67426734
case MOD: /* EBI module */
@@ -7200,10 +7192,6 @@ static int dgap_checknode(struct cnode *p)
72007192
return 0;
72017193

72027194
case CNODE:
7203-
if (p->u.conc.v_type == 0) {
7204-
dgap_err("concentrator type not specified");
7205-
return 1;
7206-
}
72077195
if (p->u.conc.v_speed == 0) {
72087196
dgap_err("concentrator line speed not specified");
72097197
return 1;

‎drivers/staging/dgap/dgap.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,6 @@ struct cnode {
12061206
char *id;
12071207
char *idstr;
12081208
long start;
1209-
char v_type;
12101209
char v_connect;
12111210
char v_speed;
12121211
char v_nport;

0 commit comments

Comments
 (0)