From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: dma: contiguous: Turn heap registration logic around Date: Wed, 04 Mar 2026 07:41:35 +1000 Message-ID: In-Reply-To: <20260303-dma-buf-heaps-as-modules-v3-1-24344812c707@kernel.org> References: <20260303-dma-buf-heaps-as-modules-v3-0-24344812c707@kernel.org> <20260303-dma-buf-heaps-as-modules-v3-1-24344812c707@kernel.org> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review This patch inverts the CMA heap registration: instead of `rmem_cma_setup()` calling into `cma_heap.c` to register each reserved region, it stores them in `rmem_cma_areas[]` inside `contiguous.c` and provides an iterator `dma_contiguous_get_reserved_region()` for the heap to use. **Bug (build break):** The patch removes the `dma_heap_cma_register_heap()` function definition from `cma_heap.c`, but fails to remove: 1. The call at `kernel/dma/contiguous.c:276`: ```c ret = dma_heap_cma_register_heap(dma_contiguous_default_area); if (ret) pr_warn("Couldn't register default CMA heap."); ``` 2. The header `include/linux/dma-buf/heaps/cma.h` which still declares the function: ```c #ifdef CONFIG_DMABUF_HEAPS_CMA int dma_heap_cma_register_heap(struct cma *cma); #else static inline int dma_heap_cma_register_heap(struct cma *cma) { return 0; } #endif ``` 3. The `#include ` at `kernel/dma/contiguous.c:45`. When `CONFIG_DMABUF_HEAPS_CMA=y`, the `#ifdef` in the header selects the non-inline declaration, but there is no corresponding definition in any `.c` file, resulting in a linker error. This call is now functionally redundant anyway, since `add_cma_heaps()` already retrieves the default CMA area via `dev_get_cma_area(NULL)`. **Fix:** Remove the call at `contiguous.c:276-278`, remove the `include/linux/dma-buf/heaps/cma.h` header entirely (it has no remaining purpose), and remove the `#include` at `contiguous.c:45`. The series is **not bisectable** at this patch as-is (`CONFIG_DMABUF_HEAPS_CMA=y` breaks from this point onward). The new `rmem_cma_areas[]` and `dma_contiguous_get_reserved_region()` implementation itself looks correct. The array is correctly not marked `__initdata` since it must persist for the module to query at load time. --- Generated by Claude Code Patch Reviewer