drm/amdgpu: fix coding style in amdgpu_ctx.c

Don't use pointer arithmetic and fix the indentation.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Christian König 2016-02-11 10:20:53 +01:00 committed by Alex Deucher
parent 20874179a2
commit a750b47e49
1 changed files with 15 additions and 16 deletions

View File

@ -34,15 +34,14 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev, struct amdgpu_ctx *ctx)
ctx->adev = adev; ctx->adev = adev;
kref_init(&ctx->refcount); kref_init(&ctx->refcount);
spin_lock_init(&ctx->ring_lock); spin_lock_init(&ctx->ring_lock);
ctx->fences = kzalloc(sizeof(struct fence *) * amdgpu_sched_jobs * ctx->fences = kcalloc(amdgpu_sched_jobs * AMDGPU_MAX_RINGS,
AMDGPU_MAX_RINGS, GFP_KERNEL); sizeof(struct fence*), GFP_KERNEL);
if (!ctx->fences) if (!ctx->fences)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
ctx->rings[i].sequence = 1; ctx->rings[i].sequence = 1;
ctx->rings[i].fences = (void *)ctx->fences + sizeof(struct fence *) * ctx->rings[i].fences = &ctx->fences[amdgpu_sched_jobs * i];
amdgpu_sched_jobs * i;
} }
/* create context entity for each ring */ /* create context entity for each ring */
for (i = 0; i < adev->num_rings; i++) { for (i = 0; i < adev->num_rings; i++) {