ImgTec powerVR DRM driver: Convert to use time_before macro
Subsystems (3)
PATCH 1/1 ImgTec powerVR DRM driver: Convert to use time_before macro
Use time_before instead of direct subtraction for readability.
--- drivers/gpu/drm/imagination/pvr_ccb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/imagination/pvr_ccb.c +1 -1
@@ -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 + (u32 )RESERVE_SLOT_TIMEOUT ) || retries <RESERVE_SLOT_MIN_RETRIES ) { reserved =pvr_kccb_try_reserve_slot (pvr_dev);if (reserved)
Signature · 1 line
2.39.0
Hi Chen,
Thanks for the patch! Just a couple minor notes.
Quoted 1 line · Chen Yufan
Subject: [PATCH v1] ImgTec powerVR DRM driver: Convert to use
time_beforemacro
The prefix here should be based on the source path. For us, that's "drm/imagination:".
Quoted 1 line
Use
time_beforeinstead of direct subtraction for readability.
I think the real justification here is correctness. The code as it currently exists is susceptible to overflow issues that are handled correctly by the time_*() macros.
Quoted 1 line
Signed-off-by Chen Yufan <[email protected]>
Please add a Fixes: tag as per [1].
Quoted 9 lines
--- drivers/gpu/drm/imagination/pvr_ccb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/imagination/pvr_ccb.c +0
-0
drivers/gpu/drm/imagination/pvr_ccb.c static int pvr_kccb_reserve_slot_sync(struct pvr_device *pvr_dev) · line 324
Quoted 5 lines
drivers/gpu/drm/imagination/pvr_ccb.c +1
-1@@ -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 + (u32)RESERVE_SLOT_TIMEOUT) ||
You might as well drop the cast here too; it only seems to have existed here as an attempt to correclty deal with overflow.
Cheers,
Matt
[1]: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes
Quoted 3 lines
drivers/gpu/drm/imagination/pvr_ccb.c +0
-0retries < RESERVE_SLOT_MIN_RETRIES) { reserved =pvr_kccb_try_reserve_slot (pvr_dev);if (reserved)