diff options
Diffstat (limited to 'drivers/iio/magnetometer/ak8975.c')
-rw-r--r-- | drivers/iio/magnetometer/ak8975.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c index 09ea5c481f4c..ea08313af0d2 100644 --- a/drivers/iio/magnetometer/ak8975.c +++ b/drivers/iio/magnetometer/ak8975.c | |||
@@ -373,8 +373,6 @@ static int ak8975_read_axis(struct iio_dev *indio_dev, int index, int *val) | |||
373 | { | 373 | { |
374 | struct ak8975_data *data = iio_priv(indio_dev); | 374 | struct ak8975_data *data = iio_priv(indio_dev); |
375 | struct i2c_client *client = data->client; | 375 | struct i2c_client *client = data->client; |
376 | u16 meas_reg; | ||
377 | s16 raw; | ||
378 | int ret; | 376 | int ret; |
379 | 377 | ||
380 | mutex_lock(&data->lock); | 378 | mutex_lock(&data->lock); |
@@ -422,16 +420,11 @@ static int ak8975_read_axis(struct iio_dev *indio_dev, int index, int *val) | |||
422 | dev_err(&client->dev, "Read axis data fails\n"); | 420 | dev_err(&client->dev, "Read axis data fails\n"); |
423 | goto exit; | 421 | goto exit; |
424 | } | 422 | } |
425 | meas_reg = ret; | ||
426 | 423 | ||
427 | mutex_unlock(&data->lock); | 424 | mutex_unlock(&data->lock); |
428 | 425 | ||
429 | /* Endian conversion of the measured values. */ | ||
430 | raw = (s16) (le16_to_cpu(meas_reg)); | ||
431 | |||
432 | /* Clamp to valid range. */ | 426 | /* Clamp to valid range. */ |
433 | raw = clamp_t(s16, raw, -4096, 4095); | 427 | *val = clamp_t(s16, ret, -4096, 4095); |
434 | *val = raw; | ||
435 | return IIO_VAL_INT; | 428 | return IIO_VAL_INT; |
436 | 429 | ||
437 | exit: | 430 | exit: |