Convert simple_strtoul to kstrtoul
Subsystems (2)
PATCH v2 1/1 Convert simple_strtoul to kstrtoul
This patch fixes the checkpatch.pl warning:simple_strtoul is obsolete, use kstrtoul instead.
When the string is not converted(parsing error),the strings pointed to by ep and parport[n] are the same.This parsing error results in kstrtoul returning a non-zero value.
---
Changes in v2:
-Added a descriptive commit message.
drivers/staging/media/parport/bw-qcam.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/media/parport/bw-qcam.c +1 -3
@@ -1106,10 +1106,8 @@ static int accept_bwqcam(struct parport *port)if (parport[0 ] &&strncmp (parport[0 ],"auto" ,4 ) !=0 ) {/* user gave parport parameters */ for (n =0 ; n <MAX_CAMS && parport[n]; n++) { -char *ep;unsigned long r; - r =simple_strtoul (parport[n], &ep,0 ); -if (ep == parport[n]) { +if (kstrtoul (parport[n],0 ,&r)) {printk (KERN_ERR "bw-qcam: bad port specifier \"%s\"\n" , parport[n]);
Signature · 1 line
1.9.1
Hi Navya,
Thank you for the patch.
Quoted 20 lines · On Thursday 19 February 2015 23:04:59 Navya Sri Nizamkari wrote:
This patch fixes the checkpatch.pl warning:
simple_strtoulis obsolete, use kstrtoul instead.When the string is not converted(parsing error),the strings pointed to by ep and parport[n] are the same.This parsing error results in kstrtoul returning a non-zero value.
Signed-off-by Navya Sri Nizamkari <[email protected]>---
Changes in v2:
-Added a descriptive commit message.drivers/staging/media/parport/bw-qcam.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)(quoted diff) +0
-0
b/drivers/staging/media/parport/bw-qcam.cindex 67b9da1..1b81244 100644
drivers/staging/media/parport/bw-qcam.c static int accept_bwqcam(struct parport *port) · line 1110
Quoted 8 lines
drivers/staging/media/parport/bw-qcam.c +1
-3@@ -1106,10 +1106,8 @@ static int accept_bwqcam(struct parport *port)if (parport[0 ] &&strncmp (parport[0 ],"auto" ,4 ) !=0 ) {/* user gave parport parameters */ for (n =0 ; n <MAX_CAMS && parport[n]; n++) { -char *ep;unsigned long r; - r =simple_strtoul (parport[n], &ep,0 ); -if (ep == parport[n]) { +if (kstrtoul (parport[n],0 ,&r)) {
It's nice to fix checkpatch warnings, but not if you introduce new ones. If you run checkpatch on your patch you should get warnings regarding missing spaces after commas. As a general rule, you should always run checkpatch on all patches you want to submit for review before sending them to mailing lists.
Quoted 3 lines
drivers/staging/media/parport/bw-qcam.c +0
-0printk (KERN_ERR "bw-qcam: bad port specifier \"%s\"\n" , parport[n]);
Signature · 3 lines
Regards, Laurent Pinchart
I'll send in another patch. I'm not sure if I changed anything in the printk error message.
Thanks,
Navya
Quoted 49 lines · Laurent Pinchart
Hi Navya,
Thank you for the patch.
Quoted 20 lines · On Thursday 19 February 2015 23:04:59 Navya Sri Nizamkari wrote:
This patch fixes the checkpatch.pl warning:
simple_strtoulis obsolete, use kstrtoul instead.When the string is not converted(parsing error),the strings pointed to by ep and parport[n] are the same.This parsing error results in kstrtoul returning a non-zero value.
Signed-off-by Navya Sri Nizamkari <[email protected]>---
Changes in v2:
-Added a descriptive commit message.drivers/staging/media/parport/bw-qcam.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)(quoted diff) +0
-0
b/drivers/staging/media/parport/bw-qcam.cindex 67b9da1..1b81244 100644drivers/staging/media/parport/bw-qcam.c static int accept_bwqcam(struct parport *port) · line 1110
Quoted 8 lines
drivers/staging/media/parport/bw-qcam.c +1
-3@@ -1106,10 +1106,8 @@ static int accept_bwqcam(struct parport *port)if (parport[0 ] &&strncmp (parport[0 ],"auto" ,4 ) !=0 ) {/* user gave parport parameters */ for (n =0 ; n <MAX_CAMS && parport[n]; n++) { -char *ep;unsigned long r; - r =simple_strtoul (parport[n], &ep,0 ); -if (ep == parport[n]) { +if (kstrtoul (parport[n],0 ,&r)) {It's nice to fix checkpatch warnings, but not if you introduce new ones. If you run checkpatch on your patch you should get warnings regarding missing spaces after commas. As a general rule, you should always run checkpatch on all patches you want to submit for review before sending them to mailing lists.
drivers/staging/media/parport/bw-qcam.c static int accept_bwqcam(struct parport *port) · line 1113
Quoted 3 lines
drivers/staging/media/parport/bw-qcam.c +0
-0printk (KERN_ERR "bw-qcam: bad port specifier \"%s\"\n" , parport[n]);--
Regards,Laurent Pinchart