staging: media: parport: Convert simple_strtoul to kstrtoul
Subsystems (2)
PATCH 1/1 staging: media: parport: Convert simple_strtoul to kstrtoul
This patch fixes the following checkpatch.pl warning:
WARNING: simple_strtoul is obsolete, use kstrtoul instead
--- 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
Quoted 3 lines · Navya Sri Nizamkari
This patch fixes the following checkpatch.pl warning:
WARNING:
simple_strtoulis obsolete, use kstrtoul instead
simple_strtoul and kstrtoul don't have the same functionality. You have to argue carefully why this change is correct. That is, under what circumstances does simple_strtoul end up with the value in its second argument being the same as its first argument, and under what circumstances does kstrtoul give a non zero result.
julia
Quoted 31 lines
Signed-off-by Navya Sri Nizamkari <[email protected]>--- drivers/staging/media/parport/bw-qcam.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/staging/media/parport/bw-qcam.c +1
-4@@ -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]); --1.9.1
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1424363402-10346-1-git-send-email-navyasri.tech%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
When the conversion is not successful the final string (whose pointer is ep) and the initial string are the same(a parsing error).kstrtoul returns a non-zero value for parsing and overflow errors.Maybe I should add an addtional check for the return value of kstrtoul to be EINVAL.
Quoted 45 lines · Julia Lawall
Quoted 3 lines · Navya Sri Nizamkari
This patch fixes the following checkpatch.pl warning:
WARNING:
simple_strtoulis obsolete, use kstrtoul instead
simple_strtouland kstrtoul don't have the same functionality. You have to argue carefully why this change is correct. That is, under what circumstances doessimple_strtoulend up with the value in its second argument being the same as its first argument, and under what circumstances does kstrtoul give a non zero result.julia
Quoted 31 lines
Signed-off-by Navya Sri Nizamkari <[email protected]>--- drivers/staging/media/parport/bw-qcam.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/staging/media/parport/bw-qcam.c +1
-4@@ -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]); --1.9.1
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1424363402-10346-1-git-send-email-navyasri.tech%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Quoted 5 lines · navya sri nizamkari
When the conversion is not successful the final string (whose pointer is ep) and the initial string are the same(a parsing error).kstrtoul returns a non-zero value for parsing and overflow errors.Maybe I should add an addtional check for the return value of kstrtoul to be EINVAL.
Probably if it fails for any reason, then you should skip the current value. This explanation should be part of the commit message of the patch.
julia
Quoted 47 lines · Julia Lawall
Quoted 45 lines · Navya Sri Nizamkari
Quoted 4 lines
This patch fixes the following checkpatch.pl warning:
WARNING:
simple_strtoulis obsolete, use kstrtoul instead
simple_strtouland kstrtoul don't have the same functionality. You have to argue carefully why this change is correct. That is, under what circumstances doessimple_strtoulend up with the value in its second argument being the same as its first argument, and under what circumstances does kstrtoul give a non zero result.julia
Quoted 31 lines
Signed-off-by Navya Sri Nizamkari <[email protected]>--- drivers/staging/media/parport/bw-qcam.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/staging/media/parport/bw-qcam.c +1
-4@@ -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]); --1.9.1
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1424363402-10346-1-git-send-email-navyasri.tech%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
I didn't understand the part where you said 'Probably if it fails for any reason, then you should skip the current value.'Could you explain it to me?
Quoted 76 lines · Julia Lawall
Quoted 5 lines · navya sri nizamkari
When the conversion is not successful the final string (whose pointer is ep) and the initial string are the same(a parsing error).kstrtoul returns a non-zero value for parsing and overflow errors.Maybe I should add an addtional check for the return value of kstrtoul to be EINVAL.
Probably if it fails for any reason, then you should skip the current value. This explanation should be part of the commit message of the patch.
julia
Quoted 1 line
On Thu, Feb 19, 2015 at 10:10 PM, Julia Lawall <[email protected]
Quoted 7 lines · <javascript:>> wrote:
Quoted 7 lines · Navya Sri Nizamkari
Quoted 4 lines
This patch fixes the following checkpatch.pl warning:
WARNING:
simple_strtoulis obsolete, use kstrtoul instead
simple_strtouland kstrtoul don't have the same functionality. Youhave
Quoted 7 lines
Quoted 7 lines
to argue carefully why this change is correct. That is, under what circumstances does
simple_strtoulend up with the value in its second argument being the same as its first argument, and under what circumstances does kstrtoul give a non zero result.julia
Quoted 7 lines
Quoted 7 lines
Review
Quoted 7 lines
Signed-off-by Navya Sri Nizamkari <[email protected] <javascript:>>---
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.cQuoted 6 lines
Quoted 6 lines
Quoted 6 lines
index 67b9da1..1b81244 100644
drivers/staging/media/parport/bw-qcam.c +0
-0@@ -1106,10 +1106,8 @@ static int accept_bwqcam(struct parport *port)if (parport[0 ] &&strncmp (parport[0 ],"auto" ,4 ) !=0 ) {/* user gave parport parameters */ Quoted 8 lines
Quoted 8 lines
drivers/staging/media/parport/bw-qcam.c static int accept_bwqcam(struct parport *port)
Quoted 8 lines
drivers/staging/media/parport/bw-qcam.c +1
-3for (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",
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/staging/media/parport/bw-qcam.c +0
-0parport[n]);Signature · 4 lines
1.9.1 -- You received this message because you are subscribed to the GoogleGroups "outreachy-kernel" group.
Quoted 1 line
Quoted 1 line
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it,
send an email to [email protected] <javascript:>.
Quoted 1 line
Quoted 1 line
Quoted 1 line
To post to this group, send email to [email protected]
<javascript:>.
Quoted 1 line
Quoted 1 line
Quoted 1 line
To view this discussion on the web visit
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
For more options, visit https://groups.google.com/d/optout.
Quoted 2 lines · Navya Sri Nizamkari
I didn't understand the part where you said 'Probably if it fails for any reason, then you should skip the current value.'Could you explain it to me?
You were concerned about the overflow reason for failure.
julia
Quoted 99 lines · Julia Lawall
On Thu, 19 Feb 2015, navya sri nizamkari wrote: > When the conversion is not successful the final string (whose pointer > is ep) and the initial string are the same(a parsing error).kstrtoul > returns a non-zero value for parsing and overflow errors.Maybe I > should add an addtional check for the return value of kstrtoul to be > EINVAL. Probably if it fails for any reason, then you should skip the current value. This explanation should be part of the commit message of the patch. julia > On Thu, Feb 19, 2015 at 10:10 PM, Julia Lawall <[email protected]> wrote: > > On Thu, 19 Feb 2015, Navya Sri Nizamkari wrote: > > > >> This patch fixes the following checkpatch.pl warning: > >> > >> WARNING: simple_strtoul is obsolete, use kstrtoul instead > > > > simple_strtoul and kstrtoul don't have the same functionality. You have > > to argue carefully why this change is correct. That is, under what > > circumstances does simple_strtoul end up with the value in its second > > argument being the same as its first argument, and under what > > circumstances does kstrtoul give a non zero result. > > > > julia > > > >> Signed-off-by: Navya Sri Nizamkari <[email protected]> > >> --- > >> drivers/staging/media/parport/bw-qcam.c | 4 +--- > >> 1 file changed, 1 insertion(+), 3 deletions(-) > >> > >> diff --git a/drivers/staging/media/parport/bw-qcam.c b/drivers/staging/media/parport/bw-qcam.c > >> index 67b9da1..1b81244 100644 > >> --- a/drivers/staging/media/parport/bw-qcam.c > >> +++ b/drivers/staging/media/parport/bw-qcam.c > >> @@ -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]); > >> -- > >> 1.9.1 > >> > >> -- > >> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. > >> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. > >> To post to this group, send email to [email protected]. > >> To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/1424363402-10346-1-git- send-email-navyasri.tech%40gmail.com. > >> For more options, visit https://groups.google.com/d/optout. > >> >--
You received this message because you are subscribed to the Google Groups
"outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/9e53858e-81ab-4822-ad2c -73cde876ec19%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.