Skip to content

Commit 61b365a

Browse files
author
Ben Skeggs
committed
drm/nouveau: populate master subdev pointer only when fully constructed
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
1 parent bdefc8c commit 61b365a

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

drivers/gpu/drm/nouveau/core/core/subdev.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,8 @@ nouveau_subdev_create_(struct nouveau_object *parent,
104104

105105
if (parent) {
106106
struct nouveau_device *device = nv_device(parent);
107-
int subidx = nv_hclass(subdev) & 0xff;
108-
109107
subdev->debug = nouveau_dbgopt(device->dbgopt, subname);
110108
subdev->mmio = nv_subdev(device)->mmio;
111-
device->subdev[subidx] = *pobject;
112109
}
113110

114111
return 0;

drivers/gpu/drm/nouveau/core/engine/device/base.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,8 @@ nouveau_devobj_ctor(struct nouveau_object *parent,
268268
if (ret)
269269
return ret;
270270

271+
device->subdev[i] = devobj->subdev[i];
272+
271273
/* note: can't init *any* subdevs until devinit has been run
272274
* due to not knowing exactly what the vbios init tables will
273275
* mess with. devinit also can't be run until all of its

drivers/gpu/drm/nouveau/core/include/subdev/fb.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ struct nouveau_fb {
7575
static inline struct nouveau_fb *
7676
nouveau_fb(void *obj)
7777
{
78+
/* fbram uses this before device subdev pointer is valid */
79+
if (nv_iclass(obj, NV_SUBDEV_CLASS) &&
80+
nv_subidx(obj) == NVDEV_SUBDEV_FB)
81+
return obj;
82+
7883
return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_FB];
7984
}
8085

0 commit comments

Comments
 (0)