Commit 5d24b0b3 authored by Sachin Kamat's avatar Sachin Kamat Committed by Jonathan Cameron

iio: hid-sensor-als: Fix return values

IIO_CHAN_INFO_SAMP_FREQ and IIO_CHAN_INFO_HYSTERESIS cases ignored
the actual return values (which could be -EINVAL) and instead
returned IIO_VAL_INT_PLUS_MICRO always. Return the actual value
obtained from the functions. Both functions return IIO_VAL_INT_PLUS_MICRO
upon success.
Signed-off-by: default avatarSachin Kamat <sachin.kamat@samsung.com>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 5f25b41f
...@@ -79,7 +79,6 @@ static int als_read_raw(struct iio_dev *indio_dev, ...@@ -79,7 +79,6 @@ static int als_read_raw(struct iio_dev *indio_dev,
struct als_state *als_state = iio_priv(indio_dev); struct als_state *als_state = iio_priv(indio_dev);
int report_id = -1; int report_id = -1;
u32 address; u32 address;
int ret;
int ret_type; int ret_type;
s32 poll_value; s32 poll_value;
...@@ -129,14 +128,12 @@ static int als_read_raw(struct iio_dev *indio_dev, ...@@ -129,14 +128,12 @@ static int als_read_raw(struct iio_dev *indio_dev,
ret_type = IIO_VAL_INT; ret_type = IIO_VAL_INT;
break; break;
case IIO_CHAN_INFO_SAMP_FREQ: case IIO_CHAN_INFO_SAMP_FREQ:
ret = hid_sensor_read_samp_freq_value( ret_type = hid_sensor_read_samp_freq_value(
&als_state->common_attributes, val, val2); &als_state->common_attributes, val, val2);
ret_type = IIO_VAL_INT_PLUS_MICRO;
break; break;
case IIO_CHAN_INFO_HYSTERESIS: case IIO_CHAN_INFO_HYSTERESIS:
ret = hid_sensor_read_raw_hyst_value( ret_type = hid_sensor_read_raw_hyst_value(
&als_state->common_attributes, val, val2); &als_state->common_attributes, val, val2);
ret_type = IIO_VAL_INT_PLUS_MICRO;
break; break;
default: default:
ret_type = -EINVAL; ret_type = -EINVAL;
......
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