driver core: Replace simple_strto{l,ul} by kstrtou{l,ul}
authorKaitao cheng <pilgrimtao@gmail.com>
Tue, 6 Nov 2018 16:34:54 +0000 (08:34 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 27 Nov 2018 11:00:52 +0000 (12:00 +0100)
The simple_strto{l,ul} are deprecated, use kstrtou{l,ul} instead.

Signed-off-by: Kaitao cheng <pilgrimtao@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/core.c

index 04bbcd779e114ef1ecad0df77591c0801a0bf84b..ed145fbfeddf06dcee5b833c0558d35c7fb6325d 100644 (file)
@@ -794,10 +794,12 @@ ssize_t device_store_ulong(struct device *dev,
                           const char *buf, size_t size)
 {
        struct dev_ext_attribute *ea = to_ext_attr(attr);
-       char *end;
-       unsigned long new = simple_strtoul(buf, &end, 0);
-       if (end == buf)
-               return -EINVAL;
+       int ret;
+       unsigned long new;
+
+       ret = kstrtoul(buf, 0, &new);
+       if (ret)
+               return ret;
        *(unsigned long *)(ea->var) = new;
        /* Always return full write size even if we didn't consume all */
        return size;
@@ -818,9 +820,14 @@ ssize_t device_store_int(struct device *dev,
                         const char *buf, size_t size)
 {
        struct dev_ext_attribute *ea = to_ext_attr(attr);
-       char *end;
-       long new = simple_strtol(buf, &end, 0);
-       if (end == buf || new > INT_MAX || new < INT_MIN)
+       int ret;
+       long new;
+
+       ret = kstrtol(buf, 0, &new);
+       if (ret)
+               return ret;
+
+       if (new > INT_MAX || new < INT_MIN)
                return -EINVAL;
        *(int *)(ea->var) = new;
        /* Always return full write size even if we didn't consume all */