Skip to content

Commit

Permalink
iio: light: vcnl4000: Cleanup read_raw() returns
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
  • Loading branch information
Peter Meerwald-Stadler authored and Jonathan Cameron committed Jul 10, 2016
1 parent ff6a525 commit 5d69313
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions drivers/iio/light/vcnl4000.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static int vcnl4000_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long mask)
{
int ret = -EINVAL;
int ret;
struct vcnl4000_data *data = iio_priv(indio_dev);

switch (mask) {
Expand All @@ -121,32 +121,27 @@ static int vcnl4000_read_raw(struct iio_dev *indio_dev,
VCNL4000_AL_RESULT_HI, val);
if (ret < 0)
return ret;
ret = IIO_VAL_INT;
break;
return IIO_VAL_INT;
case IIO_PROXIMITY:
ret = vcnl4000_measure(data,
VCNL4000_PS_OD, VCNL4000_PS_RDY,
VCNL4000_PS_RESULT_HI, val);
if (ret < 0)
return ret;
ret = IIO_VAL_INT;
break;
return IIO_VAL_INT;
default:
break;
return -EINVAL;
}
break;
case IIO_CHAN_INFO_SCALE:
if (chan->type == IIO_LIGHT) {
*val = 0;
*val2 = 250000;
ret = IIO_VAL_INT_PLUS_MICRO;
}
break;
if (chan->type != IIO_LIGHT)
return -EINVAL;

*val = 0;
*val2 = 250000;
return IIO_VAL_INT_PLUS_MICRO;
default:
break;
return -EINVAL;
}

return ret;
}

static const struct iio_info vcnl4000_info = {
Expand Down

0 comments on commit 5d69313

Please sign in to comment.