staging:iio:gyro:adxrs450 squish some trivial single call point wrappers functions.
authorJonathan Cameron <jic23@cam.ac.uk>
Fri, 12 Aug 2011 16:47:56 +0000 (17:47 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 23 Aug 2011 20:32:47 +0000 (13:32 -0700)
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/iio/gyro/adxrs450_core.c

index 967a772a12153cc932378bdf4654d7fb35fc96bb..f65ad49726308fe769ae23aed0a9b3801911704b 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "../iio.h"
 #include "../sysfs.h"
-#include "../adc/adc.h"
 
 #include "adxrs450.h"
 
@@ -173,41 +172,6 @@ error_ret:
        return ret;
 }
 
-static int adxrs450_read_temp(struct iio_dev *indio_dev, int *val)
-{
-       int ret;
-       u16 t;
-       ret = adxrs450_spi_read_reg_16(indio_dev, ADXRS450_TEMP1, &t);
-       if (ret)
-               return ret;
-       *val = t;
-       return 0;
-}
-
-static int adxrs450_read_quad(struct iio_dev *indio_dev, int *val)
-{
-       int ret;
-       s16 t;
-       ret = adxrs450_spi_read_reg_16(indio_dev, ADXRS450_QUAD1, &t);
-       if (ret)
-               return ret;
-       *val = t;
-       return 0;
-}
-
-static int adxrs450_read_sensor_data(struct iio_dev *indio_dev, int *val)
-{
-       int ret;
-       s16 t;
-
-       ret = adxrs450_spi_sensor_data(indio_dev, &t);
-       if (ret)
-               return ret;
-
-       *val = t;
-       return 0;
-}
-
 /* Recommended Startup Sequence by spec */
 static int adxrs450_initial_setup(struct iio_dev *indio_dev)
 {
@@ -298,21 +262,24 @@ static int adxrs450_read_raw(struct iio_dev *indio_dev,
                             long mask)
 {
        int ret;
+       s16 t;
+       u16 ut;
        switch (mask) {
        case 0:
                switch (chan->type) {
                case IIO_GYRO:
-                       ret = adxrs450_read_sensor_data(indio_dev, val);
-                       if (ret < 0)
+                       ret = adxrs450_spi_sensor_data(indio_dev, &t);
+                       if (ret)
                                break;
-                       *val = ret;
+                       *val = t;
                        ret = IIO_VAL_INT;
                        break;
                case IIO_TEMP:
-                       ret = adxrs450_read_temp(indio_dev, val);
-                       if (ret < 0)
+                       ret = adxrs450_spi_read_reg_16(indio_dev,
+                                                      ADXRS450_TEMP1, &ut);
+                       if (ret)
                                break;
-                       *val = ret;
+                       *val = ut;
                        ret = IIO_VAL_INT;
                        break;
                default:
@@ -321,10 +288,10 @@ static int adxrs450_read_raw(struct iio_dev *indio_dev,
                }
                break;
        case (1 << IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SEPARATE):
-               ret = adxrs450_read_quad(indio_dev, val);
-               if (ret < 0)
+               ret = adxrs450_spi_read_reg_16(indio_dev, ADXRS450_QUAD1, &t);
+               if (ret)
                        break;
-               *val = ret;
+               *val = t;
                ret = IIO_VAL_INT;
                break;
        default: