- preparation for upcoming patches - open-code current nvkm_ummu() macro - alias remaining use of nvkm_ummu to nvif_mmu_priv, removed later Signed-off-by: Ben Skeggs <bskeggs@xxxxxxxxxx> --- drivers/gpu/drm/nouveau/nvkm/subdev/mmu/umem.c | 2 +- drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c | 6 +++--- drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.h | 5 +++-- drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/umem.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/umem.c index e530bb8b3b17..62d69bb7fe90 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/umem.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/umem.c @@ -142,7 +142,7 @@ int nvkm_umem_new(const struct nvkm_oclass *oclass, void *argv, u32 argc, struct nvkm_object **pobject) { - struct nvkm_mmu *mmu = nvkm_ummu(oclass->parent)->mmu; + struct nvkm_mmu *mmu = container_of(oclass->parent, struct nvif_mmu_priv, object)->mmu; union { struct nvif_mem_v0 v0; } *args = argv; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c index 6870fda4b188..3f008402f451 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c @@ -32,7 +32,7 @@ static int nvkm_ummu_sclass(struct nvkm_object *object, int index, struct nvkm_oclass *oclass) { - struct nvkm_mmu *mmu = nvkm_ummu(object)->mmu; + struct nvkm_mmu *mmu = container_of(object, struct nvif_mmu_priv, object)->mmu; if (mmu->func->mem.user.oclass) { if (index-- == 0) { @@ -132,7 +132,7 @@ nvkm_ummu_kind(struct nvkm_ummu *ummu, void *argv, u32 argc) static int nvkm_ummu_mthd(struct nvkm_object *object, u32 mthd, void *argv, u32 argc) { - struct nvkm_ummu *ummu = nvkm_ummu(object); + struct nvif_mmu_priv *ummu = container_of(object, typeof(*ummu), object); switch (mthd) { case NVIF_MMU_V0_HEAP: return nvkm_ummu_heap(ummu, argv, argc); case NVIF_MMU_V0_TYPE: return nvkm_ummu_type(ummu, argv, argc); @@ -157,7 +157,7 @@ nvkm_ummu_new(struct nvkm_device *device, const struct nvkm_oclass *oclass, struct nvif_mmu_v0 v0; } *args = argv; struct nvkm_mmu *mmu = device->mmu; - struct nvkm_ummu *ummu; + struct nvif_mmu_priv *ummu; int ret = -ENOSYS, kinds = 0; u8 unused = 0; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.h b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.h index 0cd510dcfc68..35ae48758017 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.h +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.h @@ -1,10 +1,11 @@ #ifndef __NVKM_UMMU_H__ #define __NVKM_UMMU_H__ -#define nvkm_ummu(p) container_of((p), struct nvkm_ummu, object) #include <core/object.h> #include "priv.h" -struct nvkm_ummu { +#define nvkm_ummu nvif_mmu_priv + +struct nvif_mmu_priv { struct nvkm_object object; struct nvkm_mmu *mmu; }; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c index cf490ff2b9f1..bd51cdb1c578 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c @@ -532,7 +532,7 @@ int nvkm_uvmm_new(const struct nvkm_oclass *oclass, void *argv, u32 argc, struct nvkm_object **pobject) { - struct nvkm_mmu *mmu = nvkm_ummu(oclass->parent)->mmu; + struct nvkm_mmu *mmu = container_of(oclass->parent, struct nvif_mmu_priv, object)->mmu; const bool more = oclass->base.maxver >= 0; union { struct nvif_vmm_v0 v0; -- 2.41.0