drm/nouveau/core: can now assume client/device object tree based on object.engine
authorBen Skeggs <bskeggs@redhat.com>
Fri, 5 Dec 2014 02:21:34 +0000 (12:21 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 22 Jan 2015 02:14:54 +0000 (12:14 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/core/core/printk.c
drivers/gpu/drm/nouveau/core/engine/device/base.c

index 1060e3a173fe8ba304b79dc926212258fcef935b..81f5596926249aa5b800ca0cb8da53bccccea853 100644 (file)
@@ -64,11 +64,13 @@ nv_printk_(struct nouveau_object *object, int level, const char *fmt, ...)
                struct nouveau_object *subdev;
                char obuf[64], *ofmt = "";
 
-               subdev = object;
-               while (subdev && !nv_iclass(subdev, NV_SUBDEV_CLASS))
-                       subdev = subdev->parent;
-               if (!subdev)
+               if (object->engine == NULL) {
+                       subdev = object;
+                       while (subdev && !nv_iclass(subdev, NV_SUBDEV_CLASS))
+                               subdev = subdev->parent;
+               } else {
                        subdev = object->engine;
+               }
 
                device = subdev;
                if (device->parent)
index 7c0cbcde7b2f344b8dc05d6a6a2d2e12d858be74..0a6abc23f85d4825934f7fe9fed05642e2b607d9 100644 (file)
@@ -512,9 +512,10 @@ struct nouveau_device *
 nv_device(void *obj)
 {
        struct nouveau_object *device = nv_object(obj);
-       while (device && device->parent)
-               device = device->parent;
-       if (!nv_iclass(device, NV_ENGINE_CLASS)) {
+       if (device->engine == NULL) {
+               while (device && device->parent)
+                       device = device->parent;
+       } else {
                device = nv_object(obj)->engine;
                if (device && device->parent)
                        device = device->parent;