OSDN Git Service

brcmfmac: pcie: Replace brcmf_pcie_copy_mem_todev with memcpy_toio
authorHector Martin <marcan@marcan.st>
Mon, 31 Jan 2022 16:07:09 +0000 (01:07 +0900)
committerKalle Valo <kvalo@kernel.org>
Tue, 1 Feb 2022 12:27:05 +0000 (14:27 +0200)
commit9466987f246758eb7e9071ae58005253f631271e
tree167e2260c8943c43eb3a822fead6a37187340647
parent6d766d8cb505ec1fae63da8faef4fc5712c3d794
brcmfmac: pcie: Replace brcmf_pcie_copy_mem_todev with memcpy_toio

The alignment check was wrong (e.g. & 4 instead of & 3), and the logic
was also inefficient if the length was not a multiple of 4, since it
would needlessly fall back to copying the entire buffer bytewise.

We already have a perfectly good memcpy_toio function, so just call that
instead of rolling our own copy logic here. brcmf_pcie_init_ringbuffers
was already using it anyway.

Fixes: 9e37f045d5e7 ("brcmfmac: Adding PCIe bus layer support.")
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Hector Martin <marcan@marcan.st>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220131160713.245637-6-marcan@marcan.st
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c