Commit 61b365a5 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau: populate master subdev pointer only when fully constructed

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent bdefc8cb
...@@ -104,11 +104,8 @@ nouveau_subdev_create_(struct nouveau_object *parent, ...@@ -104,11 +104,8 @@ nouveau_subdev_create_(struct nouveau_object *parent,
if (parent) { if (parent) {
struct nouveau_device *device = nv_device(parent); struct nouveau_device *device = nv_device(parent);
int subidx = nv_hclass(subdev) & 0xff;
subdev->debug = nouveau_dbgopt(device->dbgopt, subname); subdev->debug = nouveau_dbgopt(device->dbgopt, subname);
subdev->mmio = nv_subdev(device)->mmio; subdev->mmio = nv_subdev(device)->mmio;
device->subdev[subidx] = *pobject;
} }
return 0; return 0;
......
...@@ -268,6 +268,8 @@ nouveau_devobj_ctor(struct nouveau_object *parent, ...@@ -268,6 +268,8 @@ nouveau_devobj_ctor(struct nouveau_object *parent,
if (ret) if (ret)
return ret; return ret;
device->subdev[i] = devobj->subdev[i];
/* note: can't init *any* subdevs until devinit has been run /* note: can't init *any* subdevs until devinit has been run
* due to not knowing exactly what the vbios init tables will * due to not knowing exactly what the vbios init tables will
* mess with. devinit also can't be run until all of its * mess with. devinit also can't be run until all of its
......
...@@ -75,6 +75,11 @@ struct nouveau_fb { ...@@ -75,6 +75,11 @@ struct nouveau_fb {
static inline struct nouveau_fb * static inline struct nouveau_fb *
nouveau_fb(void *obj) nouveau_fb(void *obj)
{ {
/* fbram uses this before device subdev pointer is valid */
if (nv_iclass(obj, NV_SUBDEV_CLASS) &&
nv_subidx(obj) == NVDEV_SUBDEV_FB)
return obj;
return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_FB]; return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_FB];
} }
......
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