staging: dgap: Simplify to set a module type
authorDaeseok Youn <daeseok.youn@gmail.com>
Sat, 9 Aug 2014 05:39:05 +0000 (14:39 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 16 Aug 2014 19:23:06 +0000 (12:23 -0700)
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>
drivers/staging/dgap/dgap.c
drivers/staging/dgap/dgap.h

index 1d27976be1aa4e0d223c7a83f2a7af79330b0b75..a54b8d4f74fe9bf482b851765474e3908ae913c6 100644 (file)
@@ -6388,6 +6388,7 @@ static int dgap_parsefile(char **in)
        for (; ;) {
                int board_type = 0;
                int conc_type = 0;
+               int module_type = 0;
 
                rc = dgap_gettok(in);
                if (rc == 0) {
@@ -6762,24 +6763,15 @@ static int dgap_parsefile(char **in)
                        else
                                brd->u.board.module1++;
 
-                       break;
-
-               case PORTS:     /* ports type EBI module */
-                       if (p->type != MNODE) {
-                               dgap_err("ports only valid for EBI modules");
+                       module_type = dgap_gettok(in);
+                       if (module_type == 0 || module_type != PORTS ||
+                           module_type != MODEM) {
+                               dgap_err("failed to set a type of module");
                                return -1;
                        }
-                       p->u.module.type = PORTS;
-                       p->u.module.v_type = 1;
-                       break;
 
-               case MODEM:     /* ports type EBI module */
-                       if (p->type != MNODE) {
-                               dgap_err("modem only valid for modem modules");
-                               return -1;
-                       }
-                       p->u.module.type = MODEM;
-                       p->u.module.v_type = 1;
+                       p->u.module.type = module_type;
+
                        break;
 
                case CABLE:
@@ -7207,10 +7199,6 @@ static int dgap_checknode(struct cnode *p)
                return 0;
 
        case MNODE:
-               if (p->u.module.v_type == 0) {
-                       dgap_err("EBI module type not specified");
-                       return 1;
-               }
                if (p->u.module.v_nport == 0) {
                        dgap_err("number of ports on EBI module not specified");
                        return 1;
index 800f4077fe36513378c8b270e22ee8032ca5a2b3..52e1d649dedfe4c9b4f2e3c2000cda4a507bafdf 100644 (file)
@@ -1219,7 +1219,6 @@ struct cnode {
                        char *id;
                        char *idstr;
                        long start;
-                       char v_type;
                        char v_nport;
                        char v_id;
                        char v_start;