The nouveau_cli pointer is only ever used to eventually access
nouveau_drm, so just store it directly.

Signed-off-by: Ben Skeggs <bske...@nvidia.com>
---
 drivers/gpu/drm/nouveau/nouveau_mem.c   | 18 ++++++++----------
 drivers/gpu/drm/nouveau/nouveau_mem.h   |  4 ++--
 drivers/gpu/drm/nouveau/nouveau_sgdma.c |  2 +-
 drivers/gpu/drm/nouveau/nouveau_ttm.c   |  8 ++++----
 4 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c 
b/drivers/gpu/drm/nouveau/nouveau_mem.c
index 67f93cf753ba..b112b62dca3c 100644
--- a/drivers/gpu/drm/nouveau/nouveau_mem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_mem.c
@@ -78,19 +78,18 @@ nouveau_mem_map(struct nouveau_mem *mem,
 void
 nouveau_mem_fini(struct nouveau_mem *mem)
 {
-       nvif_vmm_put(&mem->cli->drm->client.vmm.vmm, &mem->vma[1]);
-       nvif_vmm_put(&mem->cli->drm->client.vmm.vmm, &mem->vma[0]);
-       mutex_lock(&mem->cli->drm->master.lock);
+       nvif_vmm_put(&mem->drm->client.vmm.vmm, &mem->vma[1]);
+       nvif_vmm_put(&mem->drm->client.vmm.vmm, &mem->vma[0]);
+       mutex_lock(&mem->drm->master.lock);
        nvif_mem_dtor(&mem->mem);
-       mutex_unlock(&mem->cli->drm->master.lock);
+       mutex_unlock(&mem->drm->master.lock);
 }
 
 int
 nouveau_mem_host(struct ttm_resource *reg, struct ttm_tt *tt)
 {
        struct nouveau_mem *mem = nouveau_mem(reg);
-       struct nouveau_cli *cli = mem->cli;
-       struct nouveau_drm *drm = cli->drm;
+       struct nouveau_drm *drm = mem->drm;
        struct nvif_mmu *mmu = &drm->mmu;
        struct nvif_mem_ram_v0 args = {};
        u8 type;
@@ -126,8 +125,7 @@ int
 nouveau_mem_vram(struct ttm_resource *reg, bool contig, u8 page)
 {
        struct nouveau_mem *mem = nouveau_mem(reg);
-       struct nouveau_cli *cli = mem->cli;
-       struct nouveau_drm *drm = cli->drm;
+       struct nouveau_drm *drm = mem->drm;
        struct nvif_mmu *mmu = &drm->mmu;
        u64 size = ALIGN(reg->size, 1 << page);
        int ret;
@@ -173,7 +171,7 @@ nouveau_mem_del(struct ttm_resource_manager *man, struct 
ttm_resource *reg)
 }
 
 int
-nouveau_mem_new(struct nouveau_cli *cli, u8 kind, u8 comp,
+nouveau_mem_new(struct nouveau_drm *drm, u8 kind, u8 comp,
                struct ttm_resource **res)
 {
        struct nouveau_mem *mem;
@@ -181,7 +179,7 @@ nouveau_mem_new(struct nouveau_cli *cli, u8 kind, u8 comp,
        if (!(mem = kzalloc(sizeof(*mem), GFP_KERNEL)))
                return -ENOMEM;
 
-       mem->cli = cli;
+       mem->drm = drm;
        mem->kind = kind;
        mem->comp = comp;
 
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.h 
b/drivers/gpu/drm/nouveau/nouveau_mem.h
index 5365a3d3a17f..a070ee049f6b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_mem.h
+++ b/drivers/gpu/drm/nouveau/nouveau_mem.h
@@ -8,7 +8,7 @@ struct ttm_tt;
 
 struct nouveau_mem {
        struct ttm_resource base;
-       struct nouveau_cli *cli;
+       struct nouveau_drm *drm;
        u8 kind;
        u8 comp;
        struct nvif_mem mem;
@@ -21,7 +21,7 @@ nouveau_mem(struct ttm_resource *reg)
        return container_of(reg, struct nouveau_mem, base);
 }
 
-int nouveau_mem_new(struct nouveau_cli *, u8 kind, u8 comp,
+int nouveau_mem_new(struct nouveau_drm *, u8 kind, u8 comp,
                    struct ttm_resource **);
 void nouveau_mem_del(struct ttm_resource_manager *man,
                     struct ttm_resource *);
diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c 
b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
index b14895f75b3c..bd870028514b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c
+++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
@@ -43,7 +43,7 @@ nouveau_sgdma_bind(struct ttm_device *bdev, struct ttm_tt 
*ttm, struct ttm_resou
                return ret;
 
        if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA) {
-               ret = nouveau_mem_map(mem, &mem->cli->vmm.vmm, &mem->vma[0]);
+               ret = nouveau_mem_map(mem, &drm->client.vmm.vmm, &mem->vma[0]);
                if (ret) {
                        nouveau_mem_fini(mem);
                        return ret;
diff --git a/drivers/gpu/drm/nouveau/nouveau_ttm.c 
b/drivers/gpu/drm/nouveau/nouveau_ttm.c
index 53553819bcac..e244927eb5d4 100644
--- a/drivers/gpu/drm/nouveau/nouveau_ttm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c
@@ -73,7 +73,7 @@ nouveau_vram_manager_new(struct ttm_resource_manager *man,
        if (drm->client.device.info.ram_size == 0)
                return -ENOMEM;
 
-       ret = nouveau_mem_new(&drm->master, nvbo->kind, nvbo->comp, res);
+       ret = nouveau_mem_new(drm, nvbo->kind, nvbo->comp, res);
        if (ret)
                return ret;
 
@@ -105,7 +105,7 @@ nouveau_gart_manager_new(struct ttm_resource_manager *man,
        struct nouveau_drm *drm = nouveau_bdev(bo->bdev);
        int ret;
 
-       ret = nouveau_mem_new(&drm->master, nvbo->kind, nvbo->comp, res);
+       ret = nouveau_mem_new(drm, nvbo->kind, nvbo->comp, res);
        if (ret)
                return ret;
 
@@ -132,13 +132,13 @@ nv04_gart_manager_new(struct ttm_resource_manager *man,
        struct nouveau_mem *mem;
        int ret;
 
-       ret = nouveau_mem_new(&drm->master, nvbo->kind, nvbo->comp, res);
+       ret = nouveau_mem_new(drm, nvbo->kind, nvbo->comp, res);
        if (ret)
                return ret;
 
        mem = nouveau_mem(*res);
        ttm_resource_init(bo, place, *res);
-       ret = nvif_vmm_get(&mem->cli->vmm.vmm, PTES, false, 12, 0,
+       ret = nvif_vmm_get(&drm->client.vmm.vmm, PTES, false, 12, 0,
                           (long)(*res)->size, &mem->vma[0]);
        if (ret) {
                nouveau_mem_del(man, *res);
-- 
2.45.1

Reply via email to