Skip to content

Commit

Permalink
avr32: replace simple_strtoul() with kstrtoul()
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
  • Loading branch information
Ramkumar Ramachandra authored and Hans-Christian Egtvedt committed Apr 1, 2014
1 parent 2601566 commit 4c3b7df
Showing 1 changed file with 26 additions and 22 deletions.
48 changes: 26 additions & 22 deletions arch/avr32/kernel/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 = kstrtoul(buf, 0, &val);
if (ret)
return ret;
sysreg_write(PCNT0, val);

return count;
Expand All @@ -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);
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;

Expand Down

0 comments on commit 4c3b7df

Please sign in to comment.