All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] Convert simple_strtoul to kstrtoul
@ 2015-02-19 18:11 Navya Sri Nizamkari
  2015-02-20  9:55 ` Navya Sri Nizamkari
  2015-02-20 10:58 ` [Outreachy kernel] " Preeti U Murthy
  0 siblings, 2 replies; 7+ messages in thread
From: Navya Sri Nizamkari @ 2015-02-19 18:11 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Navya Sri Nizamkari

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.

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
---
Changes in v3:
   -Removed few changes made in previous commit which were introducing new checkpatch.pl warnings.

 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..6c9b400 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] 7+ messages in thread

* Re: [PATCH v3] Convert simple_strtoul to kstrtoul
  2015-02-19 18:11 [PATCH v3] Convert simple_strtoul to kstrtoul Navya Sri Nizamkari
@ 2015-02-20  9:55 ` Navya Sri Nizamkari
  2015-02-20 17:37   ` [Outreachy kernel] " Julia Lawall
  2015-02-20 10:58 ` [Outreachy kernel] " Preeti U Murthy
  1 sibling, 1 reply; 7+ messages in thread
From: Navya Sri Nizamkari @ 2015-02-20  9:55 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: navyasri.tech


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

Hi,
  Is this patch alright? Now, there are now additional warnings introduced 
by  the change I made.

On Thursday, February 19, 2015 at 11:40:18 PM UTC+5:30, Navya Sri Nizamkari 
wrote:
>
> 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. 
>
> Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com> 
> --- 
> Changes in v3: 
>    -Removed few changes made in previous commit which were introducing new 
> checkpatch.pl warnings. 
>
>  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..6c9b400 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 
>
>

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

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

* Re: [Outreachy kernel] [PATCH v3] Convert simple_strtoul to kstrtoul
  2015-02-19 18:11 [PATCH v3] Convert simple_strtoul to kstrtoul Navya Sri Nizamkari
  2015-02-20  9:55 ` Navya Sri Nizamkari
@ 2015-02-20 10:58 ` Preeti U Murthy
  2015-02-20 15:44   ` navya sri nizamkari
  1 sibling, 1 reply; 7+ messages in thread
From: Preeti U Murthy @ 2015-02-20 10:58 UTC (permalink / raw)
  To: Navya Sri Nizamkari, outreachy-kernel

Hi Navya,

On 02/19/2015 11:41 PM, Navya Sri Nizamkari wrote:
> 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.

When you write changelogs restrict the length of the line to 80
characters, so that the patch looks uniformly aligned throughout.

On another note, the patch is fixing an issue that is not specific to ep
and parport[n]. It looks at replacing strtoul() with kstrtoul() in
places where there are checks for parsing error in string parsing.
Make the explanation more generic because its not specific to this file.
Ideally if any one else finds such a usage elsewhere, they can change it
the same way. Hence under such circumstances avoid using file specific
parameters in the changelog.

And try to link the usage of strtoul() with kstrtoul(); you replace
strtoul() with kstrtoul() in the error handling part here because both
check for similar errors while parsing strings. Ideally kstrtoul() error
check should be a superset of strtoul(). Else this patch would have been
wrong.

But hold onto these points for a similar cleanup on another driver. See
below.

> 
> Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
> ---
> Changes in v3:
>    -Removed few changes made in previous commit which were introducing new checkpatch.pl warnings.
> 
>  drivers/staging/media/parport/bw-qcam.c | 4 +---

Refer to the mail that Arnd sent out. He has listed the drivers that are
not in mainline. So avoid sending patches against the following drivers,
since they will soon be removed from staging-next as well.

drivers/staging/line6/ (moved to sound/usb)
drivers/staging/media/parport/
drivers/staging/media/tlg2300/
drivers/staging/media/vino/

Regards
Preeti U Murthy

>  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..6c9b400 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]);
> 



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

* Re: [Outreachy kernel] [PATCH v3] Convert simple_strtoul to kstrtoul
  2015-02-20 10:58 ` [Outreachy kernel] " Preeti U Murthy
@ 2015-02-20 15:44   ` navya sri nizamkari
  0 siblings, 0 replies; 7+ messages in thread
From: navya sri nizamkari @ 2015-02-20 15:44 UTC (permalink / raw)
  To: Preeti U Murthy; +Cc: outreachy-kernel

Hi,
I've made changes according to your feedback and sent in another
patch. Is i2o going to be removed too?
Thanks,
Navya.

