Skip to content

Commit

Permalink
drm/nouveau: populate master subdev pointer only when fully constructed
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
  • Loading branch information
Ben Skeggs committed Jan 7, 2014
1 parent bdefc8c commit 61b365a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 0 additions & 3 deletions drivers/gpu/drm/nouveau/core/core/subdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,8 @@ nouveau_subdev_create_(struct nouveau_object *parent,

if (parent) {
struct nouveau_device *device = nv_device(parent);
int subidx = nv_hclass(subdev) & 0xff;

subdev->debug = nouveau_dbgopt(device->dbgopt, subname);
subdev->mmio = nv_subdev(device)->mmio;
device->subdev[subidx] = *pobject;
}

return 0;
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/nouveau/core/engine/device/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ nouveau_devobj_ctor(struct nouveau_object *parent,
if (ret)
return ret;

device->subdev[i] = devobj->subdev[i];

/* note: can't init *any* subdevs until devinit has been run
* due to not knowing exactly what the vbios init tables will
* mess with. devinit also can't be run until all of its
Expand Down
5 changes: 5 additions & 0 deletions drivers/gpu/drm/nouveau/core/include/subdev/fb.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ struct nouveau_fb {
static inline struct nouveau_fb *
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];
}

Expand Down

0 comments on commit 61b365a

Please sign in to comment.