Skip to content
Snippets Groups Projects
Commit 3da4acaa authored by Ilya Lipnitskiy's avatar Ilya Lipnitskiy Committed by Felix Fietkau
Browse files

kernel: fix busy wait loop in mediatek PPE code


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.

Signed-off-by: default avatarIlya Lipnitskiy <ilya.lipnitskiy@gmail.com>
parent f378d81d
No related branches found
No related tags found
No related merge requests found
...@@ -183,7 +183,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> ...@@ -183,7 +183,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
+{ +{
+ unsigned long timeout = jiffies + HZ; + 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)) + if (!(ppe_r32(ppe, MTK_PPE_GLO_CFG) & MTK_PPE_GLO_CFG_BUSY))
+ return 0; + return 0;
+ +
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment