This patch fixes all the simple_strtol and simple_strtoul warnings
as reported by checkpatch. After this patch, checkpatch will report
zero errors or warnings on dgap.c.

Signed-off-by: Mark Hounschell <ma...@compro.net>
Tested-by: Mark Hounschell <ma...@compro.net>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
 drivers/staging/dgap/dgap.c | 69 ++++++++++++++++-----------------------------
 drivers/staging/dgap/dgap.h | 36 +++++++++++------------
 2 files changed, 42 insertions(+), 63 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index df1cbf8..404e0b3 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -6463,7 +6463,7 @@ static ssize_t dgap_tty_name_show(struct device *d,
                                if (cn != (i + ncount))
                                        continue;
 
-                               return snprintf(buf, PAGE_SIZE, "%s%s%02d\n",
+                               return snprintf(buf, PAGE_SIZE, "%s%s%02ld\n",
                                                (un->un_type == DGAP_PRINT) ?
                                                 "pr" : "tty",
                                                cptr->u.conc.id,
@@ -6480,7 +6480,7 @@ static ssize_t dgap_tty_name_show(struct device *d,
                                if (cn != (i + ncount))
                                        continue;
 
-                               return snprintf(buf, PAGE_SIZE, "%s%s%02d\n",
+                               return snprintf(buf, PAGE_SIZE, "%s%s%02ld\n",
                                                (un->un_type == DGAP_PRINT) ?
                                                 "pr" : "tty",
                                                cptr->u.module.id,
@@ -6543,7 +6543,7 @@ static int        dgap_parsefile(char **in, int Remove)
 {
        struct cnode *p, *brd, *line, *conc;
        int     rc;
-       char    *s = NULL, *s2 = NULL;
+       char    *s = NULL;
        int     linecnt = 0;
 
        p = &dgap_head;
@@ -6689,8 +6689,7 @@ static int        dgap_parsefile(char **in, int Remove)
                                return -1;
                        }
                        p->u.board.portstr = dgap_savestring(s);
-                       p->u.board.port = (short)simple_strtol(s, &s2, 0);
-                       if ((short)strlen(s) > (short)(s2 - s)) {
+                       if (kstrtol(s, 0, &p->u.board.port)) {
                                dgap_err("bad number for IO port");
                                return -1;
                        }
@@ -6708,8 +6707,7 @@ static int        dgap_parsefile(char **in, int Remove)
                                return -1;
                        }
                        p->u.board.addrstr = dgap_savestring(s);
-                       p->u.board.addr = simple_strtoul(s, &s2, 0);
-                       if ((int)strlen(s) > (int)(s2 - s)) {
+                       if (kstrtoul(s, 0, &p->u.board.addr)) {
                                dgap_err("bad number for memory address");
                                return -1;
                        }
@@ -6727,8 +6725,7 @@ static int        dgap_parsefile(char **in, int Remove)
                                return -1;
                        }
                        p->u.board.pcibusstr = dgap_savestring(s);
-                       p->u.board.pcibus = simple_strtoul(s, &s2, 0);
-                       if ((int)strlen(s) > (int)(s2 - s)) {
+                       if (kstrtoul(s, 0, &p->u.board.pcibus)) {
                                dgap_err("bad number for pci bus");
                                return -1;
                        }
@@ -6739,8 +6736,7 @@ static int        dgap_parsefile(char **in, int Remove)
                                return -1;
                        }
                        p->u.board.pcislotstr = dgap_savestring(s);
-                       p->u.board.pcislot = simple_strtoul(s, &s2, 0);
-                       if ((int)strlen(s) > (int)(s2 - s)) {
+                       if (kstrtoul(s, 0, &p->u.board.pcislot)) {
                                dgap_err("bad number for pci slot");
                                return -1;
                        }
@@ -6781,8 +6777,7 @@ static int        dgap_parsefile(char **in, int Remove)
                                        dgap_err("unexpected end of file");
                                        return -1;
                                }
-                               p->u.board.nport = (char)simple_strtol(s, &s2, 
0);
-                               if ((int)strlen(s) > (int)(s2 - s)) {
+                               if (kstrtol(s, 0, &p->u.board.nport)) {
                                        dgap_err("bad number for number of 
ports");
                                        return -1;
                                }
@@ -6793,8 +6788,7 @@ static int        dgap_parsefile(char **in, int Remove)
                                        dgap_err("unexpected end of file");
                                        return -1;
                                }
-                               p->u.conc.nport = (char)simple_strtol(s, &s2, 
0);
-                               if ((int)strlen(s) > (int)(s2 - s)) {
+                               if (kstrtol(s, 0, &p->u.conc.nport)) {
                                        dgap_err("bad number for number of 
ports");
                                        return -1;
                                }
@@ -6805,8 +6799,7 @@ static int        dgap_parsefile(char **in, int Remove)
                                        dgap_err("unexpected end of file");
                                        return -1;
                                }
-                               p->u.module.nport = (char)simple_strtol(s, &s2, 
0);
-                               if ((int)strlen(s) > (int)(s2 - s)) {
+                               if (kstrtol(s, 0, &p->u.module.nport)) {
                                        dgap_err("bad number for number of 
ports");
                                        return -1;
                                }
@@ -6845,8 +6838,7 @@ static int        dgap_parsefile(char **in, int Remove)
                                        dgap_err("unexpected end of file");
                                        return -1;
                                }
-                               p->u.board.start = simple_strtol(s, &s2, 0);
-                               if ((int)strlen(s) > (int)(s2 - s)) {
+                               if (kstrtol(s, 0, &p->u.board.start)) {
                                        dgap_err("bad number for start of tty 
count");
                                        return -1;
                                }
@@ -6857,8 +6849,7 @@ static int        dgap_parsefile(char **in, int Remove)
                                        dgap_err("unexpected end of file");
                                        return -1;
                                }
-                               p->u.conc.start = simple_strtol(s, &s2, 0);
-                               if ((int)strlen(s) > (int)(s2 - s)) {
+                               if (kstrtol(s, 0, &p->u.conc.start)) {
                                        dgap_err("bad number for start of tty 
count");
                                        return -1;
                                }
@@ -6869,8 +6860,7 @@ static int        dgap_parsefile(char **in, int Remove)
                                        dgap_err("unexpected end of file");
                                        return -1;
                                }
-                               p->u.module.start = simple_strtol(s, &s2, 0);
-                               if ((int)strlen(s) > (int)(s2 - s)) {
+                               if (kstrtol(s, 0, &p->u.module.start)) {
                                        dgap_err("bad number for start of tty 
count");
                                        return -1;
                                }
@@ -7052,8 +7042,7 @@ static int        dgap_parsefile(char **in, int Remove)
                                        dgap_err("unexpected end of file");
                                        return -1;
                                }
-                               p->u.line.speed = (char)simple_strtol(s, &s2, 
0);
-                               if ((short)strlen(s) > (short)(s2 - s)) {
+                               if (kstrtol(s, 0, &p->u.line.speed)) {
                                        dgap_err("bad number for line speed");
                                        return -1;
                                }
@@ -7064,8 +7053,7 @@ static int        dgap_parsefile(char **in, int Remove)
                                        dgap_err("unexpected end of file");
                                        return -1;
                                }
-                               p->u.conc.speed = (char)simple_strtol(s, &s2, 
0);
-                               if ((short)strlen(s) > (short)(s2 - s)) {
+                               if (kstrtol(s, 0, &p->u.conc.speed)) {
                                        dgap_err("bad number for line speed");
                                        return -1;
                                }
@@ -7122,8 +7110,7 @@ static int        dgap_parsefile(char **in, int Remove)
                                dgap_err("unexpected end of file");
                                return -1;
                        }
-                       p->u.majornumber = simple_strtol(s, &s2, 0);
-                       if ((int)strlen(s) > (int)(s2 - s)) {
+                       if (kstrtol(s, 0, &p->u.majornumber)) {
                                dgap_err("bad number for major number");
                                return -1;
                        }
@@ -7143,8 +7130,7 @@ static int        dgap_parsefile(char **in, int Remove)
                                dgap_err("unexpected end of file");
                                return -1;
                        }
-                       p->u.altpin = simple_strtol(s, &s2, 0);
-                       if ((int)strlen(s) > (int)(s2 - s)) {
+                       if (kstrtol(s, 0, &p->u.altpin)) {
                                dgap_err("bad number for altpin");
                                return -1;
                        }
@@ -7164,8 +7150,7 @@ static int        dgap_parsefile(char **in, int Remove)
                                dgap_err("unexpected end of file");
                                return -1;
                        }
-                       p->u.useintr = simple_strtol(s, &s2, 0);
-                       if ((int)strlen(s) > (int)(s2 - s)) {
+                       if (kstrtol(s, 0, &p->u.useintr)) {
                                dgap_err("bad number for useintr");
                                return -1;
                        }
@@ -7185,8 +7170,7 @@ static int        dgap_parsefile(char **in, int Remove)
                                dgap_err("unexpected end of file");
                                return -1;
                        }
-                       p->u.ttysize = simple_strtol(s, &s2, 0);
-                       if ((int)strlen(s) > (int)(s2 - s)) {
+                       if (kstrtol(s, 0, &p->u.ttysize)) {
                                dgap_err("bad number for ttysize");
                                return -1;
                        }
@@ -7206,8 +7190,7 @@ static int        dgap_parsefile(char **in, int Remove)
                                dgap_err("unexpected end of file");
                                return -1;
                        }
-                       p->u.chsize = simple_strtol(s, &s2, 0);
-                       if ((int)strlen(s) > (int)(s2 - s)) {
+                       if (kstrtol(s, 0, &p->u.chsize)) {
                                dgap_err("bad number for chsize");
                                return -1;
                        }
@@ -7227,8 +7210,7 @@ static int        dgap_parsefile(char **in, int Remove)
                                dgap_err("unexpected end of file");
                                return -1;
                        }
-                       p->u.bssize = simple_strtol(s, &s2, 0);
-                       if ((int)strlen(s) > (int)(s2 - s)) {
+                       if (kstrtol(s, 0, &p->u.bssize)) {
                                dgap_err("bad number for bssize");
                                return -1;
                        }
@@ -7248,8 +7230,7 @@ static int        dgap_parsefile(char **in, int Remove)
                                dgap_err("unexpected end of file");
                                return -1;
                        }
-                       p->u.unsize = simple_strtol(s, &s2, 0);
-                       if ((int)strlen(s) > (int)(s2 - s)) {
+                       if (kstrtol(s, 0, &p->u.unsize)) {
                                dgap_err("bad number for schedsize");
                                return -1;
                        }
@@ -7269,8 +7250,7 @@ static int        dgap_parsefile(char **in, int Remove)
                                dgap_err("unexpected end of file");
                                return -1;
                        }
-                       p->u.f2size = simple_strtol(s, &s2, 0);
-                       if ((int)strlen(s) > (int)(s2 - s)) {
+                       if (kstrtol(s, 0, &p->u.f2size)) {
                                dgap_err("bad number for f2200size");
                                return -1;
                        }
@@ -7290,8 +7270,7 @@ static int        dgap_parsefile(char **in, int Remove)
                                dgap_err("unexpected end of file");
                                return -1;
                        }
-                       p->u.vpixsize = simple_strtol(s, &s2, 0);
-                       if ((int)strlen(s) > (int)(s2 - s)) {
+                       if (kstrtol(s, 0, &p->u.vpixsize)) {
                                dgap_err("bad number for vpixsize");
                                return -1;
                        }
diff --git a/drivers/staging/dgap/dgap.h b/drivers/staging/dgap/dgap.h
index c8f8509..6b8f5f8 100644
--- a/drivers/staging/dgap/dgap.h
+++ b/drivers/staging/dgap/dgap.h
@@ -1226,7 +1226,7 @@ struct cnode {
        union {
                struct {
                        char  type;     /* Board Type           */
-                       short port;     /* I/O Address          */
+                       long  port;     /* I/O Address          */
                        char  *portstr; /* I/O Address in string */
                        long  addr;     /* Memory Address       */
                        char  *addrstr; /* Memory Address in string */
@@ -1234,9 +1234,9 @@ struct cnode {
                        char  *pcibusstr; /* PCI BUS in string */
                        long  pcislot;  /* PCI SLOT             */
                        char  *pcislotstr; /* PCI SLOT in string */
-                       char  nport;    /* Number of Ports      */
+                       long  nport;    /* Number of Ports      */
                        char  *id;      /* tty id               */
-                       int   start;    /* start of tty counting */
+                       long  start;    /* start of tty counting */
                        char  *method;  /* Install method       */
                        char  v_type;
                        char  v_port;
@@ -1261,18 +1261,18 @@ struct cnode {
                struct {
                        char  *cable;
                        char  v_cable;
-                       char  speed;
+                       long  speed;
                        char  v_speed;
                } line;
 
                struct {
                        char  type;
                        char  *connect;
-                       char  speed;
-                       char  nport;
+                       long  speed;
+                       long  nport;
                        char  *id;
                        char  *idstr;
-                       int   start;
+                       long  start;
                        char  v_type;
                        char  v_connect;
                        char  v_speed;
@@ -1283,10 +1283,10 @@ struct cnode {
 
                struct {
                        char type;
-                       char nport;
+                       long nport;
                        char *id;
                        char *idstr;
-                       int  start;
+                       long start;
                        char v_type;
                        char v_nport;
                        char v_id;
@@ -1299,23 +1299,23 @@ struct cnode {
 
                char *printname;
 
-               int  majornumber;
+               long majornumber;
 
-               int  altpin;
+               long altpin;
 
-               int  ttysize;
+               long ttysize;
 
-               int  chsize;
+               long chsize;
 
-               int  bssize;
+               long bssize;
 
-               int  unsize;
+               long unsize;
 
-               int  f2size;
+               long f2size;
 
-               int  vpixsize;
+               long vpixsize;
 
-               int  useintr;
+               long useintr;
        } u;
 };
 
-- 
1.8.1.4

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

Reply via email to