Commit f86f8362 authored by Aida Mynzhasova's avatar Aida Mynzhasova Committed by Greg Kroah-Hartman

staging:iio:adc: Use kstrtol()/kstrtoul()

Replace deprecated strict_strtol()/strict_strtoul() with
kstrtol()/kstrtoul(). Add missing checks for conversion return codes.
Signed-off-by: default avatarAida Mynzhasova <ai.c.c0der@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0c474826
...@@ -326,7 +326,7 @@ static ssize_t ad7192_write_frequency(struct device *dev, ...@@ -326,7 +326,7 @@ static ssize_t ad7192_write_frequency(struct device *dev,
unsigned long lval; unsigned long lval;
int div, ret; int div, ret;
ret = strict_strtoul(buf, 10, &lval); ret = kstrtoul(buf, 10, &lval);
if (ret) if (ret)
return ret; return ret;
if (lval == 0) if (lval == 0)
......
...@@ -632,7 +632,7 @@ static ssize_t ad7280_write_channel_config(struct device *dev, ...@@ -632,7 +632,7 @@ static ssize_t ad7280_write_channel_config(struct device *dev,
long val; long val;
int ret; int ret;
ret = strict_strtol(buf, 10, &val); ret = kstrtol(buf, 10, &val);
if (ret) if (ret)
return ret; return ret;
......
...@@ -125,9 +125,12 @@ static ssize_t ad7606_store_range(struct device *dev, ...@@ -125,9 +125,12 @@ static ssize_t ad7606_store_range(struct device *dev,
struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct ad7606_state *st = iio_priv(indio_dev); struct ad7606_state *st = iio_priv(indio_dev);
unsigned long lval; unsigned long lval;
int ret;
ret = kstrtoul(buf, 10, &lval);
if (ret)
return ret;
if (strict_strtoul(buf, 10, &lval))
return -EINVAL;
if (!(lval == 5000 || lval == 10000)) { if (!(lval == 5000 || lval == 10000)) {
dev_err(dev, "range is not supported\n"); dev_err(dev, "range is not supported\n");
return -EINVAL; return -EINVAL;
...@@ -173,8 +176,9 @@ static ssize_t ad7606_store_oversampling_ratio(struct device *dev, ...@@ -173,8 +176,9 @@ static ssize_t ad7606_store_oversampling_ratio(struct device *dev,
unsigned long lval; unsigned long lval;
int ret; int ret;
if (strict_strtoul(buf, 10, &lval)) ret = kstrtoul(buf, 10, &lval);
return -EINVAL; if (ret)
return ret;
ret = ad7606_oversampling_get_index(lval); ret = ad7606_oversampling_get_index(lval);
if (ret < 0) { if (ret < 0) {
......
...@@ -175,9 +175,9 @@ static ssize_t ad7816_store_channel(struct device *dev, ...@@ -175,9 +175,9 @@ static ssize_t ad7816_store_channel(struct device *dev,
unsigned long data; unsigned long data;
int ret; int ret;
ret = strict_strtoul(buf, 10, &data); ret = kstrtoul(buf, 10, &data);
if (ret) if (ret)
return -EINVAL; return ret;
if (data > AD7816_CS_MAX && data != AD7816_CS_MASK) { if (data > AD7816_CS_MAX && data != AD7816_CS_MASK) {
dev_err(&chip->spi_dev->dev, "Invalid channel id %lu for %s.\n", dev_err(&chip->spi_dev->dev, "Invalid channel id %lu for %s.\n",
...@@ -290,7 +290,9 @@ static inline ssize_t ad7816_set_oti(struct device *dev, ...@@ -290,7 +290,9 @@ static inline ssize_t ad7816_set_oti(struct device *dev,
u8 data; u8 data;
int ret; int ret;
ret = strict_strtol(buf, 10, &value); ret = kstrtol(buf, 10, &value);
if (ret)
return ret;
if (chip->channel_id > AD7816_CS_MAX) { if (chip->channel_id > AD7816_CS_MAX) {
dev_err(dev, "Invalid oti channel id %d.\n", chip->channel_id); dev_err(dev, "Invalid oti channel id %d.\n", chip->channel_id);
......
...@@ -226,7 +226,7 @@ static ssize_t ad799x_write_frequency(struct device *dev, ...@@ -226,7 +226,7 @@ static ssize_t ad799x_write_frequency(struct device *dev,
int ret, i; int ret, i;
u8 t; u8 t;
ret = strict_strtol(buf, 10, &val); ret = kstrtol(buf, 10, &val);
if (ret) if (ret)
return ret; return ret;
...@@ -337,7 +337,7 @@ static ssize_t ad799x_write_channel_config(struct device *dev, ...@@ -337,7 +337,7 @@ static ssize_t ad799x_write_channel_config(struct device *dev,
long val; long val;
int ret; int ret;
ret = strict_strtol(buf, 10, &val); ret = kstrtol(buf, 10, &val);
if (ret) if (ret)
return ret; return ret;
......
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