diff options
author | Sachin Kamat <sachin.kamat@samsung.com> | 2014-03-07 02:44:00 -0500 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2014-07-05 06:07:38 -0400 |
commit | 5d24b0b37bd5229227d0271c58b15aeb52e9c966 (patch) | |
tree | 94a638e951ce51af85ddd0322c277fca9d362c45 /drivers/iio/light | |
parent | 5f25b41f7ec242fce43d0f745369c0ba9d25cb72 (diff) |
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: Sachin Kamat <sachin.kamat@samsung.com>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/light')
-rw-r--r-- | drivers/iio/light/hid-sensor-als.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c index f34c94380b41..96e71e103ea7 100644 --- a/drivers/iio/light/hid-sensor-als.c +++ b/drivers/iio/light/hid-sensor-als.c | |||
@@ -79,7 +79,6 @@ static int als_read_raw(struct iio_dev *indio_dev, | |||
79 | struct als_state *als_state = iio_priv(indio_dev); | 79 | struct als_state *als_state = iio_priv(indio_dev); |
80 | int report_id = -1; | 80 | int report_id = -1; |
81 | u32 address; | 81 | u32 address; |
82 | int ret; | ||
83 | int ret_type; | 82 | int ret_type; |
84 | s32 poll_value; | 83 | s32 poll_value; |
85 | 84 | ||
@@ -129,14 +128,12 @@ static int als_read_raw(struct iio_dev *indio_dev, | |||
129 | ret_type = IIO_VAL_INT; | 128 | ret_type = IIO_VAL_INT; |
130 | break; | 129 | break; |
131 | case IIO_CHAN_INFO_SAMP_FREQ: | 130 | case IIO_CHAN_INFO_SAMP_FREQ: |
132 | ret = hid_sensor_read_samp_freq_value( | 131 | ret_type = hid_sensor_read_samp_freq_value( |
133 | &als_state->common_attributes, val, val2); | 132 | &als_state->common_attributes, val, val2); |
134 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
135 | break; | 133 | break; |
136 | case IIO_CHAN_INFO_HYSTERESIS: | 134 | case IIO_CHAN_INFO_HYSTERESIS: |
137 | ret = hid_sensor_read_raw_hyst_value( | 135 | ret_type = hid_sensor_read_raw_hyst_value( |
138 | &als_state->common_attributes, val, val2); | 136 | &als_state->common_attributes, val, val2); |
139 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
140 | break; | 137 | break; |
141 | default: | 138 | default: |
142 | ret_type = -EINVAL; | 139 | ret_type = -EINVAL; |