From a47474261e77b148480daff855e516dc60e80b48 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 20 Aug 2015 14:54:13 +1000 Subject: drm/nouveau/imem: remove object accessor functions Signed-off-by: Ben Skeggs --- drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv40.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv40.c') diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv40.c b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv40.c index c194a28b7971..c645e0261530 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv40.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv40.c @@ -31,19 +31,25 @@ *****************************************************************************/ static u32 -nv40_instmem_rd32(struct nvkm_object *object, u64 addr) +nv40_instmem_rd32(struct nvkm_instmem *obj, u32 addr) { - struct nv04_instmem *imem = (void *)object; + struct nv04_instmem *imem = container_of(obj, typeof(*imem), base); return ioread32_native(imem->iomem + addr); } static void -nv40_instmem_wr32(struct nvkm_object *object, u64 addr, u32 data) +nv40_instmem_wr32(struct nvkm_instmem *obj, u32 addr, u32 data) { - struct nv04_instmem *imem = (void *)object; + struct nv04_instmem *imem = container_of(obj, typeof(*imem), base); iowrite32_native(data, imem->iomem + addr); } +static const struct nvkm_instmem_func +nv40_instmem_func = { + .rd32 = nv40_instmem_rd32, + .wr32 = nv40_instmem_wr32, +}; + static int nv40_instmem_ctor(struct nvkm_object *parent, struct nvkm_object *engine, struct nvkm_oclass *oclass, void *data, u32 size, @@ -58,6 +64,8 @@ nv40_instmem_ctor(struct nvkm_object *parent, struct nvkm_object *engine, if (ret) return ret; + imem->base.func = &nv40_instmem_func; + /* map bar */ if (nv_device_resource_len(device, 2)) bar = 2; @@ -129,8 +137,6 @@ nv40_instmem_oclass = &(struct nvkm_instmem_impl) { .dtor = nv04_instmem_dtor, .init = _nvkm_instmem_init, .fini = _nvkm_instmem_fini, - .rd32 = nv40_instmem_rd32, - .wr32 = nv40_instmem_wr32, }, .instobj = &nv04_instobj_oclass.base, }.base; -- cgit v1.2.1