summaryrefslogtreecommitdiff
path: root/nvkm
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2014-12-05 11:03:18 +1000
committerBen Skeggs <bskeggs@redhat.com>2015-01-10 23:57:06 +1000
commitc4eb2e2bad75870f537a0e33aa405cb2b5595a31 (patch)
tree43eb31fa3ea5f31920b3167ffbedeeae8c2a9fd0 /nvkm
parent3a333d26a2653600018f1b7fed102b91b8807a30 (diff)
downloadnouveau-c4eb2e2bad75870f537a0e33aa405cb2b5595a31.tar.gz
core: prepare printk for NULL engine pointer on device object tree
The [ SUBDEV] specified in log output will be a bit different for children of a subdev now. Previously this reports whatever subdev is specified by object.engine, now it reports the subdev that owns the object (so, up object.parent somewhere). Later patches will append object and class identifiers to messages, which will help clarify where it's coming from. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'nvkm')
-rw-r--r--nvkm/core/printk.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/nvkm/core/printk.c b/nvkm/core/printk.c
index d6c4d9072..1060e3a17 100644
--- a/nvkm/core/printk.c
+++ b/nvkm/core/printk.c
@@ -60,21 +60,26 @@ nv_printk_(struct nouveau_object *object, int level, const char *fmt, ...)
}
if (object && !nv_iclass(object, NV_CLIENT_CLASS)) {
- struct nouveau_object *device = object;
- struct nouveau_object *subdev = object;
+ struct nouveau_object *device;
+ struct nouveau_object *subdev;
char obuf[64], *ofmt = "";
- if (object->engine) {
+ subdev = object;
+ while (subdev && !nv_iclass(subdev, NV_SUBDEV_CLASS))
+ subdev = subdev->parent;
+ if (!subdev)
+ subdev = object->engine;
+
+ device = subdev;
+ if (device->parent)
+ device = device->parent;
+
+ if (object != subdev) {
snprintf(obuf, sizeof(obuf), "[0x%08x]",
nv_hclass(object));
ofmt = obuf;
- subdev = object->engine;
- device = object->engine;
}
- if (subdev->parent)
- device = subdev->parent;
-
if (level > nv_subdev(subdev)->debug)
return;