Re: [PATCH 2/4] drm/amdgpu/ttm: drop the adev link from vram mgr

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

 



Am 07.08.20 um 01:34 schrieb Dave Airlie:
From: Dave Airlie <airlied@xxxxxxxxxx>

There is no need for that now since it's embedded.

Signed-off-by: Dave Airlie <airlied@xxxxxxxxxx>

Reviewed-by: Christian König <christian.koenig@xxxxxxx>

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h      |  1 -
  drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 11 +++++++----
  2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
index 168294be276d..4a6d92f27b6e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
@@ -47,7 +47,6 @@ struct amdgpu_vram_mgr {
  	spinlock_t lock;
  	atomic64_t usage;
  	atomic64_t vis_usage;
-	struct amdgpu_device *adev;
  };
struct amdgpu_gtt_mgr {
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
index a41a8abc9927..7882efd275d1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
@@ -33,6 +33,11 @@ static inline struct amdgpu_vram_mgr *to_vram_mgr(struct ttm_resource_manager *m
  	return container_of(man, struct amdgpu_vram_mgr, manager);
  }
+static inline struct amdgpu_device *to_amdgpu_device(struct amdgpu_vram_mgr *mgr)
+{
+	return container_of(mgr, struct amdgpu_device, mman.vram_mgr);
+}
+
  /**
   * DOC: mem_info_vram_total
   *
@@ -182,8 +187,6 @@ int amdgpu_vram_mgr_init(struct amdgpu_device *adev)
  	drm_mm_init(&mgr->mm, 0, man->size);
  	spin_lock_init(&mgr->lock);
- mgr->adev = adev;
-
  	/* Add the two VRAM-related sysfs files */
  	ret = sysfs_create_files(&adev->dev->kobj, amdgpu_vram_mgr_attributes);
  	if (ret)
@@ -311,7 +314,7 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
  			       struct ttm_resource *mem)
  {
  	struct amdgpu_vram_mgr *mgr = to_vram_mgr(man);
-	struct amdgpu_device *adev = mgr->adev;
+	struct amdgpu_device *adev = to_amdgpu_device(mgr);
  	struct drm_mm *mm = &mgr->mm;
  	struct drm_mm_node *nodes;
  	enum drm_mm_insert_mode mode;
@@ -429,7 +432,7 @@ static void amdgpu_vram_mgr_del(struct ttm_resource_manager *man,
  				struct ttm_resource *mem)
  {
  	struct amdgpu_vram_mgr *mgr = to_vram_mgr(man);
-	struct amdgpu_device *adev = mgr->adev;
+	struct amdgpu_device *adev = to_amdgpu_device(mgr);
  	struct drm_mm_node *nodes = mem->mm_node;
  	uint64_t usage = 0, vis_usage = 0;
  	unsigned pages = mem->num_pages;

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux