drm/amdgpu: add macro to retrieve timeline name v2
authorAndres Rodriguez <andresx7@gmail.com>
Sat, 11 Mar 2017 15:50:34 +0000 (10:50 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 30 Mar 2017 03:53:56 +0000 (23:53 -0400)
This helps de-duplicate a long expression and removes overly long lines.

v2: Rename macro and undef it

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Andres Rodriguez <andresx7@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h

index 88e17045a968914aaa10b40978f35e7e5e5f9622..08ccb3d34b21837953d1918de62249d8a9153406 100644 (file)
@@ -11,6 +11,9 @@
 #define TRACE_SYSTEM amdgpu
 #define TRACE_INCLUDE_FILE amdgpu_trace
 
+#define AMDGPU_JOB_GET_TIMELINE_NAME(job) \
+        job->base.s_fence->finished.ops->get_timeline_name(&job->base.s_fence->finished)
+
 TRACE_EVENT(amdgpu_mm_rreg,
            TP_PROTO(unsigned did, uint32_t reg, uint32_t value),
            TP_ARGS(did, reg, value),
@@ -102,7 +105,7 @@ TRACE_EVENT(amdgpu_cs_ioctl,
            TP_ARGS(job),
            TP_STRUCT__entry(
                             __field(uint64_t, sched_job_id)
-                            __string(timeline, job->base.s_fence->finished.ops->get_timeline_name(&job->base.s_fence->finished))
+                            __string(timeline, AMDGPU_JOB_GET_TIMELINE_NAME(job))
                             __field(unsigned int, context)
                             __field(unsigned int, seqno)
                             __field(struct dma_fence *, fence)
@@ -112,7 +115,7 @@ TRACE_EVENT(amdgpu_cs_ioctl,
 
            TP_fast_assign(
                           __entry->sched_job_id = job->base.id;
-                          __assign_str(timeline, job->base.s_fence->finished.ops->get_timeline_name(&job->base.s_fence->finished))
+                          __assign_str(timeline, AMDGPU_JOB_GET_TIMELINE_NAME(job))
                           __entry->context = job->base.s_fence->finished.context;
                           __entry->seqno = job->base.s_fence->finished.seqno;
                           __entry->ring_name = job->ring->name;
@@ -128,7 +131,7 @@ TRACE_EVENT(amdgpu_sched_run_job,
            TP_ARGS(job),
            TP_STRUCT__entry(
                             __field(uint64_t, sched_job_id)
-                            __string(timeline, job->base.s_fence->finished.ops->get_timeline_name(&job->base.s_fence->finished))
+                            __string(timeline, AMDGPU_JOB_GET_TIMELINE_NAME(job))
                             __field(unsigned int, context)
                             __field(unsigned int, seqno)
                             __field(char *, ring_name)
@@ -137,7 +140,7 @@ TRACE_EVENT(amdgpu_sched_run_job,
 
            TP_fast_assign(
                           __entry->sched_job_id = job->base.id;
-                          __assign_str(timeline, job->base.s_fence->finished.ops->get_timeline_name(&job->base.s_fence->finished))
+                          __assign_str(timeline, AMDGPU_JOB_GET_TIMELINE_NAME(job))
                           __entry->context = job->base.s_fence->finished.context;
                           __entry->seqno = job->base.s_fence->finished.seqno;
                           __entry->ring_name = job->ring->name;
@@ -365,6 +368,7 @@ TRACE_EVENT(amdgpu_ttm_bo_move,
                        __entry->new_placement, __entry->bo_size)
 );
 
+#undef AMDGPU_JOB_GET_TIMELINE_NAME
 #endif
 
 /* This part must be outside protection */