Re: [PATCH] misc: replace strict_strtoul() with kstrtoul()

From: Andy Shevchenko
Date: Sun Jun 02 2013 - 08:08:33 EST


On Sat, Jun 1, 2013 at 10:37 AM, Jingoo Han <jg1.han@xxxxxxxxxxx> wrote:
> The usage of strict_strtoul() is not preferred, because
> strict_strtoul() is obsolete. Thus, kstrtoul() should be
> used.

> --- a/drivers/misc/apds9802als.c
> +++ b/drivers/misc/apds9802als.c
> @@ -126,7 +126,7 @@ static ssize_t als_sensing_range_store(struct device *dev,
> int ret_val;
> unsigned long val;
>
> - if (strict_strtoul(buf, 10, &val))
> + if (kstrtoul(buf, 10, &val))
> return -EINVAL;

ret_val = kstrtoul();
if (ret_val)
return ret_val;

> --- a/drivers/misc/apds990x.c
> +++ b/drivers/misc/apds990x.c
> @@ -697,7 +697,7 @@ static ssize_t apds990x_lux_calib_store(struct device *dev,
> struct apds990x_chip *chip = dev_get_drvdata(dev);
> unsigned long value;
>
> - if (strict_strtoul(buf, 0, &value))
> + if (kstrtoul(buf, 0, &value))
> return -EINVAL;

Ditto. Here and across entire patch.

> @@ -895,7 +895,7 @@ static ssize_t apds990x_set_lux_thresh(struct apds990x_chip *chip, u32 *target,
> int ret = 0;

Remove this assignment...

> unsigned long thresh;
>
> - if (strict_strtoul(buf, 0, &thresh))
> + if (kstrtoul(buf, 0, &thresh))
> return -EINVAL;

...and use return code from kstrtoul().

> --- a/drivers/misc/carma/carma-fpga.c
> +++ b/drivers/misc/carma/carma-fpga.c
> @@ -1002,7 +1002,7 @@ static ssize_t data_en_set(struct device *dev, struct device_attribute *attr,
> unsigned long enable;
> int ret;
>
> - ret = strict_strtoul(buf, 0, &enable);
> + ret = kstrtoul(buf, 0, &enable);
> if (ret) {
> dev_err(priv->dev, "unable to parse enable input\n");
> return -EINVAL;

return ret;

--
With Best Regards,
Andy Shevchenko
--
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/