Skip to content

Commit 78edefc

Browse files
committed
drm/etnaviv: return context from etnaviv_iommu_context_get
Being able to have the refcount manipulation in an assignment makes it much easier to parse the code. Cc: [email protected] # 5.4 Signed-off-by: Lucas Stach <[email protected]> Tested-by: Michael Walle <[email protected]> Tested-by: Marek Vasut <[email protected]> Reviewed-by: Christian Gmeiner <[email protected]>
1 parent 6880fa6 commit 78edefc

File tree

5 files changed

+8
-11
lines changed

5 files changed

+8
-11
lines changed

drivers/gpu/drm/etnaviv/etnaviv_buffer.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,7 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state,
397397
if (switch_mmu_context) {
398398
struct etnaviv_iommu_context *old_context = gpu->mmu_context;
399399

400-
etnaviv_iommu_context_get(mmu_context);
401-
gpu->mmu_context = mmu_context;
400+
gpu->mmu_context = etnaviv_iommu_context_get(mmu_context);
402401
etnaviv_iommu_context_put(old_context);
403402
}
404403

drivers/gpu/drm/etnaviv/etnaviv_gem.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,7 @@ struct etnaviv_vram_mapping *etnaviv_gem_mapping_get(
294294
list_del(&mapping->obj_node);
295295
}
296296

297-
etnaviv_iommu_context_get(mmu_context);
298-
mapping->context = mmu_context;
297+
mapping->context = etnaviv_iommu_context_get(mmu_context);
299298
mapping->use = 1;
300299

301300
ret = etnaviv_iommu_map_gem(mmu_context, etnaviv_obj,

drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,8 +532,7 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
532532
goto err_submit_objects;
533533

534534
submit->ctx = file->driver_priv;
535-
etnaviv_iommu_context_get(submit->ctx->mmu);
536-
submit->mmu_context = submit->ctx->mmu;
535+
submit->mmu_context = etnaviv_iommu_context_get(submit->ctx->mmu);
537536
submit->exec_state = args->exec_state;
538537
submit->flags = args->flags;
539538

drivers/gpu/drm/etnaviv/etnaviv_gpu.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,12 +1371,10 @@ struct dma_fence *etnaviv_gpu_submit(struct etnaviv_gem_submit *submit)
13711371
}
13721372

13731373
if (!gpu->mmu_context) {
1374-
etnaviv_iommu_context_get(submit->mmu_context);
1375-
gpu->mmu_context = submit->mmu_context;
1374+
gpu->mmu_context = etnaviv_iommu_context_get(submit->mmu_context);
13761375
etnaviv_gpu_start_fe_idleloop(gpu);
13771376
} else {
1378-
etnaviv_iommu_context_get(gpu->mmu_context);
1379-
submit->prev_mmu_context = gpu->mmu_context;
1377+
submit->prev_mmu_context = etnaviv_iommu_context_get(gpu->mmu_context);
13801378
}
13811379

13821380
if (submit->nr_pmrs) {

drivers/gpu/drm/etnaviv/etnaviv_mmu.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,11 @@ void etnaviv_iommu_dump(struct etnaviv_iommu_context *ctx, void *buf);
105105
struct etnaviv_iommu_context *
106106
etnaviv_iommu_context_init(struct etnaviv_iommu_global *global,
107107
struct etnaviv_cmdbuf_suballoc *suballoc);
108-
static inline void etnaviv_iommu_context_get(struct etnaviv_iommu_context *ctx)
108+
static inline struct etnaviv_iommu_context *
109+
etnaviv_iommu_context_get(struct etnaviv_iommu_context *ctx)
109110
{
110111
kref_get(&ctx->refcount);
112+
return ctx;
111113
}
112114
void etnaviv_iommu_context_put(struct etnaviv_iommu_context *ctx);
113115
void etnaviv_iommu_restore(struct etnaviv_gpu *gpu,

0 commit comments

Comments
 (0)