From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/amdgpu: use bitmap_clear() in amdgpu_amdkfd_device_init()
Date: Tue, 28 Apr 2026 13:43:04 +1000 [thread overview]
Message-ID: <review-patch1-20260428023536.449877-1-ynorov@nvidia.com> (raw)
In-Reply-To: <20260428023536.449877-1-ynorov@nvidia.com>
Patch Review
**Correctness:**
The transformation from:
```c
for (i = last_valid_bit; i < AMDGPU_MAX_QUEUES; ++i)
clear_bit(i, gpu_resources.cp_queue_bitmap);
```
to:
```c
bitmap_clear(gpu_resources.cp_queue_bitmap, last_valid_bit,
AMDGPU_MAX_QUEUES - last_valid_bit);
```
is semantically correct. Both clear the same range of bits `[last_valid_bit, AMDGPU_MAX_QUEUES)`.
**Atomicity change is safe:** The old code used `clear_bit()` (atomic), while `bitmap_clear()` uses `__bitmap_clear()` (non-atomic) for the runtime-nbits path. This is fine because `gpu_resources` is a local variable on the stack — it was just initialized a few lines above and no other thread can observe it. There is no need for atomic operations on stack-local data.
**Removal of misleading comment:** Correct to remove. The comment:
```c
/* According to linux/bitmap.h we shouldn't use bitmap_clear if
* nbits is not compile time constant
*/
```
was wrong. `bitmap_clear()` at `include/linux/bitmap.h:547` handles non-constant `nbits` via `__bitmap_clear()`.
**Removal of `int i`:** Clean — the loop variable is no longer needed, and `last_valid_bit` is the only remaining local.
**Alignment nit (cosmetic only):** The continuation line aligns `AMDGPU_MAX_QUEUES - last_valid_bit` with a tab+spaces to match the opening paren, which results in slightly unusual indentation but is consistent with the surrounding code style (e.g., the `bitmap_complement` call just above uses the same pattern).
**No functional concerns.** This is a clean, correct simplification.
**Reviewed-by recommendation: Yes.**
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-04-28 3:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-28 2:35 [PATCH v2] drm/amdgpu: use bitmap_clear() in amdgpu_amdkfd_device_init() Yury Norov
2026-04-28 3:43 ` Claude Code Review Bot [this message]
2026-04-28 3:43 ` Claude review: " 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-patch1-20260428023536.449877-1-ynorov@nvidia.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