@@ -1153,6 +1153,27 @@ nouveau_platform_device_create(const struct nvkm_device_tegra_func *func,
return ERR_PTR(err);
}
+void nouveau_cli_printk(struct nouveau_cli *cli, const char *fmt, ...)
+{
+ struct va_format vaf;
+ va_list args;
+ char level[2] = {KERN_SOH_ASCII, 0};
+
+ level[1] = printk_get_level(fmt);
+ if (level[1] == 0)
+ level[1] = 'd';
+
+ va_start(args, fmt);
+
+ vaf.fmt = printk_skip_headers(fmt);
+ vaf.va = &args;
+
+ dev_printk(level, cli->drm->dev->dev, "%s: %pV",
+ cli->name, &vaf);
+
+ va_end(args);
+}
+
static int __init
nouveau_drm_init(void)
{
@@ -244,18 +244,28 @@ void nouveau_drm_device_remove(struct drm_device *dev);
struct nouveau_cli *_cli = (c); \
dev_##l(_cli->drm->dev->dev, "%s: "f, _cli->name, ##a); \
} while(0)
-#define NV_FATAL(drm,f,a...) NV_PRINTK(crit, &(drm)->client, f, ##a)
-#define NV_ERROR(drm,f,a...) NV_PRINTK(err, &(drm)->client, f, ##a)
-#define NV_WARN(drm,f,a...) NV_PRINTK(warn, &(drm)->client, f, ##a)
-#define NV_INFO(drm,f,a...) NV_PRINTK(info, &(drm)->client, f, ##a)
-#define NV_DEBUG(drm,f,a...) do { \
- if (unlikely(drm_debug & DRM_UT_DRIVER)) \
- NV_PRINTK(info, &(drm)->client, f, ##a); \
-} while(0)
-#define NV_ATOMIC(drm,f,a...) do { \
- if (unlikely(drm_debug & DRM_UT_ATOMIC)) \
- NV_PRINTK(info, &(drm)->client, f, ##a); \
-} while(0)
+
+__printf(2, 3)
+void nouveau_cli_printk(struct nouveau_cli *cli, const char *fmt, ...);
+
+#define NV_FATAL(drm, fmt, ...) \
+ nouveau_cli_printk(&(drm)->client, KERN_CRIT fmt, ##__VA_ARGS__)
+#define NV_ERROR(drm, fmt, ...) \
+ nouveau_cli_printk(&(drm)->client, KERN_ERR fmt, ##__VA_ARGS__)
+#define NV_WARN(drm, fmt, ...) \
+ nouveau_cli_printk(&(drm)->client, KERN_WARNING fmt, ##__VA_ARGS__)
+#define NV_INFO(drm, fmt, ...) \
+ nouveau_cli_printk(&(drm)->client, KERN_INFO fmt, ##__VA_ARGS__)
+#define NV_DEBUG(drm, fmt, ...) \
+do { \
+ if (unlikely(drm_debug & DRM_UT_DRIVER)) \
+ NV_INFO(drm, fmt, ##__VA_ARGS__); \
+} while (0)
+#define NV_ATOMIC(drm, fmt, ...) \
+do { \
+ if (unlikely(drm_debug & DRM_UT_ATOMIC)) \
+ NV_INFO(drm, fmt, ##__VA_ARGS__); \
+} while (0)
extern int nouveau_modeset;
NV_PRINTK is a macro that adds the "%s: ", nouveau_cli.name to logging output. Save a few KB by creating a specific function to add that name and change the users of theh NV_PRINTK macros to use the new logging function. (size -t drivers/gpu/drm/nouveau/built-in.a x86/64 defconfig with nouveau) text data bss dec hex filename 1737254 108484 1048 1846786 1c2e02 (TOTALS) (new) 1740706 108484 1048 1850238 1c3b7e (TOTALS) (old) Signed-off-by: Joe Perches <joe@perches.com> --- drivers/gpu/drm/nouveau/nouveau_drm.c | 21 +++++++++++++++++++++ drivers/gpu/drm/nouveau/nouveau_drv.h | 34 ++++++++++++++++++++++------------ 2 files changed, 43 insertions(+), 12 deletions(-)