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/sun4i: Use backend/mixer as dedicated DMA device Date: Thu, 12 Mar 2026 07:08:43 +1000 Message-ID: In-Reply-To: <20260311094929.3393338-5-wenst@chromium.org> References: <20260311094929.3393338-1-wenst@chromium.org> <20260311094929.3393338-5-wenst@chromium.org> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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) =3D=3D drm->dev) + drm_dev_set_dma_dev(drm, dev); ``` This "set only if not already set" logic ensures only the first bound backe= nd/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` sa= ys "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 cod= e. It looks like the comment was copied from `sun4i_backend.c` without adju= stment. 2. **Removal of the conditional check**: The old backend code checked `of_p= roperty_present(dev->of_node, "interconnects")` and the old mixer code chec= ked `of_property_present(dev->of_node, "iommus")` before calling `of_dma_co= nfigure()`. The new code unconditionally sets the DMA device. This is fine = =E2=80=94 `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 bac= kend/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_d= evice(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 practi= ce =E2=80=94 but it's worth considering whether there's a lifecycle issue i= f the backend/mixer device is unbound while the DRM device still holds a re= ference 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 MediaT= ek handles it (no cleanup in deinit either), so it's consistent. **Summary**: The only concrete issue is the copy-paste comment error in `su= n8i_mixer.c` saying "backend" instead of "mixer". Everything else looks cor= rect. --- Generated by Claude Code Patch Reviewer