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/amdgpu: use bitmap_clear() in amdgpu_amdkfd_device_init() Date: Tue, 28 Apr 2026 13:43:04 +1000 Message-ID: In-Reply-To: <20260428023536.449877-1-ynorov@nvidia.com> References: <20260428023536.449877-1-ynorov@nvidia.com> <20260428023536.449877-1-ynorov@nvidia.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review **Correctness:** The transformation from: ```c for (i =3D 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), whi= le `bitmap_clear()` uses `__bitmap_clear()` (non-atomic) for the runtime-nb= its path. This is fine because `gpu_resources` is a local variable on the s= tack =E2=80=94 it was just initialized a few lines above and no other threa= d can observe it. There is no need for atomic operations on stack-local dat= a. **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-con= stant `nbits` via `__bitmap_clear()`. **Removal of `int i`:** Clean =E2=80=94 the loop variable is no longer need= ed, 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, whi= ch results in slightly unusual indentation but is consistent with the surro= unding code style (e.g., the `bitmap_complement` call just above uses the s= ame pattern). **No functional concerns.** This is a clean, correct simplification. **Reviewed-by recommendation: Yes.** --- Generated by Claude Code Patch Reviewer