Commit 037bad9a authored by Jonathan Cameron's avatar Jonathan Cameron Committed by Greg Kroah-Hartman

staging:iio:gyro:adxrs450 squish some trivial single call point wrappers functions.

Signed-off-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Acked-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent cb449687
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "../iio.h" #include "../iio.h"
#include "../sysfs.h" #include "../sysfs.h"
#include "../adc/adc.h"
#include "adxrs450.h" #include "adxrs450.h"
...@@ -173,41 +172,6 @@ static int adxrs450_spi_initial(struct adxrs450_state *st, ...@@ -173,41 +172,6 @@ static int adxrs450_spi_initial(struct adxrs450_state *st,
return 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 */ /* Recommended Startup Sequence by spec */
static int adxrs450_initial_setup(struct iio_dev *indio_dev) static int adxrs450_initial_setup(struct iio_dev *indio_dev)
{ {
...@@ -298,21 +262,24 @@ static int adxrs450_read_raw(struct iio_dev *indio_dev, ...@@ -298,21 +262,24 @@ static int adxrs450_read_raw(struct iio_dev *indio_dev,
long mask) long mask)
{ {
int ret; int ret;
s16 t;
u16 ut;
switch (mask) { switch (mask) {
case 0: case 0:
switch (chan->type) { switch (chan->type) {
case IIO_GYRO: case IIO_GYRO:
ret = adxrs450_read_sensor_data(indio_dev, val); ret = adxrs450_spi_sensor_data(indio_dev, &t);
if (ret < 0) if (ret)
break; break;
*val = ret; *val = t;
ret = IIO_VAL_INT; ret = IIO_VAL_INT;
break; break;
case IIO_TEMP: case IIO_TEMP:
ret = adxrs450_read_temp(indio_dev, val); ret = adxrs450_spi_read_reg_16(indio_dev,
if (ret < 0) ADXRS450_TEMP1, &ut);
if (ret)
break; break;
*val = ret; *val = ut;
ret = IIO_VAL_INT; ret = IIO_VAL_INT;
break; break;
default: default:
...@@ -321,10 +288,10 @@ static int adxrs450_read_raw(struct iio_dev *indio_dev, ...@@ -321,10 +288,10 @@ static int adxrs450_read_raw(struct iio_dev *indio_dev,
} }
break; break;
case (1 << IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SEPARATE): case (1 << IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SEPARATE):
ret = adxrs450_read_quad(indio_dev, val); ret = adxrs450_spi_read_reg_16(indio_dev, ADXRS450_QUAD1, &t);
if (ret < 0) if (ret)
break; break;
*val = ret; *val = t;
ret = IIO_VAL_INT; ret = IIO_VAL_INT;
break; break;
default: default:
......
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