[PATCH] driver core: replace strict_strto*() with kstrto*()

From: Jingoo Han
Date: Fri Jul 19 2013 - 03:23:33 EST


The usage of strict_strto*() is not preferred, because
strict_strto*() is obsolete. Thus, kstrto*() should be
used.

Signed-off-by: Jingoo Han <jg1.han@xxxxxxxxxxx>
---
drivers/base/core.c | 2 +-
drivers/base/memory.c | 10 ++++++----
drivers/base/power/sysfs.c | 7 ++++++-
drivers/base/regmap/regmap-debugfs.c | 5 +++--
4 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 8856d74..edfbf05 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -38,7 +38,7 @@ long sysfs_deprecated = 0;
#endif
static __init int sysfs_deprecated_setup(char *arg)
{
- return strict_strtol(arg, 10, &sysfs_deprecated);
+ return kstrtol(arg, 10, &sysfs_deprecated);
}
early_param("sysfs.deprecated", sysfs_deprecated_setup);
#endif
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 2b7813e..d0817fb 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -469,8 +469,9 @@ store_soft_offline_page(struct device *dev,
u64 pfn;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
- if (strict_strtoull(buf, 0, &pfn) < 0)
- return -EINVAL;
+ ret = kstrtoull(buf, 0, &pfn);
+ if (ret < 0)
+ return ret;
pfn >>= PAGE_SHIFT;
if (!pfn_valid(pfn))
return -ENXIO;
@@ -488,8 +489,9 @@ store_hard_offline_page(struct device *dev,
u64 pfn;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
- if (strict_strtoull(buf, 0, &pfn) < 0)
- return -EINVAL;
+ ret = kstrtoull(buf, 0, &pfn);
+ if (ret < 0)
+ return ret;
pfn >>= PAGE_SHIFT;
ret = memory_failure(pfn, 0, 0);
return ret ? ret : count;
diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c
index a53ebd2..e0a3877 100644
--- a/drivers/base/power/sysfs.c
+++ b/drivers/base/power/sysfs.c
@@ -202,11 +202,16 @@ static ssize_t autosuspend_delay_ms_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t n)
{
long delay;
+ int ret;

if (!dev->power.use_autosuspend)
return -EIO;

- if (strict_strtol(buf, 10, &delay) != 0 || delay != (int) delay)
+ ret = kstrtol(buf, 10, &delay);
+ if (ret)
+ return ret;
+
+ if (delay != (int) delay)
return -EINVAL;

device_lock(dev);
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index 5349575..664a75e 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -281,8 +281,9 @@ static ssize_t regmap_map_write_file(struct file *file,
reg = simple_strtoul(start, &start, 16);
while (*start == ' ')
start++;
- if (strict_strtoul(start, 16, &value))
- return -EINVAL;
+ ret = kstrtoul(start, 16, &value);
+ if (ret)
+ return ret;

/* Userspace has been fiddling around behind the kernel's back */
add_taint(TAINT_USER, LOCKDEP_STILL_OK);
--
1.7.10.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/