linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/cma: Drop cma_get_name()
@ 2024-02-06  4:15 Anshuman Khandual
  2024-02-06 22:25 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Anshuman Khandual @ 2024-02-06  4:15 UTC (permalink / raw)
  To: linux-mm
  Cc: Anshuman Khandual, Sumit Semwal, Andrew Morton, dri-devel,
	linaro-mm-sig, linux-kernel

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().

Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: dri-devel@lists.freedesktop.org
Cc: linaro-mm-sig@lists.linaro.org
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 drivers/dma-buf/heaps/cma_heap.c | 2 +-
 include/linux/cma.h              | 1 -
 mm/cma.c                         | 5 -----
 3 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/dma-buf/heaps/cma_heap.c b/drivers/dma-buf/heaps/cma_heap.c
index 4a63567e93ba..6ceb15060b02 100644
--- a/drivers/dma-buf/heaps/cma_heap.c
+++ b/drivers/dma-buf/heaps/cma_heap.c
@@ -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;
 
diff --git a/include/linux/cma.h b/include/linux/cma.h
index 9db877506ea8..12ab7cd1d529 100644
--- a/include/linux/cma.h
+++ b/include/linux/cma.h
@@ -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,
diff --git a/mm/cma.c b/mm/cma.c
index ed6581ef50c1..2627f4ba481f 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -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)
 {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/cma: Drop cma_get_name()
  2024-02-06  4:15 [PATCH] mm/cma: Drop cma_get_name() Anshuman Khandual
@ 2024-02-06 22:25 ` Andrew Morton
  2024-02-07  2:29   ` Anshuman Khandual
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2024-02-06 22:25 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-mm, Sumit Semwal, dri-devel, linaro-mm-sig, linux-kernel

On Tue,  6 Feb 2024 09:45:18 +0530 Anshuman Khandual <anshuman.khandual@arm.com> wrote:

> 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: 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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/cma: Drop cma_get_name()
  2024-02-06 22:25 ` Andrew Morton
@ 2024-02-07  2:29   ` Anshuman Khandual
  0 siblings, 0 replies; 3+ messages in thread
From: Anshuman Khandual @ 2024-02-07  2:29 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, Sumit Semwal, dri-devel, linaro-mm-sig, linux-kernel



On 2/7/24 03:55, Andrew Morton wrote:
> On Tue,  6 Feb 2024 09:45:18 +0530 Anshuman Khandual <anshuman.khandual@arm.com> wrote:
> 
>> 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: 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-07  2:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-06  4:15 [PATCH] mm/cma: Drop cma_get_name() Anshuman Khandual
2024-02-06 22:25 ` Andrew Morton
2024-02-07  2:29   ` Anshuman Khandual

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).