Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b82465c1 authored by Jonathan Cameron's avatar Jonathan Cameron Committed by Greg Kroah-Hartman
Browse files

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: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Fixes: 065a7c0b ("Staging: iio: adc: ad7280a.c: Fixed Macro argument reuse")
Reviewed-by: default avatarMarcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://lore.kernel.org/r/20220206190328.333093-2-jic23@kernel.org


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 3ba01431
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -107,9 +107,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);
}