void
_nouveau_instobj_dtor(struct nouveau_object *object)
{
- struct nouveau_instmem *imem = (void *)object->engine;
+ struct nouveau_instmem *imem = nouveau_instmem(object);
struct nouveau_instobj *iobj = (void *)object;
mutex_lock(&nv_subdev(imem)->mutex);
struct nouveau_oclass *oclass,
int length, void **pobject)
{
- struct nouveau_instmem *imem = (void *)engine;
+ struct nouveau_instmem *imem = nouveau_instmem(parent);
struct nouveau_instobj *iobj;
int ret;
struct nouveau_object *parent, u32 size, u32 align,
struct nouveau_object **pobject)
{
- struct nouveau_object *engine = nv_object(imem);
- struct nouveau_instmem_impl *impl = (void *)engine->oclass;
+ struct nouveau_instmem_impl *impl = (void *)imem->base.object.oclass;
struct nouveau_instobj_args args = { .size = size, .align = align };
- return nouveau_object_ctor(parent, engine, impl->instobj, &args,
+ return nouveau_object_ctor(parent, parent->engine, impl->instobj, &args,
sizeof(args), pobject);
}
static u32
nv04_instobj_rd32(struct nouveau_object *object, u64 addr)
{
+ struct nv04_instmem_priv *priv = (void *)nouveau_instmem(object);
struct nv04_instobj_priv *node = (void *)object;
- return nv_ro32(object->engine, node->mem->offset + addr);
+ return nv_ro32(priv, node->mem->offset + addr);
}
static void
nv04_instobj_wr32(struct nouveau_object *object, u64 addr, u32 data)
{
+ struct nv04_instmem_priv *priv = (void *)nouveau_instmem(object);
struct nv04_instobj_priv *node = (void *)object;
- nv_wo32(object->engine, node->mem->offset + addr, data);
+ nv_wo32(priv, node->mem->offset + addr, data);
}
static void
nv04_instobj_dtor(struct nouveau_object *object)
{
- struct nv04_instmem_priv *priv = (void *)object->engine;
+ struct nv04_instmem_priv *priv = (void *)nouveau_instmem(object);
struct nv04_instobj_priv *node = (void *)object;
nouveau_mm_free(&priv->heap, &node->mem);
nouveau_instobj_destroy(&node->base);
struct nouveau_oclass *oclass, void *data, u32 size,
struct nouveau_object **pobject)
{
- struct nv04_instmem_priv *priv = (void *)engine;
+ struct nv04_instmem_priv *priv = (void *)nouveau_instmem(parent);
struct nv04_instobj_priv *node;
struct nouveau_instobj_args *args = data;
int ret;
static u32
nv50_instobj_rd32(struct nouveau_object *object, u64 offset)
{
- struct nv50_instmem_priv *priv = (void *)object->engine;
+ struct nv50_instmem_priv *priv = (void *)nouveau_instmem(object);
struct nv50_instobj_priv *node = (void *)object;
unsigned long flags;
u64 base = (node->mem->offset + offset) & 0xffffff00000ULL;
static void
nv50_instobj_wr32(struct nouveau_object *object, u64 offset, u32 data)
{
- struct nv50_instmem_priv *priv = (void *)object->engine;
+ struct nv50_instmem_priv *priv = (void *)nouveau_instmem(object);
struct nv50_instobj_priv *node = (void *)object;
unsigned long flags;
u64 base = (node->mem->offset + offset) & 0xffffff00000ULL;