Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Mark Hounschell and committed by
Greg Kroah-Hartman
67d5dc8a 65fbed37

+42 -63
+24 -45
drivers/staging/dgap/dgap.c
··· 6462 6462 if (cn != (i + ncount)) 6463 6463 continue; 6464 6464 6465 - return snprintf(buf, PAGE_SIZE, "%s%s%02d\n", 6465 + return snprintf(buf, PAGE_SIZE, "%s%s%02ld\n", 6466 6466 (un->un_type == DGAP_PRINT) ? 6467 6467 "pr" : "tty", 6468 6468 cptr->u.conc.id, ··· 6479 6479 if (cn != (i + ncount)) 6480 6480 continue; 6481 6481 6482 - return snprintf(buf, PAGE_SIZE, "%s%s%02d\n", 6482 + return snprintf(buf, PAGE_SIZE, "%s%s%02ld\n", 6483 6483 (un->un_type == DGAP_PRINT) ? 6484 6484 "pr" : "tty", 6485 6485 cptr->u.module.id, ··· 6542 6542 { 6543 6543 struct cnode *p, *brd, *line, *conc; 6544 6544 int rc; 6545 - char *s = NULL, *s2 = NULL; 6545 + char *s = NULL; 6546 6546 int linecnt = 0; 6547 6547 6548 6548 p = &dgap_head; ··· 6688 6688 return -1; 6689 6689 } 6690 6690 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)) { 6693 6692 dgap_err("bad number for IO port"); 6694 6693 return -1; 6695 6694 } ··· 6706 6707 return -1; 6707 6708 } 6708 6709 p->u.board.addrstr = dgap_savestring(s); 6709 - p->u.board.addr = simple_strtoul(s, &s2, 0); 6710 - if ((int)strlen(s) > (int)(s2 - s)) { 6710 + if (kstrtoul(s, 0, &p->u.board.addr)) { 6711 6711 dgap_err("bad number for memory address"); 6712 6712 return -1; 6713 6713 } ··· 6724 6726 return -1; 6725 6727 } 6726 6728 p->u.board.pcibusstr = dgap_savestring(s); 6727 - p->u.board.pcibus = simple_strtoul(s, &s2, 0); 6728 - if ((int)strlen(s) > (int)(s2 - s)) { 6729 + if (kstrtoul(s, 0, &p->u.board.pcibus)) { 6729 6730 dgap_err("bad number for pci bus"); 6730 6731 return -1; 6731 6732 } ··· 6735 6738 return -1; 6736 6739 } 6737 6740 p->u.board.pcislotstr = dgap_savestring(s); 6738 - p->u.board.pcislot = simple_strtoul(s, &s2, 0); 6739 - if ((int)strlen(s) > (int)(s2 - s)) { 6741 + if (kstrtoul(s, 0, &p->u.board.pcislot)) { 6740 6742 dgap_err("bad number for pci slot"); 6741 6743 return -1; 6742 6744 } ··· 6776 6780 dgap_err("unexpected end of file"); 6777 6781 return -1; 6778 6782 } 6779 - p->u.board.nport = (char)simple_strtol(s, &s2, 0); 6780 - if ((int)strlen(s) > (int)(s2 - s)) { 6783 + if (kstrtol(s, 0, &p->u.board.nport)) { 6781 6784 dgap_err("bad number for number of ports"); 6782 6785 return -1; 6783 6786 } ··· 6787 6792 dgap_err("unexpected end of file"); 6788 6793 return -1; 6789 6794 } 6790 - p->u.conc.nport = (char)simple_strtol(s, &s2, 0); 6791 - if ((int)strlen(s) > (int)(s2 - s)) { 6795 + if (kstrtol(s, 0, &p->u.conc.nport)) { 6792 6796 dgap_err("bad number for number of ports"); 6793 6797 return -1; 6794 6798 } ··· 6798 6804 dgap_err("unexpected end of file"); 6799 6805 return -1; 6800 6806 } 6801 - p->u.module.nport = (char)simple_strtol(s, &s2, 0); 6802 - if ((int)strlen(s) > (int)(s2 - s)) { 6807 + if (kstrtol(s, 0, &p->u.module.nport)) { 6803 6808 dgap_err("bad number for number of ports"); 6804 6809 return -1; 6805 6810 } ··· 6837 6844 dgap_err("unexpected end of file"); 6838 6845 return -1; 6839 6846 } 6840 - p->u.board.start = simple_strtol(s, &s2, 0); 6841 - if ((int)strlen(s) > (int)(s2 - s)) { 6847 + if (kstrtol(s, 0, &p->u.board.start)) { 6842 6848 dgap_err("bad number for start of tty count"); 6843 6849 return -1; 6844 6850 } ··· 6848 6856 dgap_err("unexpected end of file"); 6849 6857 return -1; 6850 6858 } 6851 - p->u.conc.start = simple_strtol(s, &s2, 0); 6852 - if ((int)strlen(s) > (int)(s2 - s)) { 6859 + if (kstrtol(s, 0, &p->u.conc.start)) { 6853 6860 dgap_err("bad number for start of tty count"); 6854 6861 return -1; 6855 6862 } ··· 6859 6868 dgap_err("unexpected end of file"); 6860 6869 return -1; 6861 6870 } 6862 - p->u.module.start = simple_strtol(s, &s2, 0); 6863 - if ((int)strlen(s) > (int)(s2 - s)) { 6871 + if (kstrtol(s, 0, &p->u.module.start)) { 6864 6872 dgap_err("bad number for start of tty count"); 6865 6873 return -1; 6866 6874 } ··· 7041 7051 dgap_err("unexpected end of file"); 7042 7052 return -1; 7043 7053 } 7044 - p->u.line.speed = (char)simple_strtol(s, &s2, 0); 7045 - if ((short)strlen(s) > (short)(s2 - s)) { 7054 + if (kstrtol(s, 0, &p->u.line.speed)) { 7046 7055 dgap_err("bad number for line speed"); 7047 7056 return -1; 7048 7057 } ··· 7052 7063 dgap_err("unexpected end of file"); 7053 7064 return -1; 7054 7065 } 7055 - p->u.conc.speed = (char)simple_strtol(s, &s2, 0); 7056 - if ((short)strlen(s) > (short)(s2 - s)) { 7066 + if (kstrtol(s, 0, &p->u.conc.speed)) { 7057 7067 dgap_err("bad number for line speed"); 7058 7068 return -1; 7059 7069 } ··· 7109 7121 dgap_err("unexpected end of file"); 7110 7122 return -1; 7111 7123 } 7112 - p->u.majornumber = simple_strtol(s, &s2, 0); 7113 - if ((int)strlen(s) > (int)(s2 - s)) { 7124 + if (kstrtol(s, 0, &p->u.majornumber)) { 7114 7125 dgap_err("bad number for major number"); 7115 7126 return -1; 7116 7127 } ··· 7129 7142 dgap_err("unexpected end of file"); 7130 7143 return -1; 7131 7144 } 7132 - p->u.altpin = simple_strtol(s, &s2, 0); 7133 - if ((int)strlen(s) > (int)(s2 - s)) { 7145 + if (kstrtol(s, 0, &p->u.altpin)) { 7134 7146 dgap_err("bad number for altpin"); 7135 7147 return -1; 7136 7148 } ··· 7149 7163 dgap_err("unexpected end of file"); 7150 7164 return -1; 7151 7165 } 7152 - p->u.useintr = simple_strtol(s, &s2, 0); 7153 - if ((int)strlen(s) > (int)(s2 - s)) { 7166 + if (kstrtol(s, 0, &p->u.useintr)) { 7154 7167 dgap_err("bad number for useintr"); 7155 7168 return -1; 7156 7169 } ··· 7169 7184 dgap_err("unexpected end of file"); 7170 7185 return -1; 7171 7186 } 7172 - p->u.ttysize = simple_strtol(s, &s2, 0); 7173 - if ((int)strlen(s) > (int)(s2 - s)) { 7187 + if (kstrtol(s, 0, &p->u.ttysize)) { 7174 7188 dgap_err("bad number for ttysize"); 7175 7189 return -1; 7176 7190 } ··· 7189 7205 dgap_err("unexpected end of file"); 7190 7206 return -1; 7191 7207 } 7192 - p->u.chsize = simple_strtol(s, &s2, 0); 7193 - if ((int)strlen(s) > (int)(s2 - s)) { 7208 + if (kstrtol(s, 0, &p->u.chsize)) { 7194 7209 dgap_err("bad number for chsize"); 7195 7210 return -1; 7196 7211 } ··· 7209 7226 dgap_err("unexpected end of file"); 7210 7227 return -1; 7211 7228 } 7212 - p->u.bssize = simple_strtol(s, &s2, 0); 7213 - if ((int)strlen(s) > (int)(s2 - s)) { 7229 + if (kstrtol(s, 0, &p->u.bssize)) { 7214 7230 dgap_err("bad number for bssize"); 7215 7231 return -1; 7216 7232 } ··· 7229 7247 dgap_err("unexpected end of file"); 7230 7248 return -1; 7231 7249 } 7232 - p->u.unsize = simple_strtol(s, &s2, 0); 7233 - if ((int)strlen(s) > (int)(s2 - s)) { 7250 + if (kstrtol(s, 0, &p->u.unsize)) { 7234 7251 dgap_err("bad number for schedsize"); 7235 7252 return -1; 7236 7253 } ··· 7249 7268 dgap_err("unexpected end of file"); 7250 7269 return -1; 7251 7270 } 7252 - p->u.f2size = simple_strtol(s, &s2, 0); 7253 - if ((int)strlen(s) > (int)(s2 - s)) { 7271 + if (kstrtol(s, 0, &p->u.f2size)) { 7254 7272 dgap_err("bad number for f2200size"); 7255 7273 return -1; 7256 7274 } ··· 7269 7289 dgap_err("unexpected end of file"); 7270 7290 return -1; 7271 7291 } 7272 - p->u.vpixsize = simple_strtol(s, &s2, 0); 7273 - if ((int)strlen(s) > (int)(s2 - s)) { 7292 + if (kstrtol(s, 0, &p->u.vpixsize)) { 7274 7293 dgap_err("bad number for vpixsize"); 7275 7294 return -1; 7276 7295 }
+18 -18
drivers/staging/dgap/dgap.h
··· 1226 1226 union { 1227 1227 struct { 1228 1228 char type; /* Board Type */ 1229 - short port; /* I/O Address */ 1229 + long port; /* I/O Address */ 1230 1230 char *portstr; /* I/O Address in string */ 1231 1231 long addr; /* Memory Address */ 1232 1232 char *addrstr; /* Memory Address in string */ ··· 1234 1234 char *pcibusstr; /* PCI BUS in string */ 1235 1235 long pcislot; /* PCI SLOT */ 1236 1236 char *pcislotstr; /* PCI SLOT in string */ 1237 - char nport; /* Number of Ports */ 1237 + long nport; /* Number of Ports */ 1238 1238 char *id; /* tty id */ 1239 - int start; /* start of tty counting */ 1239 + long start; /* start of tty counting */ 1240 1240 char *method; /* Install method */ 1241 1241 char v_type; 1242 1242 char v_port; ··· 1261 1261 struct { 1262 1262 char *cable; 1263 1263 char v_cable; 1264 - char speed; 1264 + long speed; 1265 1265 char v_speed; 1266 1266 } line; 1267 1267 1268 1268 struct { 1269 1269 char type; 1270 1270 char *connect; 1271 - char speed; 1272 - char nport; 1271 + long speed; 1272 + long nport; 1273 1273 char *id; 1274 1274 char *idstr; 1275 - int start; 1275 + long start; 1276 1276 char v_type; 1277 1277 char v_connect; 1278 1278 char v_speed; ··· 1283 1283 1284 1284 struct { 1285 1285 char type; 1286 - char nport; 1286 + long nport; 1287 1287 char *id; 1288 1288 char *idstr; 1289 - int start; 1289 + long start; 1290 1290 char v_type; 1291 1291 char v_nport; 1292 1292 char v_id; ··· 1299 1299 1300 1300 char *printname; 1301 1301 1302 - int majornumber; 1302 + long majornumber; 1303 1303 1304 - int altpin; 1304 + long altpin; 1305 1305 1306 - int ttysize; 1306 + long ttysize; 1307 1307 1308 - int chsize; 1308 + long chsize; 1309 1309 1310 - int bssize; 1310 + long bssize; 1311 1311 1312 - int unsize; 1312 + long unsize; 1313 1313 1314 - int f2size; 1314 + long f2size; 1315 1315 1316 - int vpixsize; 1316 + long vpixsize; 1317 1317 1318 - int useintr; 1318 + long useintr; 1319 1319 } u; 1320 1320 }; 1321 1321