Skip to contentSkip to conversation

drm/imagination: Convert to use time_before macro

PATCH Superseded Chen Yufan 1 participant 1 message Aug 23, 2024

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Chen Yufan

author
#0 lore raw

PATCH v2 1/1 drm/imagination: Convert to use time_before macro

Use time_*() macros instead of using
jiffies directly to handle overflow issues.

Fixes cc1aeedb98ad ("drm/imagination: Convert to use time_before macro")

---
The modifications made compared to the previous version are as follows:
1. Change the prefix of subject.
2. Add fixes.
3. Drop the cast of RESERVE_SLOT_TIMEOUT.

---
 drivers/gpu/drm/imagination/pvr_ccb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/imagination/pvr_ccb.c +1 -1
index 4deeac7ed..2bbdc05a3 100644
@@ -321,7 +321,7 @@ static int pvr_kccb_reserve_slot_sync(struct pvr_device *pvr_dev)
 	bool reserved = false;
 	u32 retries = 0;
 
-	while ((jiffies - start_timestamp) < (u32)RESERVE_SLOT_TIMEOUT ||
+	while (time_before(jiffies, start_timestamp + RESERVE_SLOT_TIMEOUT) ||
 	       retries < RESERVE_SLOT_MIN_RETRIES) {
 		reserved = pvr_kccb_try_reserve_slot(pvr_dev);
 		if (reserved)
Signature · 1 line
2.39.0