linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dma-buf/heaps: Correct the types of fd_flags and heap_flags
@ 2024-06-06  2:02 Barry Song
  2024-06-06  2:37 ` John Stultz
  2024-06-10 16:43 ` Carlos Llamas
  0 siblings, 2 replies; 4+ messages in thread
From: Barry Song @ 2024-06-06  2:02 UTC (permalink / raw)
  To: linaro-mm-sig, linux-media, sumit.semwal
  Cc: Brian.Starkey, benjamin.gaignard, christian.koenig, dri-devel,
	jstultz, linux-kernel, tjmercier, v-songbaohua, hailong.liu

From: Barry Song <v-songbaohua@oppo.com>

dma_heap_allocation_data defines the UAPI as follows:

 struct dma_heap_allocation_data {
        __u64 len;
        __u32 fd;
        __u32 fd_flags;
        __u64 heap_flags;
 };

But dma heaps are casting both fd_flags and heap_flags into
unsigned long. This patch makes dma heaps - cma heap and
system heap have consistent types with UAPI.

Signed-off-by: Barry Song <v-songbaohua@oppo.com>
---
 drivers/dma-buf/heaps/cma_heap.c    | 4 ++--
 drivers/dma-buf/heaps/system_heap.c | 4 ++--
 include/linux/dma-heap.h            | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/dma-buf/heaps/cma_heap.c b/drivers/dma-buf/heaps/cma_heap.c
