From 397be04009eff5c5ba0222d97b6b1b030a4b044c Mon Sep 17 00:00:00 2001 From: cwx1272435 Date: Tue, 7 May 2024 07:22:18 +0000 Subject: [PATCH] 0507 Signed-off-by: cwx1272435 --- libdmabufheap/include/dmabuf_alloc.h | 1 - libdmabufheap/src/dmabuf_alloc.c | 8 ++++---- .../test/unittest/libdmabufheap/dmabuf_alloc_test.cpp | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/libdmabufheap/include/dmabuf_alloc.h b/libdmabufheap/include/dmabuf_alloc.h index abec18f..19fbb50 100644 --- a/libdmabufheap/include/dmabuf_alloc.h +++ b/libdmabufheap/include/dmabuf_alloc.h @@ -16,7 +16,6 @@ #ifndef LIB_DMA_BUF_HEAP_H #define LIB_DMA_BUF_HEAP_H -#include #include #include diff --git a/libdmabufheap/src/dmabuf_alloc.c b/libdmabufheap/src/dmabuf_alloc.c index 02dec9d..de0d0ab 100644 --- a/libdmabufheap/src/dmabuf_alloc.c +++ b/libdmabufheap/src/dmabuf_alloc.c @@ -120,7 +120,7 @@ int DmabufHeapBufferFree(DmabufHeapBuffer *buffer) return close(buffer->fd); } -int DmabufHeapBufferSyncStart(unsigned int fd, DmabufHeapBufferSyncType syncType) +int DmabufHeapBufferSyncStart(unsigned int bufferFd, DmabufHeapBufferSyncType syncType) { if (!IsSyncTypeValid(syncType)) { HILOG_ERROR(LOG_CORE, "buffer start syncType is wrong, syncType = %u.", syncType); @@ -129,10 +129,10 @@ int DmabufHeapBufferSyncStart(unsigned int fd, DmabufHeapBufferSyncType syncType struct dma_buf_sync sync = {0}; sync.flags = DMA_BUF_SYNC_START | syncType; - return ioctl(fd, DMA_BUF_IOCTL_SYNC, &sync); + return ioctl(bufferFd, DMA_BUF_IOCTL_SYNC, &sync); } -int DmabufHeapBufferSyncEnd(unsigned int fd, DmabufHeapBufferSyncType syncType) +int DmabufHeapBufferSyncEnd(unsigned int bufferFd, DmabufHeapBufferSyncType syncType) { if (!IsSyncTypeValid(syncType)) { HILOG_ERROR(LOG_CORE, "buffer end syncType is wrong, syncType = %u.", syncType); @@ -141,5 +141,5 @@ int DmabufHeapBufferSyncEnd(unsigned int fd, DmabufHeapBufferSyncType syncType) struct dma_buf_sync sync = {0}; sync.flags = DMA_BUF_SYNC_END | syncType; - return ioctl(fd, DMA_BUF_IOCTL_SYNC, &sync); + return ioctl(bufferFd, DMA_BUF_IOCTL_SYNC, &sync); } \ No newline at end of file diff --git a/libdmabufheap/test/unittest/libdmabufheap/dmabuf_alloc_test.cpp b/libdmabufheap/test/unittest/libdmabufheap/dmabuf_alloc_test.cpp index 1ad1e56..4a9f001 100644 --- a/libdmabufheap/test/unittest/libdmabufheap/dmabuf_alloc_test.cpp +++ b/libdmabufheap/test/unittest/libdmabufheap/dmabuf_alloc_test.cpp @@ -234,9 +234,9 @@ HWTEST_F(DmabufAllocTest, BufferSyncWithWrongSyncType, Function|MediumTest|Level void *ptr = mmap(NULL, BUFFER_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, buffer.fd, 0); ASSERT_TRUE(ptr != NULL); - ASSERT_NE(0, DmabufHeapBufferSyncEnd(buffer.fd, (DmabufHeapBufferSyncType)WRONG_SYNC_TYPE)); + ASSERT_NE(0, DmabufHeapBufferSyncEnd(buffer.fd, static_cast(WRONG_SYNC_TYPE))); - ASSERT_NE(0, DmabufHeapBufferSyncStart(buffer.fd, (DmabufHeapBufferSyncType)WRONG_SYNC_TYPE)); + ASSERT_NE(0, DmabufHeapBufferSyncStart(buffer.fd, static_cast(WRONG_SYNC_TYPE))); ASSERT_EQ(0, munmap(ptr, BUFFER_SIZE)); -- Gitee