Commit 5d693139 authored by Peter Meerwald-Stadler's avatar Peter Meerwald-Stadler Committed by Jonathan Cameron

iio: light: vcnl4000: Cleanup read_raw() returns

Signed-off-by: default avatarPeter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent ff6a5259
...@@ -109,7 +109,7 @@ static int vcnl4000_read_raw(struct iio_dev *indio_dev, ...@@ -109,7 +109,7 @@ static int vcnl4000_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, struct iio_chan_spec const *chan,
int *val, int *val2, long mask) int *val, int *val2, long mask)
{ {
int ret = -EINVAL; int ret;
struct vcnl4000_data *data = iio_priv(indio_dev); struct vcnl4000_data *data = iio_priv(indio_dev);
switch (mask) { switch (mask) {
...@@ -121,32 +121,27 @@ static int vcnl4000_read_raw(struct iio_dev *indio_dev, ...@@ -121,32 +121,27 @@ static int vcnl4000_read_raw(struct iio_dev *indio_dev,
VCNL4000_AL_RESULT_HI, val); VCNL4000_AL_RESULT_HI, val);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = IIO_VAL_INT; return IIO_VAL_INT;
break;
case IIO_PROXIMITY: case IIO_PROXIMITY:
ret = vcnl4000_measure(data, ret = vcnl4000_measure(data,
VCNL4000_PS_OD, VCNL4000_PS_RDY, VCNL4000_PS_OD, VCNL4000_PS_RDY,
VCNL4000_PS_RESULT_HI, val); VCNL4000_PS_RESULT_HI, val);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = IIO_VAL_INT; return IIO_VAL_INT;
break;
default: default:
break; return -EINVAL;
} }
break;
case IIO_CHAN_INFO_SCALE: case IIO_CHAN_INFO_SCALE:
if (chan->type == IIO_LIGHT) { if (chan->type != IIO_LIGHT)
*val = 0; return -EINVAL;
*val2 = 250000;
ret = IIO_VAL_INT_PLUS_MICRO; *val = 0;
} *val2 = 250000;
break; return IIO_VAL_INT_PLUS_MICRO;
default: default:
break; return -EINVAL;
} }
return ret;
} }
static const struct iio_info vcnl4000_info = { static const struct iio_info vcnl4000_info = {
......
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