All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] avr32: replace simple_strtoul() with kstrtoul()
@ 2014-03-18 21:25 Ramkumar Ramachandra
  2014-04-01  0:42 ` [PATCH v2] " Ramkumar Ramachandra
  0 siblings, 1 reply; 6+ messages in thread
From: Ramkumar Ramachandra @ 2014-03-18 21:25 UTC (permalink / raw)
  To: LKML; +Cc: Haavard Skinnemoen, Hans-Christian Egtvedt

simple_strtoul() is marked for obsoletion; use the newer and more
pleasant kstrtoul() in its place.

Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 arch/avr32/kernel/cpu.c | 48 ++++++++++++++++++++++++------------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/arch/avr32/kernel/cpu.c b/arch/avr32/kernel/cpu.c
index 2233be7..389e2d1 100644
--- a/arch/avr32/kernel/cpu.c
+++ b/arch/avr32/kernel/cpu.c
@@ -39,11 +39,11 @@ static ssize_t store_pc0event(struct device *dev,
 			      size_t count)
 {
 	unsigned long val;
-	char *endp;
+	int ret;
 
-	val = simple_strtoul(buf, &endp, 0);
-	if (endp == buf || val > 0x3f)
-		return -EINVAL;
+	ret = kstrtoul(buf, 0, &val);
+	if (ret)
+		return ret;
 	val = (val << 12) | (sysreg_read(PCCR) & 0xfffc0fff);
 	sysreg_write(PCCR, val);
 	return count;
@@ -61,11 +61,11 @@ static ssize_t store_pc0count(struct device *dev,
 				const char *buf, size_t count)
 {
 	unsigned long val;
-	char *endp;
+	int ret;
 
-	val = simple_strtoul(buf, &endp, 0);
-	if (endp == buf)
-		return -EINVAL;
+	ret = kstroul(buf, 0, &val);
+	if (ret)
+		return ret;
 	sysreg_write(PCNT0, val);
 
 	return count;
@@ -84,11 +84,11 @@ static ssize_t store_pc1event(struct device *dev,
 			      size_t count)
 {
 	unsigned long val;
-	char *endp;
+	int ret;
 
-	val = simple_strtoul(buf, &endp, 0);
-	if (endp == buf || val > 0x3f)
-		return -EINVAL;
+	ret = kstrtoul(buf, 0, &val);
+	if (ret)
+		return ret;
 	val = (val << 18) | (sysreg_read(PCCR) & 0xff03ffff);
 	sysreg_write(PCCR, val);
 	return count;
@@ -106,11 +106,11 @@ static ssize_t store_pc1count(struct device *dev,
 			      size_t count)
 {
 	unsigned long val;
-	char *endp;
+	int ret;
 
-	val = simple_strtoul(buf, &endp, 0);
-	if (endp == buf)
-		return -EINVAL;
+	ret = kstrtoul(buf, 0, &val);
+	if (ret)
+		return ret;
 	sysreg_write(PCNT1, val);
 
 	return count;
@@ -129,11 +129,11 @@ static ssize_t store_pccycles(struct device *dev,
 			      size_t count)
 {
 	unsigned long val;
-	char *endp;
+	int ret;
 
-	val = simple_strtoul(buf, &endp, 0);
-	if (endp == buf)
-		return -EINVAL;
+	ret = kstrtoul(buf, 0, &val);
+	if (ret)
+		return ret;
 	sysreg_write(PCCNT, val);
 
 	return count;
@@ -152,11 +152,11 @@ static ssize_t store_pcenable(struct device *dev,
 			      size_t count)
 {
 	unsigned long pccr, val;
-	char *endp;
+	int ret;
 
-	val = simple_strtoul(buf, &endp, 0);
-	if (endp == buf)
-		return -EINVAL;
+	ret = kstrtoul(buf, 0, &val);
+	if (ret)
+		return ret;
 	if (val)
 		val = 1;
 
-- 
1.9.0.431.g014438b


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

* [PATCH v2] avr32: replace simple_strtoul() with kstrtoul()
  2014-03-18 21:25 [PATCH] avr32: replace simple_strtoul() with kstrtoul() Ramkumar Ramachandra
@ 2014-04-01  0:42 ` Ramkumar Ramachandra
  2014-04-01  7:05   ` Hans-Christian Egtvedt
  2014-04-01  7:08   ` Hans-Christian Egtvedt
  0 siblings, 2 replies; 6+ messages in thread
From: Ramkumar Ramachandra @ 2014-04-01  0:42 UTC (permalink / raw)
  To: LKML; +Cc: Alexey Dobriyan, Haavard Skinnemoen, Hans-Christian Egtvedt

