Commit d3dbd93d authored by Jingoo Han's avatar Jingoo Han Committed by Konrad Rzeszutek Wilk

xen: replace strict_strtoul() with kstrtoul()

The usage of strict_strtoul() is not preferred, because
strict_strtoul() is obsolete. Thus, kstrtoul() should be
used.
Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
parent 5f338d90
...@@ -265,8 +265,10 @@ static ssize_t store_selfballooning(struct device *dev, ...@@ -265,8 +265,10 @@ static ssize_t store_selfballooning(struct device *dev,
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
err = strict_strtoul(buf, 10, &tmp); err = kstrtoul(buf, 10, &tmp);
if (err || ((tmp != 0) && (tmp != 1))) if (err)
return err;
if ((tmp != 0) && (tmp != 1))
return -EINVAL; return -EINVAL;
xen_selfballooning_enabled = !!tmp; xen_selfballooning_enabled = !!tmp;
...@@ -292,8 +294,10 @@ static ssize_t store_selfballoon_interval(struct device *dev, ...@@ -292,8 +294,10 @@ static ssize_t store_selfballoon_interval(struct device *dev,
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
err = strict_strtoul(buf, 10, &val); err = kstrtoul(buf, 10, &val);
if (err || val == 0) if (err)
return err;
if (val == 0)
return -EINVAL; return -EINVAL;
selfballoon_interval = val; selfballoon_interval = val;
return count; return count;
...@@ -314,8 +318,10 @@ static ssize_t store_selfballoon_downhys(struct device *dev, ...@@ -314,8 +318,10 @@ static ssize_t store_selfballoon_downhys(struct device *dev,
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
err = strict_strtoul(buf, 10, &val); err = kstrtoul(buf, 10, &val);
if (err || val == 0) if (err)
return err;
if (val == 0)
return -EINVAL; return -EINVAL;
selfballoon_downhysteresis = val; selfballoon_downhysteresis = val;
return count; return count;
...@@ -337,8 +343,10 @@ static ssize_t store_selfballoon_uphys(struct device *dev, ...@@ -337,8 +343,10 @@ static ssize_t store_selfballoon_uphys(struct device *dev,
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
err = strict_strtoul(buf, 10, &val); err = kstrtoul(buf, 10, &val);
if (err || val == 0) if (err)
return err;
if (val == 0)
return -EINVAL; return -EINVAL;
selfballoon_uphysteresis = val; selfballoon_uphysteresis = val;
return count; return count;
...@@ -360,8 +368,10 @@ static ssize_t store_selfballoon_min_usable_mb(struct device *dev, ...@@ -360,8 +368,10 @@ static ssize_t store_selfballoon_min_usable_mb(struct device *dev,
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
err = strict_strtoul(buf, 10, &val); err = kstrtoul(buf, 10, &val);
if (err || val == 0) if (err)
return err;
if (val == 0)
return -EINVAL; return -EINVAL;
selfballoon_min_usable_mb = val; selfballoon_min_usable_mb = val;
return count; return count;
...@@ -384,8 +394,10 @@ static ssize_t store_selfballoon_reserved_mb(struct device *dev, ...@@ -384,8 +394,10 @@ static ssize_t store_selfballoon_reserved_mb(struct device *dev,
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
err = strict_strtoul(buf, 10, &val); err = kstrtoul(buf, 10, &val);
if (err || val == 0) if (err)
return err;
if (val == 0)
return -EINVAL; return -EINVAL;
selfballoon_reserved_mb = val; selfballoon_reserved_mb = val;
return count; return count;
...@@ -410,8 +422,10 @@ static ssize_t store_frontswap_selfshrinking(struct device *dev, ...@@ -410,8 +422,10 @@ static ssize_t store_frontswap_selfshrinking(struct device *dev,
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
err = strict_strtoul(buf, 10, &tmp); err = kstrtoul(buf, 10, &tmp);
if (err || ((tmp != 0) && (tmp != 1))) if (err)
return err;
if ((tmp != 0) && (tmp != 1))
return -EINVAL; return -EINVAL;
frontswap_selfshrinking = !!tmp; frontswap_selfshrinking = !!tmp;
if (!was_enabled && !xen_selfballooning_enabled && if (!was_enabled && !xen_selfballooning_enabled &&
...@@ -437,8 +451,10 @@ static ssize_t store_frontswap_inertia(struct device *dev, ...@@ -437,8 +451,10 @@ static ssize_t store_frontswap_inertia(struct device *dev,
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
err = strict_strtoul(buf, 10, &val); err = kstrtoul(buf, 10, &val);
if (err || val == 0) if (err)
return err;
if (val == 0)
return -EINVAL; return -EINVAL;
frontswap_inertia = val; frontswap_inertia = val;
frontswap_inertia_counter = val; frontswap_inertia_counter = val;
...@@ -460,8 +476,10 @@ static ssize_t store_frontswap_hysteresis(struct device *dev, ...@@ -460,8 +476,10 @@ static ssize_t store_frontswap_hysteresis(struct device *dev,
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
err = strict_strtoul(buf, 10, &val); err = kstrtoul(buf, 10, &val);
if (err || val == 0) if (err)
return err;
if (val == 0)
return -EINVAL; return -EINVAL;
frontswap_hysteresis = val; frontswap_hysteresis = val;
return count; return count;
......
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