summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2014-12-05 11:20:19 +1000
committerBen Skeggs <bskeggs@redhat.com>2015-01-22 12:14:48 +1000
commita38f37a7e06b7ea1bca966805e7a0d03191731f4 (patch)
treeab8bf95957310d8a1a062f5e3663a9ed077f05a5 /drivers/gpu/drm
parent0527a04fe837d66f2d1f8606d625a59d4a1c52cd (diff)
downloadop-kernel-dev-a38f37a7e06b7ea1bca966805e7a0d03191731f4.zip
op-kernel-dev-a38f37a7e06b7ea1bca966805e7a0d03191731f4.tar.gz
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')
-rw-r--r--drivers/gpu/drm/nouveau/core/core/engine.c9
-rw-r--r--drivers/gpu/drm/nouveau/core/core/subdev.c8
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/device/base.c22
-rw-r--r--drivers/gpu/drm/nouveau/core/include/core/device.h39
-rw-r--r--drivers/gpu/drm/nouveau/core/include/core/engine.h2
-rw-r--r--drivers/gpu/drm/nouveau/core/include/core/subdev.h2
6 files changed, 44 insertions, 38 deletions
diff --git a/drivers/gpu/drm/nouveau/core/core/engine.c b/drivers/gpu/drm/nouveau/core/core/engine.c
index 1f6954a..4835056 100644
--- a/drivers/gpu/drm/nouveau/core/core/engine.c
+++ b/drivers/gpu/drm/nouveau/core/core/engine.c
@@ -26,6 +26,15 @@
#include <core/engine.h>
#include <core/option.h>
+struct nouveau_engine *
+nouveau_engine(void *obj, int sub)
+{
+ struct nouveau_subdev *subdev = nouveau_subdev(obj, sub);
+ if (subdev && nv_iclass(subdev, NV_ENGINE_CLASS))
+ return nv_engine(subdev);
+ return NULL;
+}
+
int
nouveau_engine_create_(struct nouveau_object *parent,
struct nouveau_object *engobj,
diff --git a/drivers/gpu/drm/nouveau/core/core/subdev.c b/drivers/gpu/drm/nouveau/core/core/subdev.c
index 28157bf..edae535 100644
--- a/drivers/gpu/drm/nouveau/core/core/subdev.c
+++ b/drivers/gpu/drm/nouveau/core/core/subdev.c
@@ -27,6 +27,14 @@
#include <core/device.h>
#include <core/option.h>
+struct nouveau_subdev *
+nouveau_subdev(void *obj, int sub)
+{
+ if (nv_device(obj)->subdev[sub])
+ return nv_subdev(nv_device(obj)->subdev[sub]);
+ return NULL;
+}
+
void
nouveau_subdev_reset(struct nouveau_object *subdev)
{
diff --git a/drivers/gpu/drm/nouveau/core/engine/device/base.c b/drivers/gpu/drm/nouveau/core/engine/device/base.c
index 714a93e..e2da1d4 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 },
diff --git a/drivers/gpu/drm/nouveau/core/include/core/device.h b/drivers/gpu/drm/nouveau/core/include/core/device.h
index 33b35c4..21a055a 100644
--- a/drivers/gpu/drm/nouveau/core/include/core/device.h
+++ b/drivers/gpu/drm/nouveau/core/include/core/device.h
@@ -105,44 +105,7 @@ struct nouveau_device {
int nouveau_device_list(u64 *name, int size);
-static inline 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 inline struct nouveau_subdev *
-nouveau_subdev(void *obj, int sub)
-{
- if (nv_device(obj)->subdev[sub])
- return nv_subdev(nv_device(obj)->subdev[sub]);
- return NULL;
-}
-
-static inline struct nouveau_engine *
-nouveau_engine(void *obj, int sub)
-{
- struct nouveau_subdev *subdev = nouveau_subdev(obj, sub);
- if (subdev && nv_iclass(subdev, NV_ENGINE_CLASS))
- return nv_engine(subdev);
- return NULL;
-}
+struct nouveau_device *nv_device(void *obj);
static inline bool
nv_device_match(struct nouveau_object *object, u16 dev, u16 ven, u16 sub)
diff --git a/drivers/gpu/drm/nouveau/core/include/core/engine.h b/drivers/gpu/drm/nouveau/core/include/core/engine.h
index 8945755..be04250 100644
--- a/drivers/gpu/drm/nouveau/core/include/core/engine.h
+++ b/drivers/gpu/drm/nouveau/core/include/core/engine.h
@@ -35,6 +35,8 @@ nv_engidx(struct nouveau_object *object)
return nv_subidx(object);
}
+struct nouveau_engine *nouveau_engine(void *obj, int idx);
+
#define nouveau_engine_create(p,e,c,d,i,f,r) \
nouveau_engine_create_((p), (e), (c), (d), (i), (f), \
sizeof(**r),(void **)r)
diff --git a/drivers/gpu/drm/nouveau/core/include/core/subdev.h b/drivers/gpu/drm/nouveau/core/include/core/subdev.h
index c24d64b..d9739ae 100644
--- a/drivers/gpu/drm/nouveau/core/include/core/subdev.h
+++ b/drivers/gpu/drm/nouveau/core/include/core/subdev.h
@@ -33,6 +33,8 @@ nv_subidx(struct nouveau_object *object)
return nv_hclass(nv_subdev(object)) & 0xff;
}
+struct nouveau_subdev *nouveau_subdev(void *obj, int idx);
+
#define nouveau_subdev_create(p,e,o,v,s,f,d) \
nouveau_subdev_create_((p), (e), (o), (v), (s), (f), \
sizeof(**d),(void **)d)
OpenPOWER on IntegriCloud