mm/cma: Drop cma_get_name()
PATCH 1/1 mm/cma: Drop cma_get_name()
cma_get_name() just returns cma->name without any additional transformation unlike other helpers such as cma_get_base() and cma_get_size(). This helper is not worth the additional indirection, and can be dropped after replacing directly with cma->name in the sole caller __add_cma_heap().
--- drivers/dma-buf/heaps/cma_heap.c | 2 +- include/linux/cma.h | 1 - mm/cma.c | 5 ----- 3 files changed, 1 insertion(+), 7 deletions(-)
drivers/dma-buf/heaps/cma_heap.c +1 -1
@@ -376,7 +376,7 @@ static int __add_cma_heap(struct cma *cma, void *data)return -ENOMEM ; cma_heap->cma = cma; - exp_info.name =cma_get_name (cma); + exp_info.name = cma->name; exp_info.ops = &cma_heap_ops; exp_info.priv = cma_heap;
include/linux/cma.h +0 -1
@@ -25,7 +25,6 @@ struct cma;extern unsigned long totalcma_pages;extern phys_addr_t cma_get_base (const struct cma *cma);extern unsigned long cma_get_size (const struct cma *cma); -extern const char *cma_get_name (const struct cma *cma); extern int __init cma_declare_contiguous_nid(phys_addr_t base, phys_addr_t size, phys_addr_t limit,
mm/cma.c +0 -5
@@ -45,11 +45,6 @@ unsigned long cma_get_size(const struct cma *cma)return cma->count <<PAGE_SHIFT ; } -const char *cma_get_name (const struct cma *cma) -{ -return cma->name; -} -static unsigned long cma_bitmap_aligned_mask (const struct cma *cma,unsigned int align_order) {
Signature · 1 line
2.25.1
Andrew Morton
maintainerQuoted 4 lines · On Tue, 6 Feb 2024 09:45:18 +0530 Anshuman Khandual…
cma_get_name()just returnscma->namewithout any additional transformation unlike other helpers such ascma_get_base()andcma_get_size(). This helper is not worth the additional indirection, and can be dropped after replacing directly withcma->namein the sole caller__add_cma_heap().
drivers/dma-buf/heaps/cma_heap.c: In function '__add_cma_heap':drivers/dma-buf/heaps/cma_heap.c:379:28: error: invalid use of undefined type 'struct cma'
379 | exp_info.name = cma->name;
| ^~
Fixing this would require moving the `struct cma' definition into cma.h. I don't think that's worthwhile.
Quoted 7 lines · Andrew Morton
Quoted 4 lines · On Tue, 6 Feb 2024 09:45:18 +0530 Anshuman Khandual…
cma_get_name()just returnscma->namewithout any additional transformation unlike other helpers such ascma_get_base()andcma_get_size(). This helper is not worth the additional indirection, and can be dropped after replacing directly withcma->namein the sole caller__add_cma_heap().
Quoted 7 lines
drivers/dma-buf/heaps/cma_heap.c: In function '__add_cma_heap':drivers/dma-buf/heaps/cma_heap.c:379:28: error: invalid use of undefined type 'struct cma'
379 | exp_info.name =cma->name;
| ^~Fixing this would require moving the `struct cma' definition into
cma.h. I don't think that's worthwhile.
Existing forward declaration e.g 'struct cma' inside include/linux/cma.h does not seem to sufficient for cma->name to be de-referenced. Agreed - moving the definition for 'struct cma' into include/linux/cma.h is not worthwhile. Hence please drop this patch.