From: Jonathan Cameron Date: Fri, 12 Aug 2011 16:47:56 +0000 (+0100) Subject: staging:iio:gyro:adxrs450 squish some trivial single call point wrappers functions. X-Git-Tag: firefly_0821_release~3680^2~4313^2^2~864^2~225 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=037bad9a7228c9009b5f4f6e63ad5c7012b8f659;p=firefly-linux-kernel-4.4.55.git staging:iio:gyro:adxrs450 squish some trivial single call point wrappers functions. Signed-off-by: Jonathan Cameron Acked-by: Michael Hennerich Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/iio/gyro/adxrs450_core.c b/drivers/staging/iio/gyro/adxrs450_core.c index 967a772a1215..f65ad4972630 100644 --- a/drivers/staging/iio/gyro/adxrs450_core.c +++ b/drivers/staging/iio/gyro/adxrs450_core.c @@ -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: