From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/accel/amdxdna: add debugfs support
Date: Mon, 25 May 2026 22:09:05 +1000 [thread overview]
Message-ID: <review-patch1-20260519203236.252068-1-shofiqtest@gmail.com> (raw)
In-Reply-To: <20260519203236.252068-1-shofiqtest@gmail.com>
Patch Review
**1. Superseded by existing implementation (fatal)**
The current tree already has `drivers/accel/amdxdna/amdxdna_debugfs.c` with a working debugfs implementation using `debugfs_create_file()`. The patch attempts to create this file from scratch, which would discard the existing carveout debugfs support. The existing code also already calls `amdxdna_debugfs_init()` from `amdxdna_pci_drv.c` and includes the header.
**2. Wrong field access — `xdna->dev_info->vbnv` does not exist (compilation error)**
```c
+ seq_printf(s, "vbnv: %s\n", xdna->dev_info->vbnv);
```
`struct amdxdna_dev_info` has `default_vbnv` (at `amdxdna_pci_drv.h:96`), not `vbnv`. The resolved vbnv string is stored directly on the device struct at `xdna->vbnv` (`amdxdna_pci_drv.h:128`). This would fail to compile. The existing `amdxdna_sysfs.c` shows the correct access pattern:
```c
// amdxdna_sysfs.c:23
return sprintf(buf, "%s\n", xdna->vbnv);
```
**3. Unconditional Makefile addition breaks `!CONFIG_DEBUG_FS` builds**
```diff
+ amdxdna_debugfs.o \
```
The patch adds `amdxdna_debugfs.o` unconditionally to `amdxdna-y`. The current tree correctly uses:
```makefile
amdxdna-$(CONFIG_DEBUG_FS) += amdxdna_debugfs.o
```
While the header provides a `static inline` stub when `CONFIG_DEBUG_FS` is disabled, the `.c` file includes `<drm/drm_debugfs.h>` and calls `drm_debugfs_add_files()`, which won't be available in `!CONFIG_DEBUG_FS` builds. The Makefile should use the conditional form.
**4. Uses `drm_debugfs_add_files()` / `drm_debugfs_info` instead of the driver's existing pattern**
```c
+static const struct drm_debugfs_info amdxdna_debugfs_list[] = {
+ { "fw_version", fw_version_show, 0 },
+ { "device_info", device_info_show, 0 },
+ { "clients", clients_show, 0 },
+};
+
+void amdxdna_debugfs_init(struct amdxdna_dev *xdna)
+{
+ drm_debugfs_add_files(&xdna->ddev, amdxdna_debugfs_list,
+ ARRAY_SIZE(amdxdna_debugfs_list));
+}
```
The existing code uses `debugfs_create_file()` with custom `file_operations` (via the `AMDXDNA_DBGFS_FOPS` macro), passing `xdna` as `inode->i_private`. The DRM helpers approach passes `entry->dev` through `seq_to_xdna()`. If new entries were to be added, they should follow the existing driver pattern for consistency. The DRM helper approach is cleaner for simple read-only entries, but mixing two different debugfs paradigms in one driver would be confusing.
**5. Copyright year is stale**
```c
+/*
+ * Copyright (C) 2024, Advanced Micro Devices, Inc.
+ */
```
The existing file in the tree uses `Copyright (C) 2026`. New code should use the current year.
**6. Missing NULL check on `xdna->vbnv` (minor, even if field were corrected)**
The existing `amdxdna_sysfs.c:20` checks `if (!xdna->vbnv)` before printing. The debugfs `device_info_show` doesn't, which could print `(null)` if called before firmware initialization populates the vbnv string.
**Recommendation:** If the intent is to add fw_version, device_info, and clients debugfs entries, this should be done as additions to the existing `amdxdna_debugfs.c`, following the established `AMDXDNA_DBGFS_FOPS` / `debugfs_create_file()` pattern, and with the correct field accesses. The patch in its current form cannot be applied.
---
Generated by Claude Code Patch Reviewer
prev parent reply other threads:[~2026-05-25 12:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-19 20:32 [PATCH] drm/accel/amdxdna: add debugfs support Md Shofiqul Islam
2026-05-21 17:34 ` Lizhi Hou
2026-05-25 12:09 ` Claude review: " Claude Code Review Bot
2026-05-25 12:09 ` Claude Code Review Bot [this message]
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-20260519203236.252068-1-shofiqtest@gmail.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