Skip to content

Commit e116be2

Browse files
committed
drm/etnaviv: drop GPU initialized property
Now that it is only used to track the driver internal state of the MMU global and cmdbuf objects, we can get rid of this property by making the free/finit functions of those objects safe to call on an uninitialized object. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
1 parent 647d817 commit e116be2

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ void etnaviv_cmdbuf_free(struct etnaviv_cmdbuf *cmdbuf)
121121
int order = order_base_2(ALIGN(cmdbuf->size, SUBALLOC_GRANULE) /
122122
SUBALLOC_GRANULE);
123123

124+
if (!suballoc)
125+
return;
126+
124127
mutex_lock(&suballoc->lock);
125128
bitmap_release_region(suballoc->granule_map,
126129
cmdbuf->suballoc_offset / SUBALLOC_GRANULE,

drivers/gpu/drm/etnaviv/etnaviv_gpu.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -876,8 +876,6 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
876876
pm_runtime_mark_last_busy(gpu->dev);
877877
pm_runtime_put_autosuspend(gpu->dev);
878878

879-
gpu->initialized = true;
880-
881879
return 0;
882880

883881
fail:
@@ -1805,11 +1803,8 @@ static void etnaviv_gpu_unbind(struct device *dev, struct device *master,
18051803
if (gpu->mmu_context)
18061804
etnaviv_iommu_context_put(gpu->mmu_context);
18071805

1808-
if (gpu->initialized) {
1809-
etnaviv_cmdbuf_free(&gpu->buffer);
1810-
etnaviv_iommu_global_fini(gpu);
1811-
gpu->initialized = false;
1812-
}
1806+
etnaviv_cmdbuf_free(&gpu->buffer);
1807+
etnaviv_iommu_global_fini(gpu);
18131808

18141809
gpu->drm = NULL;
18151810
xa_destroy(&gpu->user_fences);

drivers/gpu/drm/etnaviv/etnaviv_gpu.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ struct etnaviv_gpu {
114114
struct mutex sched_lock;
115115
struct drm_gpu_scheduler sched;
116116
enum etnaviv_gpu_state state;
117-
bool initialized;
118117

119118
/* 'ring'-buffer: */
120119
struct etnaviv_cmdbuf buffer;

drivers/gpu/drm/etnaviv/etnaviv_mmu.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,9 @@ void etnaviv_iommu_global_fini(struct etnaviv_gpu *gpu)
553553
struct etnaviv_drm_private *priv = gpu->drm->dev_private;
554554
struct etnaviv_iommu_global *global = priv->mmu_global;
555555

556+
if (!global)
557+
return;
558+
556559
if (--global->use > 0)
557560
return;
558561

0 commit comments

Comments
 (0)