Skip to content

Commit 67d5dc8

Browse files
Mark Hounschellgregkh
authored andcommitted
staging: dgap: fix the rest of the checkpatch warnings in dgap.c
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 <markh@compro.net> Tested-by: Mark Hounschell <markh@compro.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 65fbed3 commit 67d5dc8

2 files changed

Lines changed: 42 additions & 63 deletions

File tree

‎drivers/staging/dgap/dgap.c‎

Lines changed: 24 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -6462,7 +6462,7 @@ static ssize_t dgap_tty_name_show(struct device *d,
64626462
if (cn != (i + ncount))
64636463
continue;
64646464

6465-
return snprintf(buf, PAGE_SIZE, "%s%s%02d\n",
6465+
return snprintf(buf, PAGE_SIZE, "%s%s%02ld\n",
64666466
(un->un_type == DGAP_PRINT) ?
64676467
"pr" : "tty",
64686468
cptr->u.conc.id,
@@ -6479,7 +6479,7 @@ static ssize_t dgap_tty_name_show(struct device *d,
64796479
if (cn != (i + ncount))
64806480
continue;
64816481

6482-
return snprintf(buf, PAGE_SIZE, "%s%s%02d\n",
6482+
return snprintf(buf, PAGE_SIZE, "%s%s%02ld\n",
64836483
(un->un_type == DGAP_PRINT) ?
64846484
"pr" : "tty",
64856485
cptr->u.module.id,
@@ -6542,7 +6542,7 @@ static int dgap_parsefile(char **in, int Remove)
65426542
{
65436543
struct cnode *p, *brd, *line, *conc;
65446544
int rc;
6545-
char *s = NULL, *s2 = NULL;
6545+
char *s = NULL;
65466546
int linecnt = 0;
65476547

65486548
p = &dgap_head;
@@ -6688,8 +6688,7 @@ static int dgap_parsefile(char **in, int Remove)
66886688
return -1;
66896689
}
66906690
p->u.board.portstr = dgap_savestring(s);
6691-
p->u.board.port = (short)simple_strtol(s, &s2, 0);
6692-
if ((short)strlen(s) > (short)(s2 - s)) {
6691+
if (kstrtol(s, 0, &p->u.board.port)) {
66936692
dgap_err("bad number for IO port");
66946693
return -1;
66956694
}
@@ -6707,8 +6706,7 @@ static int dgap_parsefile(char **in, int Remove)
67076706
return -1;
67086707
}
67096708
p->u.board.addrstr = dgap_savestring(s);
6710-
p->u.board.addr = simple_strtoul(s, &s2, 0);
6711-
if ((int)strlen(s) > (int)(s2 - s)) {
6709+
if (kstrtoul(s, 0, &p->u.board.addr)) {
67126710
dgap_err("bad number for memory address");
67136711
return -1;
67146712
}
@@ -6726,8 +6724,7 @@ static int dgap_parsefile(char **in, int Remove)
67266724
return -1;
67276725
}
67286726
p->u.board.pcibusstr = dgap_savestring(s);
6729-
p->u.board.pcibus = simple_strtoul(s, &s2, 0);
6730-
if ((int)strlen(s) > (int)(s2 - s)) {
6727+
if (kstrtoul(s, 0, &p->u.board.pcibus)) {
67316728
dgap_err("bad number for pci bus");
67326729
return -1;
67336730
}
@@ -6738,8 +6735,7 @@ static int dgap_parsefile(char **in, int Remove)
67386735
return -1;
67396736
}
67406737
p->u.board.pcislotstr = dgap_savestring(s);
6741-
p->u.board.pcislot = simple_strtoul(s, &s2, 0);
6742-
if ((int)strlen(s) > (int)(s2 - s)) {
6738+
if (kstrtoul(s, 0, &p->u.board.pcislot)) {
67436739
dgap_err("bad number for pci slot");
67446740
return -1;
67456741
}
@@ -6780,8 +6776,7 @@ static int dgap_parsefile(char **in, int Remove)
67806776
dgap_err("unexpected end of file");
67816777
return -1;
67826778
}
6783-
p->u.board.nport = (char)simple_strtol(s, &s2, 0);
6784-
if ((int)strlen(s) > (int)(s2 - s)) {
6779+
if (kstrtol(s, 0, &p->u.board.nport)) {
67856780
dgap_err("bad number for number of ports");
67866781
return -1;
67876782
}
@@ -6792,8 +6787,7 @@ static int dgap_parsefile(char **in, int Remove)
67926787
dgap_err("unexpected end of file");
67936788
return -1;
67946789
}
6795-
p->u.conc.nport = (char)simple_strtol(s, &s2, 0);
6796-
if ((int)strlen(s) > (int)(s2 - s)) {
6790+
if (kstrtol(s, 0, &p->u.conc.nport)) {
67976791
dgap_err("bad number for number of ports");
67986792
return -1;
67996793
}
@@ -6804,8 +6798,7 @@ static int dgap_parsefile(char **in, int Remove)
68046798
dgap_err("unexpected end of file");
68056799
return -1;
68066800
}
6807-
p->u.module.nport = (char)simple_strtol(s, &s2, 0);
6808-
if ((int)strlen(s) > (int)(s2 - s)) {
6801+
if (kstrtol(s, 0, &p->u.module.nport)) {
68096802
dgap_err("bad number for number of ports");
68106803
return -1;
68116804
}
@@ -6844,8 +6837,7 @@ static int dgap_parsefile(char **in, int Remove)
68446837
dgap_err("unexpected end of file");
68456838
return -1;
68466839
}
6847-
p->u.board.start = simple_strtol(s, &s2, 0);
6848-
if ((int)strlen(s) > (int)(s2 - s)) {
6840+
if (kstrtol(s, 0, &p->u.board.start)) {
68496841
dgap_err("bad number for start of tty count");
68506842
return -1;
68516843
}
@@ -6856,8 +6848,7 @@ static int dgap_parsefile(char **in, int Remove)
68566848
dgap_err("unexpected end of file");
68576849
return -1;
68586850
}
6859-
p->u.conc.start = simple_strtol(s, &s2, 0);
6860-
if ((int)strlen(s) > (int)(s2 - s)) {
6851+
if (kstrtol(s, 0, &p->u.conc.start)) {
68616852
dgap_err("bad number for start of tty count");
68626853
return -1;
68636854
}
@@ -6868,8 +6859,7 @@ static int dgap_parsefile(char **in, int Remove)
68686859
dgap_err("unexpected end of file");
68696860
return -1;
68706861
}
6871-
p->u.module.start = simple_strtol(s, &s2, 0);
6872-
if ((int)strlen(s) > (int)(s2 - s)) {
6862+
if (kstrtol(s, 0, &p->u.module.start)) {
68736863
dgap_err("bad number for start of tty count");
68746864
return -1;
68756865
}
@@ -7051,8 +7041,7 @@ static int dgap_parsefile(char **in, int Remove)
70517041
dgap_err("unexpected end of file");
70527042
return -1;
70537043
}
7054-
p->u.line.speed = (char)simple_strtol(s, &s2, 0);
7055-
if ((short)strlen(s) > (short)(s2 - s)) {
7044+
if (kstrtol(s, 0, &p->u.line.speed)) {
70567045
dgap_err("bad number for line speed");
70577046
return -1;
70587047
}
@@ -7063,8 +7052,7 @@ static int dgap_parsefile(char **in, int Remove)
70637052
dgap_err("unexpected end of file");
70647053
return -1;
70657054
}
7066-
p->u.conc.speed = (char)simple_strtol(s, &s2, 0);
7067-
if ((short)strlen(s) > (short)(s2 - s)) {
7055+
if (kstrtol(s, 0, &p->u.conc.speed)) {
70687056
dgap_err("bad number for line speed");
70697057
return -1;
70707058
}
@@ -7121,8 +7109,7 @@ static int dgap_parsefile(char **in, int Remove)
71217109
dgap_err("unexpected end of file");
71227110
return -1;
71237111
}
7124-
p->u.majornumber = simple_strtol(s, &s2, 0);
7125-
if ((int)strlen(s) > (int)(s2 - s)) {
7112+
if (kstrtol(s, 0, &p->u.majornumber)) {
71267113
dgap_err("bad number for major number");
71277114
return -1;
71287115
}
@@ -7142,8 +7129,7 @@ static int dgap_parsefile(char **in, int Remove)
71427129
dgap_err("unexpected end of file");
71437130
return -1;
71447131
}
7145-
p->u.altpin = simple_strtol(s, &s2, 0);
7146-
if ((int)strlen(s) > (int)(s2 - s)) {
7132+
if (kstrtol(s, 0, &p->u.altpin)) {
71477133
dgap_err("bad number for altpin");
71487134
return -1;
71497135
}
@@ -7163,8 +7149,7 @@ static int dgap_parsefile(char **in, int Remove)
71637149
dgap_err("unexpected end of file");
71647150
return -1;
71657151
}
7166-
p->u.useintr = simple_strtol(s, &s2, 0);
7167-
if ((int)strlen(s) > (int)(s2 - s)) {
7152+
if (kstrtol(s, 0, &p->u.useintr)) {
71687153
dgap_err("bad number for useintr");
71697154
return -1;
71707155
}
@@ -7184,8 +7169,7 @@ static int dgap_parsefile(char **in, int Remove)
71847169
dgap_err("unexpected end of file");
71857170
return -1;
71867171
}
7187-
p->u.ttysize = simple_strtol(s, &s2, 0);
7188-
if ((int)strlen(s) > (int)(s2 - s)) {
7172+
if (kstrtol(s, 0, &p->u.ttysize)) {
71897173
dgap_err("bad number for ttysize");
71907174
return -1;
71917175
}
@@ -7205,8 +7189,7 @@ static int dgap_parsefile(char **in, int Remove)
72057189
dgap_err("unexpected end of file");
72067190
return -1;
72077191
}
7208-
p->u.chsize = simple_strtol(s, &s2, 0);
7209-
if ((int)strlen(s) > (int)(s2 - s)) {
7192+
if (kstrtol(s, 0, &p->u.chsize)) {
72107193
dgap_err("bad number for chsize");
72117194
return -1;
72127195
}
@@ -7226,8 +7209,7 @@ static int dgap_parsefile(char **in, int Remove)
72267209
dgap_err("unexpected end of file");
72277210
return -1;
72287211
}
7229-
p->u.bssize = simple_strtol(s, &s2, 0);
7230-
if ((int)strlen(s) > (int)(s2 - s)) {
7212+
if (kstrtol(s, 0, &p->u.bssize)) {
72317213
dgap_err("bad number for bssize");
72327214
return -1;
72337215
}
@@ -7247,8 +7229,7 @@ static int dgap_parsefile(char **in, int Remove)
72477229
dgap_err("unexpected end of file");
72487230
return -1;
72497231
}
7250-
p->u.unsize = simple_strtol(s, &s2, 0);
7251-
if ((int)strlen(s) > (int)(s2 - s)) {
7232+
if (kstrtol(s, 0, &p->u.unsize)) {
72527233
dgap_err("bad number for schedsize");
72537234
return -1;
72547235
}
@@ -7268,8 +7249,7 @@ static int dgap_parsefile(char **in, int Remove)
72687249
dgap_err("unexpected end of file");
72697250
return -1;
72707251
}
7271-
p->u.f2size = simple_strtol(s, &s2, 0);
7272-
if ((int)strlen(s) > (int)(s2 - s)) {
7252+
if (kstrtol(s, 0, &p->u.f2size)) {
72737253
dgap_err("bad number for f2200size");
72747254
return -1;
72757255
}
@@ -7289,8 +7269,7 @@ static int dgap_parsefile(char **in, int Remove)
72897269
dgap_err("unexpected end of file");
72907270
return -1;
72917271
}
7292-
p->u.vpixsize = simple_strtol(s, &s2, 0);
7293-
if ((int)strlen(s) > (int)(s2 - s)) {
7272+
if (kstrtol(s, 0, &p->u.vpixsize)) {
72947273
dgap_err("bad number for vpixsize");
72957274
return -1;
72967275
}

‎drivers/staging/dgap/dgap.h‎

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,17 +1226,17 @@ struct cnode {
12261226
union {
12271227
struct {
12281228
char type; /* Board Type */
1229-
short port; /* I/O Address */
1229+
long port; /* I/O Address */
12301230
char *portstr; /* I/O Address in string */
12311231
long addr; /* Memory Address */
12321232
char *addrstr; /* Memory Address in string */
12331233
long pcibus; /* PCI BUS */
12341234
char *pcibusstr; /* PCI BUS in string */
12351235
long pcislot; /* PCI SLOT */
12361236
char *pcislotstr; /* PCI SLOT in string */
1237-
char nport; /* Number of Ports */
1237+
long nport; /* Number of Ports */
12381238
char *id; /* tty id */
1239-
int start; /* start of tty counting */
1239+
long start; /* start of tty counting */
12401240
char *method; /* Install method */
12411241
char v_type;
12421242
char v_port;
@@ -1261,18 +1261,18 @@ struct cnode {
12611261
struct {
12621262
char *cable;
12631263
char v_cable;
1264-
char speed;
1264+
long speed;
12651265
char v_speed;
12661266
} line;
12671267

12681268
struct {
12691269
char type;
12701270
char *connect;
1271-
char speed;
1272-
char nport;
1271+
long speed;
1272+
long nport;
12731273
char *id;
12741274
char *idstr;
1275-
int start;
1275+
long start;
12761276
char v_type;
12771277
char v_connect;
12781278
char v_speed;
@@ -1283,10 +1283,10 @@ struct cnode {
12831283

12841284
struct {
12851285
char type;
1286-
char nport;
1286+
long nport;
12871287
char *id;
12881288
char *idstr;
1289-
int start;
1289+
long start;
12901290
char v_type;
12911291
char v_nport;
12921292
char v_id;
@@ -1299,23 +1299,23 @@ struct cnode {
12991299

13001300
char *printname;
13011301

1302-
int majornumber;
1302+
long majornumber;
13031303

1304-
int altpin;
1304+
long altpin;
13051305

1306-
int ttysize;
1306+
long ttysize;
13071307

1308-
int chsize;
1308+
long chsize;
13091309

1310-
int bssize;
1310+
long bssize;
13111311

1312-
int unsize;
1312+
long unsize;
13131313

1314-
int f2size;
1314+
long f2size;
13151315

1316-
int vpixsize;
1316+
long vpixsize;
13171317

1318-
int useintr;
1318+
long useintr;
13191319
} u;
13201320
};
13211321

0 commit comments

Comments
 (0)