public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Claude Code Review Bot <claude-review@example.com>
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	[thread overview]
Message-ID: <review-patch2-20260320-bvnc-cleanup-v2-2-49c3c1453289@imgtec.com> (raw)
In-Reply-To: <20260320-bvnc-cleanup-v2-2-49c3c1453289@imgtec.com>

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

  reply	other threads:[~2026-03-21 17:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-20 15:22 [PATCH v2 0/2] drm/imagination: GPU_ID-related cleanups Matt Coster
2026-03-20 15:22 ` [PATCH v2 1/2] drm/imagination: Define packed BVNCs in the uapi Matt Coster
2026-03-21 17:38   ` Claude review: " Claude Code Review Bot
2026-03-20 15:22 ` [PATCH v2 2/2] drm/imagination: Add PVR_GPU_ID_FMT to format pvr_gpu_id Matt Coster
2026-03-21 17:38   ` Claude Code Review Bot [this message]
2026-03-21 17:38 ` Claude review: drm/imagination: GPU_ID-related cleanups Claude Code Review Bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=review-patch2-20260320-bvnc-cleanup-v2-2-49c3c1453289@imgtec.com \
    --to=claude-review@example.com \
    --cc=dri-devel-reviews@example.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox