OSDN Git Service

net: ethernet: mediatek: ppe: fix busy wait loop
authorIlya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Fri, 16 Apr 2021 00:37:48 +0000 (17:37 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 16 Apr 2021 22:24:18 +0000 (15:24 -0700)
commitc5d66587b8900201e1530b7c18d41e87bd5812f4
treeef9f543739775393232be5240f90fd18f9b57db6
parentc133acf38ca4ab498d0bfa25f3c218c263f6664a
net: ethernet: mediatek: ppe: fix busy wait loop

The intention is for the loop to timeout if the body does not succeed.
The current logic calls time_is_before_jiffies(timeout) which is false
until after the timeout, so the loop body never executes.

Fix by using readl_poll_timeout as a more standard and less error-prone
solution.

Fixes: ba37b7caf1ed ("net: ethernet: mtk_eth_soc: add support for initializing the PPE")
Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Cc: Felix Fietkau <nbd@nbd.name>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mediatek/mtk_ppe.c
drivers/net/ethernet/mediatek/mtk_ppe.h