simple_strtoul() is marked for obsoletion; use the newer and more
pleasant kstrtoul() in its place.

Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 arch/avr32/kernel/cpu.c | 48 ++++++++++++++++++++++++++----------------------
 1 file changed, 26 insertions(+), 22 deletions(-)

diff --git a/arch/avr32/kernel/cpu.c b/arch/avr32/kernel/cpu.c
index 2233be7..20ce2c0 100644
--- a/arch/avr32/kernel/cpu.c
+++ b/arch/avr32/kernel/cpu.c
@@ -39,10 +39,12 @@ static ssize_t store_pc0event(struct device *dev,
 			      size_t count)
 {
 	unsigned long val;
-	char *endp;
+	int ret;
 
-	val = simple_strtoul(buf, &endp, 0);
-	if (endp == buf || val > 0x3f)
+	ret = kstrtoul(buf, 0, &val);
+	if (ret)
+		return ret;
+	if (val > 0x3f)
 		return -EINVAL;
 	val = (val << 12) | (sysreg_read(PCCR) & 0xfffc0fff);
 	sysreg_write(PCCR, val);
@@ -61,11 +63,11 @@ static ssize_t store_pc0count(struct device *dev,
 				const char *buf, size_t count)
 {
 	unsigned long val;
-	char *endp;
+	int ret;
 
-	val = simple_strtoul(buf, &endp, 0);
-	if (endp == buf)
-		return -EINVAL;
+	ret = kstroul(buf, 0, &val);
+	if (ret)
+		return ret;
 	sysreg_write(PCNT0, val);
 
 	return count;
@@ -84,10 +86,12 @@ static ssize_t store_pc1event(struct device *dev,
 			      size_t count)
 {
 	unsigned long val;
-	char *endp;
+	int ret;
 
-	val = simple_strtoul(buf, &endp, 0);
-	if (endp == buf || val > 0x3f)
+	ret = kstrtoul(buf, 0, &val);
+	if (ret)
+		return ret;
+	if (val > 0x3f)
 		return -EINVAL;
 	val = (val << 18) | (sysreg_read(PCCR) & 0xff03ffff);
 	sysreg_write(PCCR, val);
@@ -106,11 +110,11 @@ static ssize_t store_pc1count(struct device *dev,
 			      size_t count)
 {
 	unsigned long val;
-	char *endp;
+	int ret;
 
-	val = simple_strtoul(buf, &endp, 0);
-	if (endp == buf)
-		return -EINVAL;
+	ret = kstrtoul(buf, 0, &val);
+	if (ret)
+		return ret;
 	sysreg_write(PCNT1, val);
 
 	return count;
@@ -129,11 +133,11 @@ static ssize_t store_pccycles(struct device *dev,
 			      size_t count)
 {
 	unsigned long val;
-	char *endp;
+	int ret;
 
-	val = simple_strtoul(buf, &endp, 0);
-	if (endp == buf)
-		return -EINVAL;
+	ret = kstrtoul(buf, 0, &val);
+	if (ret)
+		return ret;
 	sysreg_write(PCCNT, val);
 
 	return count;
@@ -152,11 +156,11 @@ static ssize_t store_pcenable(struct device *dev,
 			      size_t count)
 {
 	unsigned long pccr, val;
-	char *endp;
+	int ret;
 
-	val = simple_strtoul(buf, &endp, 0);
-	if (endp == buf)
-		return -EINVAL;
+	ret = kstrtoul(buf, 0, &val);
+	if (ret)
+		return ret;
 	if (val)
 		val = 1;
 
-- 
1.9.0.431.g014438b


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

* Re: [PATCH v2] avr32: replace simple_strtoul() with kstrtoul()
  2014-04-01  0:42 ` [PATCH v2] " Ramkumar Ramachandra
@ 2014-04-01  7:05   ` Hans-Christian Egtvedt
  2014-04-01  7:08   ` Hans-Christian Egtvedt
  1 sibling, 0 replies; 6+ messages in thread
From: Hans-Christian Egtvedt @ 2014-04-01  7:05 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: LKML, Alexey Dobriyan, Haavard Skinnemoen

Around Mon 31 Mar 2014 20:42:42 -0400 or thereabout, Ramkumar Ramachandra wrote:
> simple_strtoul() is marked for obsoletion; use the newer and more
> pleasant kstrtoul() in its place.

Thank you for fixing, I will add it to my for-linus branch and push later
today.

> Cc: Alexey Dobriyan <adobriyan@gmail.com>
> Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
> Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>

Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>

> ---
>  arch/avr32/kernel/cpu.c | 48 ++++++++++++++++++++++++++----------------------
>  1 file changed, 26 insertions(+), 22 deletions(-)
> 
> diff --git a/arch/avr32/kernel/cpu.c b/arch/avr32/kernel/cpu.c

<snipp diff>

-- 
mvh
Hans-Christian Egtvedt

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

* Re: [PATCH v2] avr32: replace simple_strtoul() with kstrtoul()
  2014-04-01  0:42 ` [PATCH v2] " Ramkumar Ramachandra
  2014-04-01  7:05   ` Hans-Christian Egtvedt
@ 2014-04-01  7:08   ` Hans-Christian Egtvedt
  1 sibling, 0 replies; 6+ messages in thread
From: Hans-Christian Egtvedt @ 2014-04-01  7:08 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: LKML, Alexey Dobriyan, Haavard Skinnemoen

Around Mon 31 Mar 2014 20:42:42 -0400 or thereabout, Ramkumar Ramachandra wrote:
> simple_strtoul() is marked for obsoletion; use the newer and more
> pleasant kstrtoul() in its place.
> 
> Cc: Alexey Dobriyan <adobriyan@gmail.com>
> Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
> Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> ---
>  arch/avr32/kernel/cpu.c | 48 ++++++++++++++++++++++++++----------------------
>  1 file changed, 26 insertions(+), 22 deletions(-)
> 
> diff --git a/arch/avr32/kernel/cpu.c b/arch/avr32/kernel/cpu.c

<snipp diff>

> @@ -61,11 +63,11 @@ static ssize_t store_pc0count(struct device *dev,
>  				const char *buf, size_t count)
>  {
>  	unsigned long val;
> -	char *endp;
> +	int ret;
>  
> -	val = simple_strtoul(buf, &endp, 0);
> -	if (endp == buf)
> -		return -EINVAL;
> +	ret = kstroul(buf, 0, &val);

I fixed this typo to kstrtoul.

<snipp diff>

-- 
mvh
Hans-Christian Egtvedt

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

* Re: [PATCH] avr32: replace simple_strtoul() with kstrtoul()
  2014-03-19  9:52 [PATCH] " Alexey Dobriyan
@ 2014-03-31  6:56 ` Hans-Christian Egtvedt
  0 siblings, 0 replies; 6+ messages in thread
From: Hans-Christian Egtvedt @ 2014-03-31  6:56 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: artagnon, Linux Kernel, hskinnemoen

Around Wed 19 Mar 2014 12:52:35 +0300 or thereabout, Alexey Dobriyan wrote:
>> - val = simple_strtoul(buf, &endp, 0);
>> - if (endp == buf || val > 0x3f)
>> - return -EINVAL;
>> + ret = kstrtoul(buf, 0, &val);
>> + if (ret)
>> + return ret;
>>   val = (val << 12) | (sysreg_read(PCCR) & 0xfffc0fff);
> 
> you removed 0x3f check
> 
> this conversion is not trivial as it seems

Is anybody going to update this patch? I planned to push early this round, as
others are waiting for AVR32 changes.

-- 
Best regards,
Hans-Christian Egtvedt

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

* Re: [PATCH] avr32: replace simple_strtoul() with kstrtoul()
@ 2014-03-19  9:52 Alexey Dobriyan
  2014-03-31  6:56 ` Hans-Christian Egtvedt
  0 siblings, 1 reply; 6+ messages in thread
From: Alexey Dobriyan @ 2014-03-19  9:52 UTC (permalink / raw)
  To: artagnon; +Cc: Linux Kernel, hskinnemoen, egtvedt

> - val = simple_strtoul(buf, &endp, 0);
> - if (endp == buf || val > 0x3f)
> - return -EINVAL;
> + ret = kstrtoul(buf, 0, &val);
> + if (ret)
> + return ret;
>   val = (val << 12) | (sysreg_read(PCCR) & 0xfffc0fff);

you removed 0x3f check

this conversion is not trivial as it seems

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

end of thread, other threads:[~2014-04-01  7:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-18 21:25 [PATCH] avr32: replace simple_strtoul() with kstrtoul() Ramkumar Ramachandra
2014-04-01  0:42 ` [PATCH v2] " Ramkumar Ramachandra
2014-04-01  7:05   ` Hans-Christian Egtvedt
2014-04-01  7:08   ` Hans-Christian Egtvedt
2014-03-19  9:52 [PATCH] " Alexey Dobriyan
2014-03-31  6:56 ` Hans-Christian Egtvedt

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.