[PATCH 2/6] drm/amdgpu: clean up for amdgpu ctx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



No used more.

Change-Id: I54ddd3f492354863a055ad2356bccccc749ff420
Signed-off-by: Chunming Zhou <David1.Zhou at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 13 +------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c  |  7 +++----
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 27 ++++++---------------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  4 ----
 4 files changed, 10 insertions(+), 41 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index b6552ed..049e1d6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1032,14 +1032,7 @@ struct amdgpu_ctx {
 	struct amdgpu_ctx_ring	rings[AMDGPU_MAX_RINGS];
 };
 
-struct amdgpu_ctx_mgr {
-	struct amdgpu_device	*adev;
-	struct mutex		lock;
-	/* protected by lock */
-	struct idr		ctx_handles;
-};
-
-struct amdgpu_ctx *amdgpu_ctx_get(struct amdgpu_fpriv *fpriv, uint32_t id);
+struct amdgpu_ctx *amdgpu_ctx_get(uint32_t id);
 int amdgpu_ctx_put(struct amdgpu_ctx *ctx);
 
 uint64_t amdgpu_ctx_add_fence(struct amdgpu_ctx *ctx, struct amdgpu_ring *ring,
@@ -1050,9 +1043,6 @@ struct fence *amdgpu_ctx_get_fence(struct amdgpu_ctx *ctx,
 int amdgpu_ctx_ioctl(struct drm_device *dev, void *data,
 		     struct drm_file *filp);
 
-void amdgpu_ctx_mgr_init(struct amdgpu_ctx_mgr *mgr);
-void amdgpu_ctx_mgr_fini(struct amdgpu_ctx_mgr *mgr);
-
 /*
  * file private structure
  */
@@ -1061,7 +1051,6 @@ struct amdgpu_fpriv {
 	struct amdgpu_vm	vm;
 	struct mutex		bo_list_lock;
 	struct idr		bo_list_handles;
-	struct amdgpu_ctx_mgr	ctx_mgr;
 };
 
 /*
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 3434098..cfae65d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -133,7 +133,7 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)
 	if (!chunk_array)
 		return -ENOMEM;
 
-	p->ctx = amdgpu_ctx_get(fpriv, cs->in.ctx_id);
+	p->ctx = amdgpu_ctx_get(cs->in.ctx_id);
 	if (!p->ctx) {
 		ret = -EINVAL;
 		goto free_chunk;
@@ -804,7 +804,6 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev,
 static int amdgpu_cs_dependencies(struct amdgpu_device *adev,
 				  struct amdgpu_cs_parser *p)
 {
-	struct amdgpu_fpriv *fpriv = p->filp->driver_priv;
 	int i, j, r;
 
 	for (i = 0; i < p->nchunks; ++i) {
@@ -832,7 +831,7 @@ static int amdgpu_cs_dependencies(struct amdgpu_device *adev,
 			if (r)
 				return r;
 
-			ctx = amdgpu_ctx_get(fpriv, deps[j].ctx_id);
+			ctx = amdgpu_ctx_get(deps[j].ctx_id);
 			if (ctx == NULL)
 				return -EINVAL;
 
@@ -967,7 +966,7 @@ int amdgpu_cs_wait_ioctl(struct drm_device *dev, void *data,
 	if (r)
 		return r;
 
-	ctx = amdgpu_ctx_get(filp->driver_priv, wait->in.ctx_id);
+	ctx = amdgpu_ctx_get(wait->in.ctx_id);
 	if (ctx == NULL)
 		return -EINVAL;
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
index bd74a57..963a14e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
@@ -87,7 +87,6 @@ static void amdgpu_ctx_fini(struct amdgpu_ctx *ctx)
 }
 
 static int amdgpu_ctx_alloc(struct amdgpu_device *adev,
-			    struct amdgpu_fpriv *fpriv,
 			    uint32_t *id)
 {
 	struct amdgpu_ctx *ctx;
@@ -126,7 +125,7 @@ static void amdgpu_ctx_do_release(struct kref *ref)
 	kfree(ctx);
 }
 
-static int amdgpu_ctx_free(struct amdgpu_fpriv *fpriv, uint32_t id)
+static int amdgpu_ctx_free(uint32_t id)
 {
 	struct amdgpu_ctx *ctx;
 
@@ -143,15 +142,12 @@ static int amdgpu_ctx_free(struct amdgpu_fpriv *fpriv, uint32_t id)
 }
 
 static int amdgpu_ctx_query(struct amdgpu_device *adev,
-			    struct amdgpu_fpriv *fpriv, uint32_t id,
+			    uint32_t id,
 			    union drm_amdgpu_ctx_out *out)
 {
 	struct amdgpu_ctx *ctx;
 	unsigned reset_counter;
 
-	if (!fpriv)
-		return -EINVAL;
-
 	mutex_lock(&amdgpu_ctx_lock);
 	ctx = idr_find(&amdgpu_ctx_idr, id);
 	if (!ctx) {
@@ -184,21 +180,20 @@ int amdgpu_ctx_ioctl(struct drm_device *dev, void *data,
 
 	union drm_amdgpu_ctx *args = data;
 	struct amdgpu_device *adev = dev->dev_private;
-	struct amdgpu_fpriv *fpriv = filp->driver_priv;
 
 	r = 0;
 	id = args->in.ctx_id;
 
 	switch (args->in.op) {
 	case AMDGPU_CTX_OP_ALLOC_CTX:
-		r = amdgpu_ctx_alloc(adev, fpriv, &id);
+		r = amdgpu_ctx_alloc(adev, &id);
 		args->out.alloc.ctx_id = id;
 		break;
 	case AMDGPU_CTX_OP_FREE_CTX:
-		r = amdgpu_ctx_free(fpriv, id);
+		r = amdgpu_ctx_free(id);
 		break;
 	case AMDGPU_CTX_OP_QUERY_STATE:
-		r = amdgpu_ctx_query(adev, fpriv, id, &args->out);
+		r = amdgpu_ctx_query(adev, id, &args->out);
 		break;
 	default:
 		return -EINVAL;
@@ -207,13 +202,10 @@ int amdgpu_ctx_ioctl(struct drm_device *dev, void *data,
 	return r;
 }
 
-struct amdgpu_ctx *amdgpu_ctx_get(struct amdgpu_fpriv *fpriv, uint32_t id)
+struct amdgpu_ctx *amdgpu_ctx_get(uint32_t id)
 {
 	struct amdgpu_ctx *ctx;
 
-	if (!fpriv)
-		return NULL;
-
 	mutex_lock(&amdgpu_ctx_lock);
 	ctx = idr_find(&amdgpu_ctx_idr, id);
 	if (ctx)
@@ -285,10 +277,3 @@ struct fence *amdgpu_ctx_get_fence(struct amdgpu_ctx *ctx,
 	return fence;
 }
 
-void amdgpu_ctx_mgr_init(struct amdgpu_ctx_mgr *mgr)
-{
-}
-
-void amdgpu_ctx_mgr_fini(struct amdgpu_ctx_mgr *mgr)
-{
-}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 0fb5488..9cef83e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -543,8 +543,6 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
 	mutex_init(&fpriv->bo_list_lock);
 	idr_init(&fpriv->bo_list_handles);
 
-	amdgpu_ctx_mgr_init(&fpriv->ctx_mgr);
-
 	file_priv->driver_priv = fpriv;
 
 	pm_runtime_mark_last_busy(dev->dev);
@@ -576,8 +574,6 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,
 	if (!fpriv)
 		return;
 
-	amdgpu_ctx_mgr_fini(&fpriv->ctx_mgr);
-
 	amdgpu_uvd_free_handles(adev, file_priv);
 	amdgpu_vce_free_handles(adev, file_priv);
 
-- 
1.9.1



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux