[PATCH] Staging: iio/adc: data types updated for new strto* functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some datatypes were larger than they actually need to be, so they were adjusted to benefit from the new strto* functions.
Not everything might be optimal now, this is a starting point.

Signed-off-by: Andreas Ruprecht <rupran@xxxxxxxxxxxx>
---
 drivers/staging/iio/adc/ad7793.c      |    4 ++--
 drivers/staging/iio/adc/ad799x_core.c |    8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/iio/adc/ad7793.c b/drivers/staging/iio/adc/ad7793.c
index ac24c5b..0d9e5ea 100644
--- a/drivers/staging/iio/adc/ad7793.c
+++ b/drivers/staging/iio/adc/ad7793.c
@@ -567,7 +567,7 @@ static ssize_t ad7793_write_frequency(struct device *dev,
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct ad7793_state *st = iio_priv(indio_dev);
-	long lval;
+	u16 lval;
 	int i, ret;
 
 	mutex_lock(&indio_dev->mlock);
@@ -577,7 +577,7 @@ static ssize_t ad7793_write_frequency(struct device *dev,
 	}
 	mutex_unlock(&indio_dev->mlock);
 
-	ret = kstrtol(buf, 10, &lval);
+	ret = kstrtou16(buf, 10, &lval);
 	if (ret)
 		return ret;
 
diff --git a/drivers/staging/iio/adc/ad799x_core.c b/drivers/staging/iio/adc/ad799x_core.c
index 32052a6..72f380d 100644
--- a/drivers/staging/iio/adc/ad799x_core.c
+++ b/drivers/staging/iio/adc/ad799x_core.c
@@ -204,11 +204,11 @@ static ssize_t ad799x_write_frequency(struct device *dev,
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct ad799x_state *st = iio_priv(indio_dev);
 
-	long val;
+	unsigned int val;
 	int ret, i;
 	u8 t;
 
-	ret = kstrtol(buf, 10, &val);
+	ret = kstrtouint(buf, 10, &val);
 	if (ret)
 		return ret;
 
@@ -316,10 +316,10 @@ static ssize_t ad799x_write_channel_config(struct device *dev,
 	struct ad799x_state *st = iio_priv(indio_dev);
 	struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
 
-	long val;
+	u16 val;
 	int ret;
 
-	ret = kstrtol(buf, 10, &val);
+	ret = kstrtou16(buf, 10, &val);
 	if (ret)
 		return ret;
 
-- 
1.7.5.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux