diff options
author | Christian König <christian.koenig@amd.com> | 2016-02-11 04:20:53 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-02-12 15:42:54 -0500 |
commit | a750b47e49f85041d894ef3a5e77bce64a60c6a0 (patch) | |
tree | 9857d1feb87e91fedd7ebcfe69f52e4cf012fbfc | |
parent | 20874179a22310c2224f43fc5676b7d87ad47e70 (diff) |
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>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index 3b99282a3307..17e13621fae9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | |||
@@ -34,15 +34,14 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev, struct amdgpu_ctx *ctx) | |||
34 | ctx->adev = adev; | 34 | ctx->adev = adev; |
35 | kref_init(&ctx->refcount); | 35 | kref_init(&ctx->refcount); |
36 | spin_lock_init(&ctx->ring_lock); | 36 | spin_lock_init(&ctx->ring_lock); |
37 | ctx->fences = kzalloc(sizeof(struct fence *) * amdgpu_sched_jobs * | 37 | ctx->fences = kcalloc(amdgpu_sched_jobs * AMDGPU_MAX_RINGS, |
38 | AMDGPU_MAX_RINGS, GFP_KERNEL); | 38 | sizeof(struct fence*), GFP_KERNEL); |
39 | if (!ctx->fences) | 39 | if (!ctx->fences) |
40 | return -ENOMEM; | 40 | return -ENOMEM; |
41 | 41 | ||
42 | for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { | 42 | for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { |
43 | ctx->rings[i].sequence = 1; | 43 | ctx->rings[i].sequence = 1; |
44 | ctx->rings[i].fences = (void *)ctx->fences + sizeof(struct fence *) * | 44 | ctx->rings[i].fences = &ctx->fences[amdgpu_sched_jobs * i]; |
45 | amdgpu_sched_jobs * i; | ||
46 | } | 45 | } |
47 | /* create context entity for each ring */ | 46 | /* create context entity for each ring */ |
48 | for (i = 0; i < adev->num_rings; i++) { | 47 | for (i = 0; i < adev->num_rings; i++) { |
@@ -192,18 +191,18 @@ int amdgpu_ctx_ioctl(struct drm_device *dev, void *data, | |||
192 | id = args->in.ctx_id; | 191 | id = args->in.ctx_id; |
193 | 192 | ||
194 | switch (args->in.op) { | 193 | switch (args->in.op) { |
195 | case AMDGPU_CTX_OP_ALLOC_CTX: | 194 | case AMDGPU_CTX_OP_ALLOC_CTX: |
196 | r = amdgpu_ctx_alloc(adev, fpriv, &id); | 195 | r = amdgpu_ctx_alloc(adev, fpriv, &id); |
197 | args->out.alloc.ctx_id = id; | 196 | args->out.alloc.ctx_id = id; |
198 | break; | 197 | break; |
199 | case AMDGPU_CTX_OP_FREE_CTX: | 198 | case AMDGPU_CTX_OP_FREE_CTX: |
200 | r = amdgpu_ctx_free(fpriv, id); | 199 | r = amdgpu_ctx_free(fpriv, id); |
201 | break; | 200 | break; |
202 | case AMDGPU_CTX_OP_QUERY_STATE: | 201 | case AMDGPU_CTX_OP_QUERY_STATE: |
203 | r = amdgpu_ctx_query(adev, fpriv, id, &args->out); | 202 | r = amdgpu_ctx_query(adev, fpriv, id, &args->out); |
204 | break; | 203 | break; |
205 | default: | 204 | default: |
206 | return -EINVAL; | 205 | return -EINVAL; |
207 | } | 206 | } |
208 | 207 | ||
209 | return r; | 208 | return r; |