public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] accel/ivpu: Apply minor code style cleanups to align with kernel style
@ 2026-03-10 12:07 Karol Wachowski
  2026-03-11  3:17 ` Claude review: " Claude Code Review Bot
  2026-03-11  3:17 ` Claude Code Review Bot
  0 siblings, 2 replies; 3+ messages in thread
From: Karol Wachowski @ 2026-03-10 12:07 UTC (permalink / raw)
  To: dri-devel
  Cc: oded.gabbay, jeff.hugo, maciej.falkowski, lizhi.hou,
	andrzej.kacprowski, Karol Wachowski

Replace direct import_attach test with drm_gem_is_imported()
in ivpu_bo_bind().

Replace kzalloc(sizeof(*bo), GFP_KERNEL) with kzalloc_obj()
in ivpu_gem_create_object().

Remove unnecessary cast to bool in ivpu_dbg_bo().

No functional changes.

Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com>
---
 drivers/accel/ivpu/ivpu_gem.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/accel/ivpu/ivpu_gem.c b/drivers/accel/ivpu/ivpu_gem.c
index 8009965286e0..4f2005a8d496 100644
--- a/drivers/accel/ivpu/ivpu_gem.c
+++ b/drivers/accel/ivpu/ivpu_gem.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (C) 2020-2023 Intel Corporation
+ * Copyright (C) 2020-2026 Intel Corporation
  */
 
 #include <linux/dma-buf.h>
@@ -31,7 +31,7 @@ static inline void ivpu_dbg_bo(struct ivpu_device *vdev, struct ivpu_bo *bo, con
 		 "%6s: bo %8p size %9zu ctx %d vpu_addr %9llx pages %d sgt %d mmu_mapped %d wc %d imported %d\n",
 		 action, bo, ivpu_bo_size(bo), bo->ctx_id, bo->vpu_addr,
 		 (bool)bo->base.pages, (bool)bo->base.sgt, bo->mmu_mapped, bo->base.map_wc,
-		 (bool)drm_gem_is_imported(&bo->base.base));
+		 drm_gem_is_imported(&bo->base.base));
 }
 
 static inline int ivpu_bo_lock(struct ivpu_bo *bo)
@@ -81,7 +81,7 @@ int __must_check ivpu_bo_bind(struct ivpu_bo *bo)
 
 	ivpu_dbg_bo(vdev, bo, "bind");
 
-	if (bo->base.base.import_attach)
+	if (drm_gem_is_imported(&bo->base.base))
 		sgt = ivpu_bo_map_attachment(vdev, bo);
 	else
 		sgt = drm_gem_shmem_get_pages_sgt(&bo->base);
@@ -195,7 +195,7 @@ struct drm_gem_object *ivpu_gem_create_object(struct drm_device *dev, size_t siz
 	if (size == 0 || !PAGE_ALIGNED(size))
 		return ERR_PTR(-EINVAL);
 
-	bo = kzalloc(sizeof(*bo), GFP_KERNEL);
+	bo = kzalloc_obj(*bo);
 	if (!bo)
 		return ERR_PTR(-ENOMEM);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Claude review: accel/ivpu: Apply minor code style cleanups to align with kernel style
  2026-03-10 12:07 [PATCH] accel/ivpu: Apply minor code style cleanups to align with kernel style Karol Wachowski
  2026-03-11  3:17 ` Claude review: " Claude Code Review Bot
@ 2026-03-11  3:17 ` Claude Code Review Bot
  1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-03-11  3:17 UTC (permalink / raw)
  To: dri-devel-reviews

Overall Series Review

Subject: accel/ivpu: Apply minor code style cleanups to align with kernel style
Author: Karol Wachowski <karol.wachowski@linux.intel.com>
Patches: 1
Reviewed: 2026-03-11T13:17:57.140385

---

This is a single, straightforward cleanup patch with three small changes to `drivers/accel/ivpu/ivpu_gem.c`. All changes are cosmetic/style-related with no functional impact:

1. Using `drm_gem_is_imported()` helper instead of direct `import_attach` field access
2. Using `kzalloc_obj()` macro instead of raw `kzalloc(sizeof(*bo), GFP_KERNEL)`
3. Removing an unnecessary `(bool)` cast on a function that already returns `bool`

Plus a copyright year bump. The patch is clean and correct.

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Claude review: accel/ivpu: Apply minor code style cleanups to align with kernel style
  2026-03-10 12:07 [PATCH] accel/ivpu: Apply minor code style cleanups to align with kernel style Karol Wachowski
@ 2026-03-11  3:17 ` Claude Code Review Bot
  2026-03-11  3:17 ` Claude Code Review Bot
  1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-03-11  3:17 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

**Change 1: Remove `(bool)` cast from `drm_gem_is_imported()` (line 104→105)**

```c
-		 (bool)drm_gem_is_imported(&bo->base.base));
+		 drm_gem_is_imported(&bo->base.base));
```

Correct. `drm_gem_is_imported()` is defined in `include/drm/drm_gem.h:646` as returning `bool`, so the cast is redundant. Note that the remaining `(bool)` casts on `bo->base.pages` and `bo->base.sgt` (line 33) are intentionally kept — those convert pointers to boolean values for the `%d` format specifier, which is a different situation.

**Change 2: Use `drm_gem_is_imported()` in `ivpu_bo_bind()` (line 113→114)**

```c
-	if (bo->base.base.import_attach)
+	if (drm_gem_is_imported(&bo->base.base))
```

Correct. `drm_gem_is_imported()` does `return !!obj->import_attach;` which is semantically identical when used in a boolean/`if` context. Using the accessor is preferred over direct field access.

**Change 3: Use `kzalloc_obj()` in `ivpu_gem_create_object()` (line 122→123)**

```c
-	bo = kzalloc(sizeof(*bo), GFP_KERNEL);
+	bo = kzalloc_obj(*bo);
```

Correct. The `kzalloc_obj(P, ...)` macro expands to `__alloc_objs(kzalloc, default_gfp(__VA_ARGS__), typeof(P), 1)`, where `default_gfp()` with no extra args defaults to `GFP_KERNEL`. So `kzalloc_obj(*bo)` is equivalent to `kzalloc(sizeof(*bo), GFP_KERNEL)`.

**Copyright year update (line 95→96)**

```c
- * Copyright (C) 2020-2023 Intel Corporation
+ * Copyright (C) 2020-2026 Intel Corporation
```

Fine, though this jumps from 2023 to 2026 — presumably no changes were copyrightable in 2024-2025, so this is acceptable.

**Minor nit:** The commit message says "Replace direct import_attach test with `drm_gem_is_imported()` in `ivpu_bo_bind()`" but doesn't mention that the same function's return value also had a `(bool)` cast removed in `ivpu_dbg_bo()`. The third bullet does mention removing the cast, but doesn't clarify it's on the same helper function call. This is a very minor clarity issue in the commit message.

**Verdict:** Patch looks good. No functional or correctness concerns. All three changes align with current kernel coding conventions.

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-11  3:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-10 12:07 [PATCH] accel/ivpu: Apply minor code style cleanups to align with kernel style Karol Wachowski
2026-03-11  3:17 ` Claude review: " Claude Code Review Bot
2026-03-11  3:17 ` Claude Code Review Bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox