Commit 9aecbada authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/device: have engine object initialised before creation

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent dded35de
...@@ -58,8 +58,9 @@ nouveau_client_create_(const char *name, u64 devname, const char *cfg, ...@@ -58,8 +58,9 @@ nouveau_client_create_(const char *name, u64 devname, const char *cfg,
return -ENODEV; return -ENODEV;
ret = nouveau_namedb_create_(NULL, NULL, &nouveau_client_oclass, ret = nouveau_namedb_create_(NULL, NULL, &nouveau_client_oclass,
NV_CLIENT_CLASS, nouveau_device_sclass, NV_CLIENT_CLASS, NULL,
0, length, pobject); (1ULL << NVDEV_ENGINE_DEVICE),
length, pobject);
client = *pobject; client = *pobject;
if (ret) if (ret)
return ret; return ret;
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <core/object.h> #include <core/object.h>
#include <core/parent.h> #include <core/parent.h>
#include <core/client.h>
int int
nouveau_parent_sclass(struct nouveau_object *parent, u16 handle, nouveau_parent_sclass(struct nouveau_object *parent, u16 handle,
...@@ -50,7 +51,12 @@ nouveau_parent_sclass(struct nouveau_object *parent, u16 handle, ...@@ -50,7 +51,12 @@ nouveau_parent_sclass(struct nouveau_object *parent, u16 handle,
while (mask) { while (mask) {
int i = ffsll(mask) - 1; 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; oclass = engine->sclass;
while (oclass->ofuncs) { while (oclass->ofuncs) {
if ((oclass->handle & 0xffff) == handle) { if ((oclass->handle & 0xffff) == handle) {
......
...@@ -413,7 +413,7 @@ nouveau_devobj_ofuncs = { ...@@ -413,7 +413,7 @@ nouveau_devobj_ofuncs = {
/****************************************************************************** /******************************************************************************
* nouveau_device: engine functions * nouveau_device: engine functions
*****************************************************************************/ *****************************************************************************/
struct nouveau_oclass static struct nouveau_oclass
nouveau_device_sclass[] = { nouveau_device_sclass[] = {
{ 0x0080, &nouveau_devobj_ofuncs }, { 0x0080, &nouveau_devobj_ofuncs },
{} {}
...@@ -470,6 +470,7 @@ nouveau_device_create_(struct pci_dev *pdev, u64 name, const char *sname, ...@@ -470,6 +470,7 @@ nouveau_device_create_(struct pci_dev *pdev, u64 name, const char *sname,
device->name = sname; device->name = sname;
nv_subdev(device)->debug = nouveau_dbgopt(device->dbgopt, "DEVICE"); nv_subdev(device)->debug = nouveau_dbgopt(device->dbgopt, "DEVICE");
nv_engine(device)->sclass = nouveau_device_sclass;
list_add(&device->head, &nv_devices); list_add(&device->head, &nv_devices);
done: done:
mutex_unlock(&nv_devices_mutex); mutex_unlock(&nv_devices_mutex);
......
...@@ -18,7 +18,6 @@ int nv50_identify(struct nouveau_device *); ...@@ -18,7 +18,6 @@ int nv50_identify(struct nouveau_device *);
int nvc0_identify(struct nouveau_device *); int nvc0_identify(struct nouveau_device *);
int nve0_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); struct nouveau_device *nouveau_device_find(u64 name);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment