Removes dgap_savestring function to use kstrdup instead.

Signed-off-by: Mark Hounschell <ma...@compro.net>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Tested-by: Mark Hounschell <ma...@compro.net>
---
 drivers/staging/dgap/dgap.c | 44 +++++++++++++++-----------------------------
 1 file changed, 15 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 29d6cbe..efed10b 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -150,7 +150,6 @@ static void dgap_firmware_reset_port(struct channel_t *ch);
  */
 static int dgap_gettok(char **in, struct cnode *p);
 static char *dgap_getword(char **in);
-static char *dgap_savestring(char *s);
 static struct cnode *dgap_newnode(int t);
 static int dgap_checknode(struct cnode *p);
 static void dgap_err(char *s);
@@ -6447,7 +6446,7 @@ static int        dgap_parsefile(char **in, int remove)
                        }
                        p = p->next;
 
-                       p->u.board.status = dgap_savestring("No");
+                       p->u.board.status = kstrdup("No", GFP_KERNEL);
                        line = conc = NULL;
                        brd = p;
                        linecnt = -1;
@@ -6545,7 +6544,7 @@ static int        dgap_parsefile(char **in, int remove)
                                dgap_err("unexpected end of file");
                                return -1;
                        }
-                       p->u.board.portstr = dgap_savestring(s);
+                       p->u.board.portstr = kstrdup(s, GFP_KERNEL);
                        if (kstrtol(s, 0, &p->u.board.port)) {
                                dgap_err("bad number for IO port");
                                return -1;
@@ -6563,7 +6562,7 @@ static int        dgap_parsefile(char **in, int remove)
                                dgap_err("unexpected end of file");
                                return -1;
                        }
-                       p->u.board.addrstr = dgap_savestring(s);
+                       p->u.board.addrstr = kstrdup(s, GFP_KERNEL);
                        if (kstrtoul(s, 0, &p->u.board.addr)) {
                                dgap_err("bad number for memory address");
                                return -1;
@@ -6581,7 +6580,7 @@ static int        dgap_parsefile(char **in, int remove)
                                dgap_err("unexpected end of file");
                                return -1;
                        }
-                       p->u.board.pcibusstr = dgap_savestring(s);
+                       p->u.board.pcibusstr = kstrdup(s, GFP_KERNEL);
                        if (kstrtoul(s, 0, &p->u.board.pcibus)) {
                                dgap_err("bad number for pci bus");
                                return -1;
@@ -6592,7 +6591,7 @@ static int        dgap_parsefile(char **in, int remove)
                                dgap_err("unexpected end of file");
                                return -1;
                        }
-                       p->u.board.pcislotstr = dgap_savestring(s);
+                       p->u.board.pcislotstr = kstrdup(s, GFP_KERNEL);
                        if (kstrtoul(s, 0, &p->u.board.pcislot)) {
                                dgap_err("bad number for pci slot");
                                return -1;
@@ -6610,7 +6609,7 @@ static int        dgap_parsefile(char **in, int remove)
                                dgap_err("unexpected end of file");
                                return -1;
                        }
-                       p->u.board.method = dgap_savestring(s);
+                       p->u.board.method = kstrdup(s, GFP_KERNEL);
                        p->u.board.v_method = 1;
                        break;
 
@@ -6624,7 +6623,7 @@ static int        dgap_parsefile(char **in, int remove)
                                dgap_err("unexpected end of file");
                                return -1;
                        }
-                       p->u.board.status = dgap_savestring(s);
+                       p->u.board.status = kstrdup(s, GFP_KERNEL);
                        break;
 
                case NPORTS:    /* number of ports */
@@ -6674,13 +6673,13 @@ static int      dgap_parsefile(char **in, int remove)
                                return -1;
                        }
 
-                       p->u.board.status = dgap_savestring(s);
+                       p->u.board.status = kstrdup(s, GFP_KERNEL);
 
                        if (p->type == CNODE) {
-                               p->u.conc.id = dgap_savestring(s);
+                               p->u.conc.id = kstrdup(s, GFP_KERNEL);
                                p->u.conc.v_id = 1;
                        } else if (p->type == MNODE) {
-                               p->u.module.id = dgap_savestring(s);
+                               p->u.module.id = kstrdup(s, GFP_KERNEL);
                                p->u.module.v_id = 1;
                        } else {
                                dgap_err("id only valid for concentrators or 
modules");
@@ -6742,7 +6741,7 @@ static int        dgap_parsefile(char **in, int remove)
                                dgap_err("unexpeced end of file");
                                return -1;
                        }
-                       p->u.ttyname = dgap_savestring(s);
+                       p->u.ttyname = kstrdup(s, GFP_KERNEL);
                        if (!p->u.ttyname) {
                                dgap_err("out of memory");
                                return -1;
@@ -6763,7 +6762,7 @@ static int        dgap_parsefile(char **in, int remove)
                                dgap_err("unexpeced end of file");
                                return -1;
                        }
-                       p->u.cuname = dgap_savestring(s);
+                       p->u.cuname = kstrdup(s, GFP_KERNEL);
                        if (!p->u.cuname) {
                                dgap_err("out of memory");
                                return -1;
@@ -6887,7 +6886,7 @@ static int        dgap_parsefile(char **in, int remove)
                                        dgap_err("unexpected end of file");
                                        return -1;
                                }
-                               p->u.line.cable = dgap_savestring(s);
+                               p->u.line.cable = kstrdup(s, GFP_KERNEL);
                                p->u.line.v_cable = 1;
                        }
                        break;
@@ -6928,7 +6927,7 @@ static int        dgap_parsefile(char **in, int remove)
                                        dgap_err("unexpected end of file");
                                        return -1;
                                }
-                               p->u.conc.connect = dgap_savestring(s);
+                               p->u.conc.connect = kstrdup(s, GFP_KERNEL);
                                p->u.conc.v_connect = 1;
                        }
                        break;
@@ -6946,7 +6945,7 @@ static int        dgap_parsefile(char **in, int remove)
                                dgap_err("unexpeced end of file");
                                return -1;
                        }
-                       p->u.printname = dgap_savestring(s);
+                       p->u.printname = kstrdup(s, GFP_KERNEL);
                        if (!p->u.printname) {
                                dgap_err("out of memory");
                                return -1;
@@ -7312,19 +7311,6 @@ static int dgap_checknode(struct cnode *p)
 }
 
 /*
- * save a string somewhere
- */
-static char    *dgap_savestring(char *s)
-{
-       char    *p;
-
-       p = kmalloc(strlen(s) + 1, GFP_ATOMIC);
-       if (p)
-               strcpy(p, s);
-       return p;
-}
-
-/*
  * Given a board pointer, returns whether we should use interrupts or not.
  */
 static uint dgap_config_get_useintr(struct board_t *bd)
-- 
1.8.4.5

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to