avr32: replace simple_strtoul() with kstrtoul()
PATCH 1/1 avr32: replace simple_strtoul() with kstrtoul()
simple_strtoul() is marked for obsoletion; use the newer and more pleasant kstrtoul() in its place.
--- arch/avr32/kernel/cpu.c | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-)
arch/avr32/kernel/cpu.c +24 -24
@@ -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 ;
Signature · 1 line
1.9.0.431.g014438b
PATCH v2 1/1 avr32: replace simple_strtoul() with kstrtoul()
simple_strtoul() is marked for obsoletion; use the newer and more pleasant kstrtoul() in its place.
--- arch/avr32/kernel/cpu.c | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-)
arch/avr32/kernel/cpu.c +26 -22
@@ -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 ;
Signature · 1 line
1.9.0.431.g014438b
Quoted 2 lines · Ramkumar Ramachandra
simple_strtoul()is marked for obsoletion; use the newer and more pleasantkstrtoul()in its place.
Thank you for fixing, I will add it to my for-linus branch and push later today.
Quoted 4 lines
Cc Alexey Dobriyan <[email protected]>Cc Haavard Skinnemoen <[email protected]>Cc Hans-Christian Egtvedt <[email protected]>Signed-off-by Ramkumar Ramachandra <[email protected]>
arch/avr32/kernel/cpu.c
Quoted 5 lines
--- arch/avr32/kernel/cpu.c | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-)arch/avr32/kernel/cpu.c +0
-0
<snipp diff>
Signature · 2 lines
mvh Hans-Christian Egtvedt
arch/avr32/kernel/cpu.c
Quoted 12 lines · Ramkumar Ramachandra
simple_strtoul()is marked for obsoletion; use the newer and more pleasantkstrtoul()in its place.Cc Alexey Dobriyan <[email protected]>Cc Haavard Skinnemoen <[email protected]>Cc Hans-Christian Egtvedt <[email protected]>Signed-off-by Ramkumar Ramachandra <[email protected]>--- arch/avr32/kernel/cpu.c | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-)arch/avr32/kernel/cpu.c +0
-0
<snipp diff>
arch/avr32/kernel/cpu.c static ssize_t store_pc0count(struct device *dev, · line 68
Quoted 11 lines
arch/avr32/kernel/cpu.c +2
-4@@ -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>
Signature · 2 lines
mvh Hans-Christian Egtvedt