index 4a63567e93ba..c384004b918e 100644
--- a/drivers/dma-buf/heaps/cma_heap.c
+++ b/drivers/dma-buf/heaps/cma_heap.c
@@ -274,8 +274,8 @@ static const struct dma_buf_ops cma_heap_buf_ops = {
 
 static struct dma_buf *cma_heap_allocate(struct dma_heap *heap,
 					 unsigned long len,
-					 unsigned long fd_flags,
-					 unsigned long heap_flags)
+					 u32 fd_flags,
+					 u64 heap_flags)
 {
 	struct cma_heap *cma_heap = dma_heap_get_drvdata(heap);
 	struct cma_heap_buffer *buffer;
diff --git a/drivers/dma-buf/heaps/system_heap.c b/drivers/dma-buf/heaps/system_heap.c
index 9076d47ed2ef..d78cdb9d01e5 100644
--- a/drivers/dma-buf/heaps/system_heap.c
+++ b/drivers/dma-buf/heaps/system_heap.c
@@ -333,8 +333,8 @@ static struct page *alloc_largest_available(unsigned long size,
 
 static struct dma_buf *system_heap_allocate(struct dma_heap *heap,
 					    unsigned long len,
-					    unsigned long fd_flags,
-					    unsigned long heap_flags)
+					    u32 fd_flags,
+					    u64 heap_flags)
 {
 	struct system_heap_buffer *buffer;
 	DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
diff --git a/include/linux/dma-heap.h b/include/linux/dma-heap.h
index 0c05561cad6e..064bad725061 100644
--- a/include/linux/dma-heap.h
+++ b/include/linux/dma-heap.h
@@ -23,8 +23,8 @@ struct dma_heap;
 struct dma_heap_ops {
 	struct dma_buf *(*allocate)(struct dma_heap *heap,
 				    unsigned long len,
-				    unsigned long fd_flags,
-				    unsigned long heap_flags);
+				    u32 fd_flags,
+				    u64 heap_flags);
 };
 
 /**
-- 
2.34.1


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

* Re: [PATCH] dma-buf/heaps: Correct the types of fd_flags and heap_flags
  2024-06-06  2:02 [PATCH] dma-buf/heaps: Correct the types of fd_flags and heap_flags Barry Song
@ 2024-06-06  2:37 ` John Stultz
  2024-06-10 16:43 ` Carlos Llamas
  1 sibling, 0 replies; 4+ messages in thread
From: John Stultz @ 2024-06-06  2:37 UTC (permalink / raw)
  To: Barry Song
  Cc: linaro-mm-sig, linux-media, sumit.semwal, Brian.Starkey,
	benjamin.gaignard, christian.koenig, dri-devel, linux-kernel,
	tjmercier, v-songbaohua, hailong.liu

On Wed, Jun 5, 2024 at 7:02 PM Barry Song <21cnbao@gmail.com> wrote:
>
> From: Barry Song <v-songbaohua@oppo.com>
>
> dma_heap_allocation_data defines the UAPI as follows:
>
>  struct dma_heap_allocation_data {
>         __u64 len;
>         __u32 fd;
>         __u32 fd_flags;
>         __u64 heap_flags;
>  };
>
> But dma heaps are casting both fd_flags and heap_flags into
> unsigned long. This patch makes dma heaps - cma heap and
> system heap have consistent types with UAPI.
>
> Signed-off-by: Barry Song <v-songbaohua@oppo.com>

Thanks for submitting this additional cleanup!

Acked-by: John Stultz <jstultz@google.com>

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

* Re: [PATCH] dma-buf/heaps: Correct the types of fd_flags and heap_flags
  2024-06-06  2:02 [PATCH] dma-buf/heaps: Correct the types of fd_flags and heap_flags Barry Song
  2024-06-06  2:37 ` John Stultz
@ 2024-06-10 16:43 ` Carlos Llamas
  2024-06-19 14:37   ` Sumit Semwal
  1 sibling, 1 reply; 4+ messages in thread
From: Carlos Llamas @ 2024-06-10 16:43 UTC (permalink / raw)
  To: Barry Song
  Cc: linaro-mm-sig, linux-media, sumit.semwal, Brian.Starkey,
	benjamin.gaignard, christian.koenig, dri-devel, jstultz,
	linux-kernel, tjmercier, v-songbaohua, hailong.liu

On Thu, Jun 06, 2024 at 02:02:13PM +1200, Barry Song wrote:
> From: Barry Song <v-songbaohua@oppo.com>
> 
> dma_heap_allocation_data defines the UAPI as follows:
> 
>  struct dma_heap_allocation_data {
>         __u64 len;
>         __u32 fd;
>         __u32 fd_flags;
>         __u64 heap_flags;
>  };
> 
> But dma heaps are casting both fd_flags and heap_flags into
> unsigned long. This patch makes dma heaps - cma heap and
> system heap have consistent types with UAPI.
> 
> Signed-off-by: Barry Song <v-songbaohua@oppo.com>
> ---

Looks good to me, thanks!

Reviewed-by: Carlos Llamas <cmllamas@google.com>

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

* Re: [PATCH] dma-buf/heaps: Correct the types of fd_flags and heap_flags
  2024-06-10 16:43 ` Carlos Llamas
@ 2024-06-19 14:37   ` Sumit Semwal
  0 siblings, 0 replies; 4+ messages in thread
From: Sumit Semwal @ 2024-06-19 14:37 UTC (permalink / raw)
  To: Carlos Llamas
  Cc: Barry Song, linaro-mm-sig, linux-media, Brian.Starkey,
	benjamin.gaignard, christian.koenig, dri-devel, jstultz,
	linux-kernel, tjmercier, v-songbaohua, hailong.liu

Hi Barry,

On Mon, 10 Jun 2024 at 22:14, Carlos Llamas <cmllamas@google.com> wrote:
>
> On Thu, Jun 06, 2024 at 02:02:13PM +1200, Barry Song wrote:
> > From: Barry Song <v-songbaohua@oppo.com>
> >
> > dma_heap_allocation_data defines the UAPI as follows:
> >
> >  struct dma_heap_allocation_data {
> >         __u64 len;
> >         __u32 fd;
> >         __u32 fd_flags;
> >         __u64 heap_flags;
> >  };
> >
> > But dma heaps are casting both fd_flags and heap_flags into
> > unsigned long. This patch makes dma heaps - cma heap and
> > system heap have consistent types with UAPI.
> >
> > Signed-off-by: Barry Song <v-songbaohua@oppo.com>

Thanks for this cleanup; pushed to drm-misc-next.

> > ---
>
> Looks good to me, thanks!
>
> Reviewed-by: Carlos Llamas <cmllamas@google.com>


Best,
Sumit.

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

end of thread, other threads:[~2024-06-19 14:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-06  2:02 [PATCH] dma-buf/heaps: Correct the types of fd_flags and heap_flags Barry Song
2024-06-06  2:37 ` John Stultz
2024-06-10 16:43 ` Carlos Llamas
2024-06-19 14:37   ` Sumit Semwal

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