drm/nouveau/device: have engine object initialised before creation
authorBen Skeggs <bskeggs@redhat.com>
Thu, 25 Apr 2013 07:56:03 +0000 (17:56 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 26 Apr 2013 05:38:11 +0000 (15:38 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/core/core/client.c
drivers/gpu/drm/nouveau/core/core/parent.c
drivers/gpu/drm/nouveau/core/engine/device/base.c
drivers/gpu/drm/nouveau/core/include/engine/device.h

index 2be389d72f52f2039bbfa54b9f5d8f3542837200..9079c0ac58e6ba071fed5d2f6005af46b21911dc 100644 (file)
@@ -58,8 +58,9 @@ nouveau_client_create_(const char *name, u64 devname, const char *cfg,
                return -ENODEV;
 
        ret = nouveau_namedb_create_(NULL, NULL, &nouveau_client_oclass,
-                                    NV_CLIENT_CLASS, nouveau_device_sclass,
-                                    0, length, pobject);
+                                    NV_CLIENT_CLASS, NULL,
+                                    (1ULL << NVDEV_ENGINE_DEVICE),
+                                    length, pobject);
        client = *pobject;
        if (ret)
                return ret;
index db7c549431026f8ad56eeeb6d1062ff3063aa4a9..313380ce632df1b9f1b9eef0915ef14deade0162 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <core/object.h>
 #include <core/parent.h>
+#include <core/client.h>
 
 int
 nouveau_parent_sclass(struct nouveau_object *parent, u16 handle,
@@ -50,7 +51,12 @@ nouveau_parent_sclass(struct nouveau_object *parent, u16 handle,
        while (mask) {
                int i = ffsll(mask) - 1;
 
-               if ((engine = nouveau_engine(parent, i))) {
+               if (nv_iclass(parent, NV_CLIENT_CLASS))
+                       engine = nv_engine(nv_client(parent)->device);
+               else
+                       engine = nouveau_engine(parent, i);
+
+               if (engine) {
                        oclass = engine->sclass;
                        while (oclass->ofuncs) {
                                if ((oclass->handle & 0xffff) == handle) {
index 35616424f559aaac98ea86946b0fc727b1ca8d9f..30723ee8114c294e3f5b420d11374f56ac7645b6 100644 (file)
@@ -413,7 +413,7 @@ nouveau_devobj_ofuncs = {
 /******************************************************************************
  * nouveau_device: engine functions
  *****************************************************************************/
-struct nouveau_oclass
+static struct nouveau_oclass
 nouveau_device_sclass[] = {
        { 0x0080, &nouveau_devobj_ofuncs },
        {}
@@ -470,6 +470,7 @@ nouveau_device_create_(struct pci_dev *pdev, u64 name, const char *sname,
        device->name = sname;
 
        nv_subdev(device)->debug = nouveau_dbgopt(device->dbgopt, "DEVICE");
+       nv_engine(device)->sclass = nouveau_device_sclass;
        list_add(&device->head, &nv_devices);
 done:
        mutex_unlock(&nv_devices_mutex);
index c9e4c4afa50e83ad3058377e0ddbf98981747e47..b3dd2c4c2f1ede9405fda56e08150949f8f556c1 100644 (file)
@@ -18,7 +18,6 @@ int nv50_identify(struct nouveau_device *);
 int nvc0_identify(struct nouveau_device *);
 int nve0_identify(struct nouveau_device *);
 
-extern struct nouveau_oclass nouveau_device_sclass[];
 struct nouveau_device *nouveau_device_find(u64 name);
 
 #endif