aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/light
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@samsung.com>2014-03-07 02:44:00 -0500
committerJonathan Cameron <jic23@kernel.org>2014-07-05 06:09:46 -0400
commit4ff9f633c35e2d94eb92f92c48ae0d9172242889 (patch)
tree75aabaf5373459723a60ac8b5fda153aeffa5f7f /drivers/iio/light
parent27793803f2ea876799cc44e05bb28d34b34a3869 (diff)
iio: hid-sensor-prox: 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-prox.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c
index d203ef4d892f..412bae86d6ae 100644
--- a/drivers/iio/light/hid-sensor-prox.c
+++ b/drivers/iio/light/hid-sensor-prox.c
@@ -74,7 +74,6 @@ static int prox_read_raw(struct iio_dev *indio_dev,
74 struct prox_state *prox_state = iio_priv(indio_dev); 74 struct prox_state *prox_state = iio_priv(indio_dev);
75 int report_id = -1; 75 int report_id = -1;
76 u32 address; 76 u32 address;
77 int ret;
78 int ret_type; 77 int ret_type;
79 s32 poll_value; 78 s32 poll_value;
80 79
@@ -125,14 +124,12 @@ static int prox_read_raw(struct iio_dev *indio_dev,
125 ret_type = IIO_VAL_INT; 124 ret_type = IIO_VAL_INT;
126 break; 125 break;
127 case IIO_CHAN_INFO_SAMP_FREQ: 126 case IIO_CHAN_INFO_SAMP_FREQ:
128 ret = hid_sensor_read_samp_freq_value( 127 ret_type = hid_sensor_read_samp_freq_value(
129 &prox_state->common_attributes, val, val2); 128 &prox_state->common_attributes, val, val2);
130 ret_type = IIO_VAL_INT_PLUS_MICRO;
131 break; 129 break;
132 case IIO_CHAN_INFO_HYSTERESIS: 130 case IIO_CHAN_INFO_HYSTERESIS:
133 ret = hid_sensor_read_raw_hyst_value( 131 ret_type = hid_sensor_read_raw_hyst_value(
134 &prox_state->common_attributes, val, val2); 132 &prox_state->common_attributes, val, val2);
135 ret_type = IIO_VAL_INT_PLUS_MICRO;
136 break; 133 break;
137 default: 134 default:
138 ret_type = -EINVAL; 135 ret_type = -EINVAL;