From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/sun4i: Use backend/mixer as dedicated DMA device
Date: Thu, 12 Mar 2026 07:08:43 +1000 [thread overview]
Message-ID: <review-patch4-20260311094929.3393338-5-wenst@chromium.org> (raw)
In-Reply-To: <20260311094929.3393338-5-wenst@chromium.org>
Patch Review
This patch replaces the `of_dma_configure()` hack with proper `drm_dev_set_dma_dev()` calls. The pattern used is:
```c
+ if (drm_dev_dma_dev(drm) == drm->dev)
+ drm_dev_set_dma_dev(drm, dev);
```
This "set only if not already set" logic ensures only the first bound backend/mixer becomes the DMA device, which matches the intent described in the comment. This is correct since `drm_dev_dma_dev()` returns `drm->dev` when no dedicated device has been set (i.e., `dma_dev` is NULL).
A few minor observations:
1. **Comment mismatch in the mixer**: The new comment in `sun8i_mixer.c` says "backends" in two places:
```c
+ * Always use the first bound backend as the DMA device. While
+ * our device trees always have all backends enabled, some in
```
This should say "mixer" instead of "backend" since this is the mixer code. It looks like the comment was copied from `sun4i_backend.c` without adjustment.
2. **Removal of the conditional check**: The old backend code checked `of_property_present(dev->of_node, "interconnects")` and the old mixer code checked `of_property_present(dev->of_node, "iommus")` before calling `of_dma_configure()`. The new code unconditionally sets the DMA device. This is fine — `drm_dev_set_dma_dev()` just takes a device reference and stores it; it doesn't configure anything DMA-related on the device itself. The backend/mixer device already has its DMA configured correctly by the bus code. So this simplification is safe and arguably more correct.
3. **No unbind cleanup**: Neither the backend nor mixer unbind paths clear the DMA device (`drm_dev_set_dma_dev(drm, NULL)`). Looking at the `drm_dev_set_dma_dev` implementation, it does `get_device(dma_dev)` and later `put_device(dev->dma_dev)`, so the DRM device holds a reference to the component device. Since the DRM device is torn down via component framework and `drm_dev_put()` should handle releasing `dma_dev`, this should be fine in practice — but it's worth considering whether there's a lifecycle issue if the backend/mixer device is unbound while the DRM device still holds a reference to it. The `drm_dev_set_dma_dev` function does take a reference via `get_device()`, which would keep the device alive. This matches how MediaTek handles it (no cleanup in deinit either), so it's consistent.
**Summary**: The only concrete issue is the copy-paste comment error in `sun8i_mixer.c` saying "backend" instead of "mixer". Everything else looks correct.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-03-11 21:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-11 9:49 [PATCH v2 0/4] drm/gem-dma: Support dedicated DMA device for allocation Chen-Yu Tsai
2026-03-11 9:49 ` [PATCH v2 1/4] drm/prime: Limit scatter list size with dedicated DMA device Chen-Yu Tsai
2026-03-11 14:40 ` AngeloGioacchino Del Regno
2026-03-11 21:08 ` Claude review: " Claude Code Review Bot
2026-03-11 9:49 ` [PATCH v2 2/4] drm/gem-dma: Support dedicated DMA device for allocation and mapping Chen-Yu Tsai
2026-03-11 14:40 ` AngeloGioacchino Del Regno
2026-03-11 21:08 ` Claude review: " Claude Code Review Bot
2026-03-11 9:49 ` [PATCH v2 3/4] drm/mediatek: Set dedicated DMA device and drop custom GEM callbacks Chen-Yu Tsai
2026-03-11 14:40 ` AngeloGioacchino Del Regno
2026-03-11 21:08 ` Claude review: " Claude Code Review Bot
2026-03-11 9:49 ` [PATCH v2 4/4] drm/sun4i: Use backend/mixer as dedicated DMA device Chen-Yu Tsai
2026-03-11 21:08 ` Claude Code Review Bot [this message]
2026-03-11 21:08 ` Claude review: drm/gem-dma: Support dedicated DMA device for allocation Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-03-10 3:25 [PATCH RESEND 0/4] " Chen-Yu Tsai
2026-03-10 3:25 ` [PATCH RESEND 4/4] drm/sun4i: Use backend/mixer as dedicated DMA device Chen-Yu Tsai
2026-03-11 3:45 ` Claude review: " Claude Code Review Bot
2026-03-10 3:20 [PATCH 0/4] drm/gem-dma: Support dedicated DMA device for allocation Chen-Yu Tsai
2026-03-10 3:20 ` [PATCH 4/4] drm/sun4i: Use backend/mixer as dedicated DMA device Chen-Yu Tsai
2026-03-11 3:48 ` 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-patch4-20260311094929.3393338-5-wenst@chromium.org \
--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