linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: ethernet: mediatek: ppe: fix busy wait loop
@ 2021-04-15 23:02 Ilya Lipnitskiy
  2021-04-15 23:10 ` Andrew Lunn
  0 siblings, 1 reply; 6+ messages in thread
From: Ilya Lipnitskiy @ 2021-04-15 23:02 UTC (permalink / raw)
  To: Felix Fietkau, John Crispin, Sean Wang, Mark Lee,
	David S. Miller, Jakub Kicinski, Matthias Brugger,
	Pablo Neira Ayuso, netdev, linux-arm-kernel, linux-mediatek,
	linux-kernel
  Cc: Ilya Lipnitskiy

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.

time_is_after_jiffies(timeout) will return true until timeout is less
than jiffies, which is the intended behavior here.

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>
---
 drivers/net/ethernet/mediatek/mtk_ppe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c
index 71e1ccea6e72..af3c266297aa 100644
--- a/drivers/net/ethernet/mediatek/mtk_ppe.c
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
@@ -46,7 +46,7 @@ static int mtk_ppe_wait_busy(struct mtk_ppe *ppe)
 {
 	unsigned long timeout = jiffies + HZ;
 
-	while (time_is_before_jiffies(timeout)) {
+	while (time_is_after_jiffies(timeout)) {
 		if (!(ppe_r32(ppe, MTK_PPE_GLO_CFG) & MTK_PPE_GLO_CFG_BUSY))
 			return 0;
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-04-16 22:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-15 23:02 [PATCH net-next] net: ethernet: mediatek: ppe: fix busy wait loop Ilya Lipnitskiy
2021-04-15 23:10 ` Andrew Lunn
2021-04-16  0:11   ` [PATCH net-next,v2] " Ilya Lipnitskiy
2021-04-16  0:27     ` Andrew Lunn
2021-04-16  0:37       ` [PATCH net-next,v3] " Ilya Lipnitskiy
2021-04-16 22:30         ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).