[02/17] iio: accel: kxsd9: Fix raw read return

Message ID 1471354423-19186-3-git-send-email-linus.walleij@linaro.org
State Accepted
Commit 7ac61a062f3147dc23e3f12b9dfe7c4dd35f9cb8
Headers show

Commit Message

Linus Walleij Aug. 16, 2016, 1:33 p.m.
Any readings from the raw interface of the KXSD9 driver will
return an empty string, because it does not return
IIO_VAL_INT but rather some random value from the accelerometer
to the caller.

Cc: stable@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

---
 drivers/iio/accel/kxsd9.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Linus Walleij Aug. 17, 2016, 7:15 a.m. | #1
On Tue, Aug 16, 2016 at 6:24 PM, Jonathan Cameron <jic23@kernel.org> wrote:

> *whistles whilst pretending this driver has nothing to do with me*

>

> What's really odd is I ran this not long ago and didn't notice this little

> quirk...


Yeah I remember you mentioned it... there must be something that
made it work and tick anyways. Maybe core changes?

If you can get the SPI-based system up we can get the driver in
really nice shape though! It's working like a charm for me at the
end of the series.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c
index 3a9f106787d2..da5fb67ecb34 100644
--- a/drivers/iio/accel/kxsd9.c
+++ b/drivers/iio/accel/kxsd9.c
@@ -160,6 +160,7 @@  static int kxsd9_read_raw(struct iio_dev *indio_dev,
 		if (ret < 0)
 			goto error_ret;
 		*val = ret;
+		ret = IIO_VAL_INT;
 		break;
 	case IIO_CHAN_INFO_SCALE:
 		ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C));