From: Sasha Levin Date: Tue, 9 Jun 2020 12:03:27 +0000 (-0400) Subject: Fixes for 4.4 X-Git-Tag: v5.7.2~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fa444eb4fd1caab0617241a7f034a134bfdb279c;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.4 Signed-off-by: Sasha Levin --- diff --git a/queue-4.4/iio-vcnl4000-fix-i2c-swapped-word-reading.patch b/queue-4.4/iio-vcnl4000-fix-i2c-swapped-word-reading.patch new file mode 100644 index 00000000000..1c4cc8f5211 --- /dev/null +++ b/queue-4.4/iio-vcnl4000-fix-i2c-swapped-word-reading.patch @@ -0,0 +1,55 @@ +From d27e0a4b197ae81590b15fade347d18e3815d086 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 3 May 2020 11:29:55 +0200 +Subject: iio: vcnl4000: Fix i2c swapped word reading. + +From: Mathieu Othacehe + +[ Upstream commit 18dfb5326370991c81a6d1ed6d1aeee055cb8c05 ] + +The bytes returned by the i2c reading need to be swapped +unconditionally. Otherwise, on be16 platforms, an incorrect value will be +returned. + +Taking the slow path via next merge window as its been around a while +and we have a patch set dependent on this which would be held up. + +Fixes: 62a1efb9f868 ("iio: add vcnl4000 combined ALS and proximity sensor") +Signed-off-by: Mathieu Othacehe +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Sasha Levin +--- + drivers/iio/light/vcnl4000.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c +index c9d85bbc9230..a17891511be5 100644 +--- a/drivers/iio/light/vcnl4000.c ++++ b/drivers/iio/light/vcnl4000.c +@@ -56,7 +56,6 @@ static int vcnl4000_measure(struct vcnl4000_data *data, u8 req_mask, + u8 rdy_mask, u8 data_reg, int *val) + { + int tries = 20; +- __be16 buf; + int ret; + + ret = i2c_smbus_write_byte_data(data->client, VCNL4000_COMMAND, +@@ -80,12 +79,11 @@ static int vcnl4000_measure(struct vcnl4000_data *data, u8 req_mask, + return -EIO; + } + +- ret = i2c_smbus_read_i2c_block_data(data->client, +- data_reg, sizeof(buf), (u8 *) &buf); ++ ret = i2c_smbus_read_word_swapped(data->client, data_reg); + if (ret < 0) + return ret; + +- *val = be16_to_cpu(buf); ++ *val = ret; + + return 0; + } +-- +2.25.1 + diff --git a/queue-4.4/series b/queue-4.4/series index 50c29d17688..e85db644154 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -26,3 +26,4 @@ usb-serial-usb_wwan-do-not-resubmit-rx-urb-on-fatal-errors.patch usb-serial-option-add-telit-le910c1-eux-compositions.patch vt-keyboard-avoid-signed-integer-overflow-in-k_ascii.patch staging-rtl8712-fix-ieee80211_addba_param_buf_size_mask.patch +iio-vcnl4000-fix-i2c-swapped-word-reading.patch