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: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
This commit is contained in:
		 Ilya Lipnitskiy
					Ilya Lipnitskiy
				
			
				
					committed by
					
						 Felix Fietkau
						Felix Fietkau
					
				
			
			
				
	
			
			
			 Felix Fietkau
						Felix Fietkau
					
				
			
						parent
						
							f378d81da6
						
					
				
				
					commit
					3da4acaa7b
				
			| @@ -183,7 +183,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> | ||||
| +{ | ||||
| +	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; | ||||
| + | ||||
|   | ||||
		Reference in New Issue
	
	Block a user