Commit ccc1fe82 authored by Ben Hutchings's avatar Ben Hutchings Committed by Greg Kroah-Hartman
Browse files

net: dsa: microchip: Fix ksz_read64()



[ Upstream commit c34f674c ]

ksz_read64() currently does some dubious byte-swapping on the two
halves of a 64-bit register, and then only returns the high bits.
Replace this with a straightforward expression.

Fixes: e66f840c ("net: dsa: ksz: Add Microchip KSZ8795 DSA driver")
Signed-off-by: default avatarBen Hutchings <ben.hutchings@mind.be>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 558092b8
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -210,12 +210,8 @@ static inline int ksz_read64(struct ksz_device *dev, u32 reg, u64 *val)
	int ret;

	ret = regmap_bulk_read(dev->regmap[2], reg, value, 2);
	if (!ret) {
		/* Ick! ToDo: Add 64bit R/W to regmap on 32bit systems */
		value[0] = swab32(value[0]);
		value[1] = swab32(value[1]);
		*val = swab64((u64)*value);
	}
	if (!ret)
		*val = (u64)value[0] << 32 | value[1];

	return ret;
}