diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2014-12-05 11:20:19 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2015-01-22 12:14:48 +1000 |
commit | a38f37a7e06b7ea1bca966805e7a0d03191731f4 (patch) | |
tree | ab8bf95957310d8a1a062f5e3663a9ed077f05a5 /drivers/gpu/drm/nouveau/core/engine/device/base.c | |
parent | 0527a04fe837d66f2d1f8606d625a59d4a1c52cd (diff) |
drm/nouveau/core: uninline subdev/engine/device lookup functions
These are a tad more complex than a direct cast with paranoia safeties.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/core/engine/device/base.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/core/engine/device/base.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/core/engine/device/base.c b/drivers/gpu/drm/nouveau/core/engine/device/base.c index 714a93eb1fd..e2da1d4029c 100644 --- a/drivers/gpu/drm/nouveau/core/engine/device/base.c +++ b/drivers/gpu/drm/nouveau/core/engine/device/base.c @@ -508,6 +508,28 @@ nouveau_devobj_ofuncs = { * nouveau_device: engine functions *****************************************************************************/ +struct nouveau_device * +nv_device(void *obj) +{ + struct nouveau_object *object = nv_object(obj); + struct nouveau_object *device = object; + + if (device->engine) + device = device->engine; + if (device->parent) + device = device->parent; + +#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA + if (unlikely(!nv_iclass(device, NV_SUBDEV_CLASS) || + (nv_hclass(device) & 0xff) != NVDEV_ENGINE_DEVICE)) { + nv_assert("BAD CAST -> NvDevice, 0x%08x 0x%08x", + nv_hclass(object), nv_hclass(device)); + } +#endif + + return (void *)device; +} + static struct nouveau_oclass nouveau_device_sclass[] = { { 0x0080, &nouveau_devobj_ofuncs }, |