ntb_hw_switchtec: Fix bug with more than 32 partitions
authorWesley Sheng <wesley.sheng@microchip.com>
Fri, 24 Dec 2021 01:23:30 +0000 (17:23 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Mar 2022 18:12:37 +0000 (19:12 +0100)
commit950d17f190a4f8b9e2938f2bc11b5f48a9b0e840
tree8fe83eb7e63faaea389cef4690cc31b6501e794a
parent377cbdc9271613f559b8879b10ec6ea9c7cafaed
ntb_hw_switchtec: Fix bug with more than 32 partitions

[ Upstream commit 7ff351c86b6b258f387502ab2c9b9d04f82c1c3d ]

Switchtec could support as mush as 48 partitions, but ffs & fls are
for 32 bit argument, in case of partition index larger than 31, the
current code could not parse the peer partition index correctly.
Change to the 64 bit version __ffs64 & fls64 accordingly to fix this
bug.

Fixes: 3df54c870f52 ("ntb_hw_switchtec: Allow using Switchtec NTB in multi-partition setups")
Signed-off-by: Wesley Sheng <wesley.sheng@microchip.com>
Signed-off-by: Kelvin Cao <kelvin.cao@microchip.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/ntb/hw/mscc/ntb_hw_switchtec.c