Commit f88184bf authored by Kaitao cheng's avatar Kaitao cheng Committed by Greg Kroah-Hartman

driver core: Replace simple_strto{l,ul} by kstrtou{l,ul}

The simple_strto{l,ul} are deprecated, use kstrtou{l,ul} instead.
Signed-off-by: default avatarKaitao cheng <pilgrimtao@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 03c0a920
...@@ -794,10 +794,12 @@ ssize_t device_store_ulong(struct device *dev, ...@@ -794,10 +794,12 @@ ssize_t device_store_ulong(struct device *dev,
const char *buf, size_t size) const char *buf, size_t size)
{ {
struct dev_ext_attribute *ea = to_ext_attr(attr); struct dev_ext_attribute *ea = to_ext_attr(attr);
char *end; int ret;
unsigned long new = simple_strtoul(buf, &end, 0); unsigned long new;
if (end == buf)
return -EINVAL; ret = kstrtoul(buf, 0, &new);
if (ret)
return ret;
*(unsigned long *)(ea->var) = new; *(unsigned long *)(ea->var) = new;
/* Always return full write size even if we didn't consume all */ /* Always return full write size even if we didn't consume all */
return size; return size;
...@@ -818,9 +820,14 @@ ssize_t device_store_int(struct device *dev, ...@@ -818,9 +820,14 @@ ssize_t device_store_int(struct device *dev,
const char *buf, size_t size) const char *buf, size_t size)
{ {
struct dev_ext_attribute *ea = to_ext_attr(attr); struct dev_ext_attribute *ea = to_ext_attr(attr);
char *end; int ret;
long new = simple_strtol(buf, &end, 0); long new;
if (end == buf || new > INT_MAX || new < INT_MIN)
ret = kstrtol(buf, 0, &new);
if (ret)
return ret;
if (new > INT_MAX || new < INT_MIN)
return -EINVAL; return -EINVAL;
*(int *)(ea->var) = new; *(int *)(ea->var) = new;
/* Always return full write size even if we didn't consume all */ /* Always return full write size even if we didn't consume all */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment