[PATCH 2/3] amdgpu: Fix amdgpu_semaphore_handle typedef not to hide pointer type

Edward O'Callaghan funfunctor at folklore1984.net
Fri Sep 16 08:46:09 UTC 2016


Signed-off-by: Edward O'Callaghan <funfunctor at folklore1984.net>
---
 amdgpu/amdgpu.h            | 10 +++++-----
 amdgpu/amdgpu_cs.c         | 20 ++++++++++----------
 tests/amdgpu/basic_tests.c |  2 +-
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
index f322497..9332fab 100644
--- a/amdgpu/amdgpu.h
+++ b/amdgpu/amdgpu.h
@@ -127,7 +127,7 @@ typedef struct amdgpu_va amdgpu_va_handle_t;
 /**
  * Define handle for semaphore
  */
-typedef struct amdgpu_semaphore *amdgpu_semaphore_handle;
+typedef struct amdgpu_semaphore amdgpu_semaphore_handle_t;
 
 /*--------------------------------------------------------------------------*/
 /* -------------------------- Structures ---------------------------------- */
@@ -1194,7 +1194,7 @@ int amdgpu_bo_va_op(amdgpu_bo_handle bo,
  *          <0 - Negative POSIX Error code
  *
 */
-int amdgpu_cs_create_semaphore(amdgpu_semaphore_handle *sem);
+int amdgpu_cs_create_semaphore(amdgpu_semaphore_handle_t ** sem);
 
 /**
  *  signal semaphore
@@ -1213,7 +1213,7 @@ int amdgpu_cs_signal_semaphore(amdgpu_context_handle ctx,
 			       uint32_t ip_type,
 			       uint32_t ip_instance,
 			       uint32_t ring,
-			       amdgpu_semaphore_handle sem);
+			       amdgpu_semaphore_handle_t * sem);
 
 /**
  *  wait semaphore
@@ -1232,7 +1232,7 @@ int amdgpu_cs_wait_semaphore(amdgpu_context_handle ctx,
 			     uint32_t ip_type,
 			     uint32_t ip_instance,
 			     uint32_t ring,
-			     amdgpu_semaphore_handle sem);
+			     amdgpu_semaphore_handle_t * sem);
 
 /**
  *  destroy semaphore
@@ -1243,6 +1243,6 @@ int amdgpu_cs_wait_semaphore(amdgpu_context_handle ctx,
  *          <0 - Negative POSIX Error code
  *
 */
-int amdgpu_cs_destroy_semaphore(amdgpu_semaphore_handle sem);
+int amdgpu_cs_destroy_semaphore(amdgpu_semaphore_handle_t * sem);
 
 #endif /* #ifdef _AMDGPU_H_ */
diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
index fb5b3a8..c72825a 100644
--- a/amdgpu/amdgpu_cs.c
+++ b/amdgpu/amdgpu_cs.c
@@ -40,8 +40,8 @@
 #include "amdgpu_drm.h"
 #include "amdgpu_internal.h"
 
-static int amdgpu_cs_unreference_sem(amdgpu_semaphore_handle sem);
-static int amdgpu_cs_reset_sem(amdgpu_semaphore_handle sem);
+static int amdgpu_cs_unreference_sem(amdgpu_semaphore_handle_t * sem);
+static int amdgpu_cs_reset_sem(amdgpu_semaphore_handle_t * sem);
 
 /**
  * Create command submission context
@@ -124,7 +124,7 @@ int amdgpu_cs_ctx_free(amdgpu_context_handle context)
 	for (i = 0; i < AMDGPU_HW_IP_NUM; i++) {
 		for (j = 0; j < AMDGPU_HW_IP_INSTANCE_MAX_COUNT; j++) {
 			for (k = 0; k < AMDGPU_CS_MAX_RINGS; k++) {
-				amdgpu_semaphore_handle sem;
+				amdgpu_semaphore_handle_t * sem;
 				LIST_FOR_EACH_ENTRY(sem, &context->sem_list[i][j][k], list) {
 					list_del(&sem->list);
 					amdgpu_cs_reset_sem(sem);
@@ -179,7 +179,7 @@ static int amdgpu_cs_submit_one(amdgpu_context_handle context,
 	struct drm_amdgpu_cs_chunk_dep *dependencies = NULL;
 	struct drm_amdgpu_cs_chunk_dep *sem_dependencies = NULL;
 	struct list_head *sem_list;
-	amdgpu_semaphore_handle sem, tmp;
+	amdgpu_semaphore_handle_t * sem, * tmp;
 	uint32_t i, size, sem_count = 0;
 	bool user_fence;
 	int r = 0;
@@ -443,7 +443,7 @@ int amdgpu_cs_query_fence_status(struct amdgpu_cs_fence *fence,
 	return r;
 }
 
-int amdgpu_cs_create_semaphore(amdgpu_semaphore_handle *sem)
+int amdgpu_cs_create_semaphore(amdgpu_semaphore_handle_t ** sem)
 {
 	struct amdgpu_semaphore *gpu_semaphore;
 
@@ -464,7 +464,7 @@ int amdgpu_cs_signal_semaphore(amdgpu_context_handle ctx,
 			       uint32_t ip_type,
 			       uint32_t ip_instance,
 			       uint32_t ring,
-			       amdgpu_semaphore_handle sem)
+			       amdgpu_semaphore_handle_t * sem)
 {
 	if (NULL == ctx)
 		return -EINVAL;
@@ -492,7 +492,7 @@ int amdgpu_cs_wait_semaphore(amdgpu_context_handle ctx,
 			     uint32_t ip_type,
 			     uint32_t ip_instance,
 			     uint32_t ring,
-			     amdgpu_semaphore_handle sem)
+			     amdgpu_semaphore_handle_t * sem)
 {
 	if (NULL == ctx)
 		return -EINVAL;
@@ -512,7 +512,7 @@ int amdgpu_cs_wait_semaphore(amdgpu_context_handle ctx,
 	return 0;
 }
 
-static int amdgpu_cs_reset_sem(amdgpu_semaphore_handle sem)
+static int amdgpu_cs_reset_sem(amdgpu_semaphore_handle_t * sem)
 {
 	if (NULL == sem)
 		return -EINVAL;
@@ -528,7 +528,7 @@ static int amdgpu_cs_reset_sem(amdgpu_semaphore_handle sem)
 	return 0;
 }
 
-static int amdgpu_cs_unreference_sem(amdgpu_semaphore_handle sem)
+static int amdgpu_cs_unreference_sem(amdgpu_semaphore_handle_t * sem)
 {
 	if (NULL == sem)
 		return -EINVAL;
@@ -538,7 +538,7 @@ static int amdgpu_cs_unreference_sem(amdgpu_semaphore_handle sem)
 	return 0;
 }
 
-int amdgpu_cs_destroy_semaphore(amdgpu_semaphore_handle sem)
+int amdgpu_cs_destroy_semaphore(amdgpu_semaphore_handle_t * sem)
 {
 	return amdgpu_cs_unreference_sem(sem);
 }
diff --git a/tests/amdgpu/basic_tests.c b/tests/amdgpu/basic_tests.c
index 40e9ef1..7838249 100644
--- a/tests/amdgpu/basic_tests.c
+++ b/tests/amdgpu/basic_tests.c
@@ -479,7 +479,7 @@ static void amdgpu_command_submission_gfx(void)
 static void amdgpu_semaphore_test(void)
 {
 	amdgpu_context_handle context_handle[2];
-	amdgpu_semaphore_handle sem;
+	amdgpu_semaphore_handle_t * sem;
 	amdgpu_bo_handle ib_result_handle[2];
 	void *ib_result_cpu[2];
 	uint64_t ib_result_mc_address[2];
-- 
2.7.4



More information about the amd-gfx mailing list