Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
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)
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;