From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: drm/imagination: Add PVR_GPU_ID_FMT to format pvr_gpu_id Date: Sun, 22 Mar 2026 03:38:21 +1000 Message-ID: In-Reply-To: <20260320-bvnc-cleanup-v2-2-49c3c1453289@imgtec.com> References: <20260320-bvnc-cleanup-v2-0-49c3c1453289@imgtec.com> <20260320-bvnc-cleanup-v2-2-49c3c1453289@imgtec.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review **Overall:** Straightforward and correct. Fixes a real (if minor) bug with format specifiers. **Format macros are well-designed:** ```c #define PVR_GPU_ID_FMT "%u.%u.%u.%u" #define PVR_GPU_ID_FMT_ARGS(gpu_id) (gpu_id)->b, (gpu_id)->v, (gpu_id)->n, (gpu_id)->c #define PVR_GPU_ID_FMT_ARGS_PACKED(gpu_id) \ (u32)FIELD_GET(DRM_PVR_BVNC_B, gpu_id), (u32)FIELD_GET(DRM_PVR_BVNC_V, gpu_id), \ (u32)FIELD_GET(DRM_PVR_BVNC_N, gpu_id), (u32)FIELD_GET(DRM_PVR_BVNC_C, gpu_id) ``` Using `%u` is correct since the struct fields are `u16`. The `(u32)` casts in the packed variant are appropriate because `FIELD_GET` returns `u64` and `%u` expects `unsigned int`. **The pvr_fw.c simplification is a nice win:** ```c drm_err(drm_dev, "FW built for incorrect GPU ID " PVR_GPU_ID_FMT " (expected " PVR_GPU_ID_FMT ")\n", PVR_GPU_ID_FMT_ARGS_PACKED(header->bvnc), PVR_GPU_ID_FMT_ARGS(&pvr_dev->gpu_id)); ``` This eliminates the temporary `fw_gpu_id` variable and the intermediate `packed_bvnc_to_pvr_gpu_id()` call in the error path, which is cleaner. **Minor observation:** `PVR_GPU_ID_FMT_ARGS` evaluates `gpu_id` four times. If someone passed an expression with side effects, it would be evaluated four times. This is a common pattern for such macros in the kernel and all current callers pass simple pointer expressions, so this is fine in practice. **No issues found.** Reviewed-by worthy. --- Generated by Claude Code Patch Reviewer