diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2015-08-20 07:54:11 +0300 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2015-08-28 05:40:21 +0300 |
commit | 6594363b9f765e569feb6222d7d07e19db3fa460 (patch) | |
tree | bef418181b4866e76fef61ea5c77fecc0dcbf825 /drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h | |
parent | 5444204036b2e3a4aeeef6265897df3a9976bf97 (diff) | |
download | linux-6594363b9f765e569feb6222d7d07e19db3fa460.tar.xz |
drm/nouveau/core: type-safe printk macros
These require an explicit pointers to nvkm_object/nvkm_subdev/nvkm_device,
depending on which macros are used. This is unlike the previous macros
which take a void *, and work for anything derived from nvkm_object (by
way of some awful heuristics).
The output will be a bit confused until everything has been transitioned,
as the logging format used is a more standard style that previously.
In addition, usage of pr_cont(), which doesn't work correctly with the
dev_*() printk functions (and was potentially racy to begin with), will
be replaced.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h')
-rw-r--r-- | drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h b/drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h index ad516cf24f6c..e146f2758b07 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h @@ -11,7 +11,7 @@ struct nvkm_subdev { struct nvkm_device *device; struct mutex mutex; - const char *name; + const char *name, *sname; u32 debug; u32 unit; @@ -53,11 +53,20 @@ void _nvkm_subdev_dtor(struct nvkm_object *); int _nvkm_subdev_init(struct nvkm_object *); int _nvkm_subdev_fini(struct nvkm_object *, bool suspend); -#define s_printk(s,l,f,a...) do { \ - if ((s)->debug >= OS_DBG_##l) { \ - nv_printk((s)->base.parent, (s)->name, l, f, ##a); \ - } \ +/* subdev logging */ +#define nvkm_printk_(s,l,p,f,a...) do { \ + struct nvkm_subdev *_subdev = (s); \ + if (_subdev->debug >= (l)) \ + dev_##p(_subdev->device->dev, "%s: "f, _subdev->sname, ##a); \ } while(0) +#define nvkm_printk(s,l,p,f,a...) nvkm_printk_((s), NV_DBG_##l, p, f, ##a) +#define nvkm_fatal(s,f,a...) nvkm_printk((s), FATAL, crit, f, ##a) +#define nvkm_error(s,f,a...) nvkm_printk((s), ERROR, err, f, ##a) +#define nvkm_warn(s,f,a...) nvkm_printk((s), WARN, notice, f, ##a) +#define nvkm_info(s,f,a...) nvkm_printk((s), INFO, info, f, ##a) +#define nvkm_debug(s,f,a...) nvkm_printk((s), DEBUG, info, f, ##a) +#define nvkm_trace(s,f,a...) nvkm_printk((s), TRACE, info, f, ##a) +#define nvkm_spam(s,f,a...) nvkm_printk((s), SPAM, dbg, f, ##a) #include <core/engine.h> #endif |