All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: media: parport: Convert simple_strtoul to kstrtoul
@ 2015-02-19 16:30 Navya Sri Nizamkari
  2015-02-19 16:40 ` [Outreachy kernel] " Julia Lawall
  0 siblings, 1 reply; 6+ messages in thread
From: Navya Sri Nizamkari @ 2015-02-19 16:30 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Navya Sri Nizamkari

This patch fixes the following checkpatch.pl warning:

WARNING: simple_strtoul is obsolete, use kstrtoul instead

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
---
 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



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Outreachy kernel] [PATCH] staging: media: parport: Convert simple_strtoul to kstrtoul
  2015-02-19 16:30 [PATCH] staging: media: parport: Convert simple_strtoul to kstrtoul Navya Sri Nizamkari
@ 2015-02-19 16:40 ` Julia Lawall
  2015-02-19 16:43   ` navya sri nizamkari
  0 siblings, 1 reply; 6+ messages in thread
From: Julia Lawall @ 2015-02-19 16:40 UTC (permalink / raw)
  To: Navya Sri Nizamkari; +Cc: outreachy-kernel

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 <navyasri.tech@gmail.com>
> ---
>  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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> 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.
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Outreachy kernel] [PATCH] staging: media: parport: Convert simple_strtoul to kstrtoul
  2015-02-19 16:40 ` [Outreachy kernel] " Julia Lawall
@ 2015-02-19 16:43   ` navya sri nizamkari
  2015-02-19 16:48     ` Julia Lawall
  0 siblings, 1 reply; 6+ messages in thread
From: navya sri nizamkari @ 2015-02-19 16:43 UTC (permalink / raw)
  To: Julia Lawall; +Cc: outreachy-kernel

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.
On Thu, Feb 19, 2015 at 10:10 PM, Julia Lawall <julia.lawall@lip6.fr> 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 <navyasri.tech@gmail.com>
>> ---
>>  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 outreachy-kernel+unsubscribe@googlegroups.com.
>> To post to this group, send email to outreachy-kernel@googlegroups.com.
>> 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.
>>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Outreachy kernel] [PATCH] staging: media: parport: Convert simple_strtoul to kstrtoul
  2015-02-19 16:43   ` navya sri nizamkari
@ 2015-02-19 16:48     ` Julia Lawall
  2015-02-19 17:14       ` Navya Sri Nizamkari
  0 siblings, 1 reply; 6+ messages in thread
From: Julia Lawall @ 2015-02-19 16:48 UTC (permalink / raw)
  To: navya sri nizamkari; +Cc: outreachy-kernel



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 <julia.lawall@lip6.fr> 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 <navyasri.tech@gmail.com>
> >> ---
> >>  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 outreachy-kernel+unsubscribe@googlegroups.com.
> >> To post to this group, send email to outreachy-kernel@googlegroups.com.
> >> 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.
> >>
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Outreachy kernel] [PATCH] staging: media: parport: Convert simple_strtoul to kstrtoul
  2015-02-19 16:48     ` Julia Lawall
@ 2015-02-19 17:14       ` Navya Sri Nizamkari
  2015-02-19 17:22         ` Julia Lawall
  0 siblings, 1 reply; 6+ messages in thread
From: Navya Sri Nizamkari @ 2015-02-19 17:14 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: navyasri.tech


[-- Attachment #1.1: Type: text/plain, Size: 3314 bytes --]

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?

On Thursday, February 19, 2015 at 10:17:06 PM UTC+5:30, Julia Lawall wrote:
>
>
>
> 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 <julia....@lip6.fr 
> <javascript:>> 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 <navyas...@gmail.com <javascript:>> 
>
> > >> --- 
> > >>  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 outreachy-kern...@googlegroups.com <javascript:>. 
> > >> To post to this group, send email to outreach...@googlegroups.com 
> <javascript:>. 
> > >> 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. 
> > >> 
> > 
>

[-- Attachment #1.2: Type: text/html, Size: 5258 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Outreachy kernel] [PATCH] staging: media: parport: Convert simple_strtoul to kstrtoul
  2015-02-19 17:14       ` Navya Sri Nizamkari
@ 2015-02-19 17:22         ` Julia Lawall
  0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2015-02-19 17:22 UTC (permalink / raw)
  To: Navya Sri Nizamkari; +Cc: outreachy-kernel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 4470 bytes --]

On Thu, 19 Feb 2015, Navya Sri Nizamkari wrote:

> 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

> On Thursday, February 19, 2015 at 10:17:06 PM UTC+5:30, Julia Lawall wrote:
>
>
>       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
>       <julia....@lip6.fr> 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 <navyas...@gmail.com>
>       > >> ---
>       > >>  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 outreachy-kern...@googlegroups.com.
>       > >> To post to this group, send email to
>       outreach...@googlegroups.com.
>       > >> 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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> 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.
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-02-19 17:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-19 16:30 [PATCH] staging: media: parport: Convert simple_strtoul to kstrtoul Navya Sri Nizamkari
2015-02-19 16:40 ` [Outreachy kernel] " Julia Lawall
2015-02-19 16:43   ` navya sri nizamkari
2015-02-19 16:48     ` Julia Lawall
2015-02-19 17:14       ` Navya Sri Nizamkari
2015-02-19 17:22         ` Julia Lawall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.