[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210817175630.GB30136@amd>
Date: Tue, 17 Aug 2021 19:56:30 +0200
From: Pavel Machek <pavel@...x.de>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Ben Hutchings <ben.hutchings@...d.be>,
"David S. Miller" <davem@...emloft.net>,
Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 5.10 51/96] net: dsa: microchip: Fix ksz_read64()
Hi!
> [ Upstream commit c34f674c8875235725c3ef86147a627f165d23b4 ]
>
> 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.
The code indeed is very strange, but there are just 2 users, and they
will now receive byteswapped values, right? If it worked before, it
will be broken.
Did this get enough testing for -stable?
Is hw little endian or high endian or...? Note that ksz_write64()
still contains the strange code, at least in 5.10.
Best regards,
Pavel
> +++ b/drivers/net/dsa/microchip/ksz_common.h
> @@ -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;
> }
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists