summaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorJonathan Cameron <Jonathan.Cameron@huawei.com>2022-02-06 19:03:09 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-04-15 14:14:51 +0200
commit5d9b2b025010e3e623970a1e0f60e154ebd7ecf4 (patch)
tree070745849d5fc787aa66f287d8b2f997c7963f3c /drivers/staging
parent0a8400ba5752efc008e718c7c8db8be092fe23b3 (diff)
downloadlinux-stable-5d9b2b025010e3e623970a1e0f60e154ebd7ecf4.tar.gz
linux-stable-5d9b2b025010e3e623970a1e0f60e154ebd7ecf4.tar.bz2
linux-stable-5d9b2b025010e3e623970a1e0f60e154ebd7ecf4.zip
staging:iio:adc:ad7280a: Fix handing of device address bit reversing.
[ Upstream commit f281e4ddbbc0b60f061bc18a2834e9363ba85f9f ] The bit reversal was wrong for bits 1 and 3 of the 5 bits. Result is driver failure to probe if you have more than 2 daisy-chained devices. Discovered via QEMU based device emulation. Fixes tag is for when this moved from a macro to a function, but it was broken before that. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Fixes: 065a7c0b1fec ("Staging: iio: adc: ad7280a.c: Fixed Macro argument reuse") Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Link: https://lore.kernel.org/r/20220206190328.333093-2-jic23@kernel.org Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/iio/adc/ad7280a.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
index 6a48ad067a8b..15422d82f812 100644
--- a/drivers/staging/iio/adc/ad7280a.c
+++ b/drivers/staging/iio/adc/ad7280a.c
@@ -102,9 +102,9 @@
static unsigned int ad7280a_devaddr(unsigned int addr)
{
return ((addr & 0x1) << 4) |
- ((addr & 0x2) << 3) |
+ ((addr & 0x2) << 2) |
(addr & 0x4) |
- ((addr & 0x8) >> 3) |
+ ((addr & 0x8) >> 2) |
((addr & 0x10) >> 4);
}