* [PATCH 5/7] staging: dgap: Simplify to set a concentrator type
@ 2014-08-09 5:38 ` Daeseok Youn
0 siblings, 0 replies; 2+ messages in thread
From: Daeseok Youn @ 2014-08-09 5:38 UTC (permalink / raw)
To: lidza.louina, markh
Cc: markh, daeseok.youn, gregkh, driverdev-devel, devel, linux-kernel
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>
---
drivers/staging/dgap/dgap.c | 26 +++++++-------------------
drivers/staging/dgap/dgap.h | 1 -
2 files changed, 7 insertions(+), 20 deletions(-)
diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 7fb54d1..1d27976 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -6387,6 +6387,7 @@ static int dgap_parsefile(char **in)
for (; ;) {
int board_type = 0;
+ int conc_type = 0;
rc = dgap_gettok(in);
if (rc == 0) {
@@ -6719,24 +6720,15 @@ static int dgap_parsefile(char **in)
else
brd->u.board.conc1++;
- break;
-
- case CX: /* c/x type concentrator */
- if (p->type != CNODE) {
- dgap_err("cx only valid for concentrators");
+ conc_type = dgap_gettok(in);
+ if (conc_type == 0 || conc_type != CX ||
+ conc_type != EPC) {
+ dgap_err("failed to set a type of concentratros");
return -1;
}
- p->u.conc.type = CX;
- p->u.conc.v_type = 1;
- break;
- case EPC: /* epc type concentrator */
- if (p->type != CNODE) {
- dgap_err("cx only valid for concentrators");
- return -1;
- }
- p->u.conc.type = EPC;
- p->u.conc.v_type = 1;
+ p->u.conc.type = conc_type;
+
break;
case MOD: /* EBI module */
@@ -7200,10 +7192,6 @@ static int dgap_checknode(struct cnode *p)
return 0;
case CNODE:
- if (p->u.conc.v_type == 0) {
- dgap_err("concentrator type not specified");
- return 1;
- }
if (p->u.conc.v_speed == 0) {
dgap_err("concentrator line speed not specified");
return 1;
diff --git a/drivers/staging/dgap/dgap.h b/drivers/staging/dgap/dgap.h
index c01aa28..800f407 100644
--- a/drivers/staging/dgap/dgap.h
+++ b/drivers/staging/dgap/dgap.h
@@ -1206,7 +1206,6 @@ struct cnode {
char *id;
char *idstr;
long start;
- char v_type;
char v_connect;
char v_speed;
char v_nport;
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 5/7] staging: dgap: Simplify to set a concentrator type
@ 2014-08-09 5:38 ` Daeseok Youn
0 siblings, 0 replies; 2+ messages in thread
From: Daeseok Youn @ 2014-08-09 5:38 UTC (permalink / raw)
To: lidza.louina, markh
Cc: devel, gregkh, daeseok.youn, driverdev-devel, linux-kernel
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>
---
drivers/staging/dgap/dgap.c | 26 +++++++-------------------
drivers/staging/dgap/dgap.h | 1 -
2 files changed, 7 insertions(+), 20 deletions(-)
diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 7fb54d1..1d27976 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -6387,6 +6387,7 @@ static int dgap_parsefile(char **in)
for (; ;) {
int board_type = 0;
+ int conc_type = 0;
rc = dgap_gettok(in);
if (rc == 0) {
@@ -6719,24 +6720,15 @@ static int dgap_parsefile(char **in)
else
brd->u.board.conc1++;
- break;
-
- case CX: /* c/x type concentrator */
- if (p->type != CNODE) {
- dgap_err("cx only valid for concentrators");
+ conc_type = dgap_gettok(in);
+ if (conc_type == 0 || conc_type != CX ||
+ conc_type != EPC) {
+ dgap_err("failed to set a type of concentratros");
return -1;
}
- p->u.conc.type = CX;
- p->u.conc.v_type = 1;
- break;
- case EPC: /* epc type concentrator */
- if (p->type != CNODE) {
- dgap_err("cx only valid for concentrators");
- return -1;
- }
- p->u.conc.type = EPC;
- p->u.conc.v_type = 1;
+ p->u.conc.type = conc_type;
+
break;
case MOD: /* EBI module */
@@ -7200,10 +7192,6 @@ static int dgap_checknode(struct cnode *p)
return 0;
case CNODE:
- if (p->u.conc.v_type == 0) {
- dgap_err("concentrator type not specified");
- return 1;
- }
if (p->u.conc.v_speed == 0) {
dgap_err("concentrator line speed not specified");
return 1;
diff --git a/drivers/staging/dgap/dgap.h b/drivers/staging/dgap/dgap.h
index c01aa28..800f407 100644
--- a/drivers/staging/dgap/dgap.h
+++ b/drivers/staging/dgap/dgap.h
@@ -1206,7 +1206,6 @@ struct cnode {
char *id;
char *idstr;
long start;
- char v_type;
char v_connect;
char v_speed;
char v_nport;
--
1.7.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-08-09 5:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-09 5:38 [PATCH 5/7] staging: dgap: Simplify to set a concentrator type Daeseok Youn
2014-08-09 5:38 ` Daeseok Youn
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.