On Fri, Feb 20, 2015 at 4:28 PM, Preeti U Murthy
<preeti@linux.vnet.ibm.com> wrote:
> Hi Navya,
>
> On 02/19/2015 11:41 PM, Navya Sri Nizamkari wrote:
>> 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.
>
> When you write changelogs restrict the length of the line to 80
> characters, so that the patch looks uniformly aligned throughout.
>
> On another note, the patch is fixing an issue that is not specific to ep
> and parport[n]. It looks at replacing strtoul() with kstrtoul() in
> places where there are checks for parsing error in string parsing.
> Make the explanation more generic because its not specific to this file.
> Ideally if any one else finds such a usage elsewhere, they can change it
> the same way. Hence under such circumstances avoid using file specific
> parameters in the changelog.
>
> And try to link the usage of strtoul() with kstrtoul(); you replace
> strtoul() with kstrtoul() in the error handling part here because both
> check for similar errors while parsing strings. Ideally kstrtoul() error
> check should be a superset of strtoul(). Else this patch would have been
> wrong.
>
> But hold onto these points for a similar cleanup on another driver. See
> below.
>
>>
>> Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
>> ---
>> Changes in v3:
>>    -Removed few changes made in previous commit which were introducing new checkpatch.pl warnings.
>>
>>  drivers/staging/media/parport/bw-qcam.c | 4 +---
>
> Refer to the mail that Arnd sent out. He has listed the drivers that are
> not in mainline. So avoid sending patches against the following drivers,
> since they will soon be removed from staging-next as well.
>
> drivers/staging/line6/ (moved to sound/usb)
> drivers/staging/media/parport/
> drivers/staging/media/tlg2300/
> drivers/staging/media/vino/
>
> Regards
> Preeti U Murthy
>
>>  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..6c9b400 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]);
>>
>


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

* Re: [Outreachy kernel] Re: [PATCH v3] Convert simple_strtoul to kstrtoul
  2015-02-20  9:55 ` Navya Sri Nizamkari
@ 2015-02-20 17:37   ` Julia Lawall
  2015-02-20 18:09     ` Navya Sri Nizamkari
  0 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2015-02-20 17:37 UTC (permalink / raw)
  To: Navya Sri Nizamkari; +Cc: outreachy-kernel

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

On Fri, 20 Feb 2015, Navya Sri Nizamkari wrote:

> Hi,
>   Is this patch alright? Now, there are now additional warnings introduced
> by  the change I made.

What warnings?

julia

>
> On Thursday, February 19, 2015 at 11:40:18 PM UTC+5:30, Navya Sri Nizamkari
> wrote:
>       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.
>
>       Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
>       ---
>       Changes in v3:
>          -Removed few changes made in previous commit which were
>       introducing new checkpatch.pl warnings.
>
>        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..6c9b400 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 visithttps://groups.google.com/d/msgid/outreachy-kernel/c4bae1a8-b908-47ae-b7e5-
> e293248a7691%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>

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

* Re: [Outreachy kernel] Re: [PATCH v3] Convert simple_strtoul to kstrtoul
  2015-02-20 17:37   ` [Outreachy kernel] " Julia Lawall
@ 2015-02-20 18:09     ` Navya Sri Nizamkari
  2015-02-20 19:36       ` Julia Lawall
  0 siblings, 1 reply; 7+ messages in thread
From: Navya Sri Nizamkari @ 2015-02-20 18:09 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: navyasri.tech


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



On Friday, February 20, 2015 at 11:07:58 PM UTC+5:30, Julia Lawall wrote:
>
> On Fri, 20 Feb 2015, Navya Sri Nizamkari wrote: 
>
> > Hi, 
> >   Is this patch alright? Now, there are now additional warnings 
> introduced 
> > by  the change I made. 
>
> What warnings? 
>
> julia 
>
>
> > -                        r = simple_strtoul(parport[n], &ep, 0); 
> > -                        if (ep == parport[n]) { 
> > +                        if (kstrtoul(parport[n],0,&r)) { 
>
> In the first patch I sent, there was no space after the ',' in kstrtoul. I 
was talking about the new warnings this created.So, I sent a another one.

Navya
 

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

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

* Re: [Outreachy kernel] Re: [PATCH v3] Convert simple_strtoul to kstrtoul
  2015-02-20 18:09     ` Navya Sri Nizamkari
@ 2015-02-20 19:36       ` Julia Lawall
  0 siblings, 0 replies; 7+ messages in thread
From: Julia Lawall @ 2015-02-20 19:36 UTC (permalink / raw)
  To: Navya Sri Nizamkari; +Cc: outreachy-kernel

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

On Fri, 20 Feb 2015, Navya Sri Nizamkari wrote:

> 
> 
> On Friday, February 20, 2015 at 11:07:58 PM UTC+5:30, Julia Lawall wrote:
>       On Fri, 20 Feb 2015, Navya Sri Nizamkari wrote:
> 
>       > Hi,
>       >   Is this patch alright? Now, there are now additional
>       warnings introduced
>       > by  the change I made.
> 
>       What warnings?
> 
>       julia
> 
> 
>       > -                        r = simple_strtoul(parport[n], &ep,
>       0);
>       > -                        if (ep == parport[n]) {
>       > +                        if (kstrtoul(parport[n],0,&r)) {
> 
> In the first patch I sent, there was no space after the ',' in kstrtoul. I
> was talking about the new warnings this created.So, I sent a another one.

OK.  Patches should not generate new checkpatch warnings.

julia

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

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

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-19 18:11 [PATCH v3] Convert simple_strtoul to kstrtoul Navya Sri Nizamkari
2015-02-20  9:55 ` Navya Sri Nizamkari
2015-02-20 17:37   ` [Outreachy kernel] " Julia Lawall
2015-02-20 18:09     ` Navya Sri Nizamkari
2015-02-20 19:36       ` Julia Lawall
2015-02-20 10:58 ` [Outreachy kernel] " Preeti U Murthy
2015-02-20 15:44   ` navya sri nizamkari

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.