@@ -80,12 +80,21 @@ void drm_dev_printk(const struct device *dev, const char *level,
vaf.fmt = format;
vaf.va = &args;
- if (dev)
- dev_printk(level, dev, "[%s:%ps]%s %pV",
- driver, function_name, prefix, &vaf);
- else
- printk("%s[%s:%ps]%s %pV",
- level, driver, function_name, prefix, &vaf);
+ if (level[1] != KERN_DEBUG[1]) {
+ if (dev)
+ dev_printk(level, dev, "[%s]%s %pV",
+ driver, prefix, &vaf);
+ else
+ printk("%s[%s]%s %pV",
+ level, driver, prefix, &vaf);
+ } else {
+ if (dev)
+ dev_printk(level, dev, "[%s:%ps]%s %pV",
+ driver, function_name, prefix, &vaf);
+ else
+ printk("%s[%s:%ps]%s %pV",
+ level, driver, function_name, prefix, &vaf);
+ }
va_end(args);
}
@@ -104,9 +113,13 @@ void drm_printk(const char *level, unsigned int category,
vaf.fmt = format;
vaf.va = &args;
- printk("%s[%s:%ps]%s %pV",
- level, driver, __builtin_return_address(0),
- strcmp(level, KERN_ERR) == 0 ? " *ERROR*" : "", &vaf);
+ if (level[1] != KERN_DEBUG[1])
+ printk("%s[%s]%s %pV",
+ level, driver,
+ strcmp(level, KERN_ERR) == 0 ? " *ERROR*" : "", &vaf);
+ else
+ printk("%s[%s:%ps] %pV",
+ level, driver, __builtin_return_address(0), &vaf);
va_end(args);
}
@@ -146,25 +146,41 @@ struct dma_buf_attachment;
/** \name Macros to make printk easier */
/*@{*/
-#define _DRM_PRINTK(once, level, fmt, ...) \
- do { \
- printk##once(KERN_##level "[" DRM_NAME "] " fmt, \
- ##__VA_ARGS__); \
- } while (0)
-
#define DRM_INFO(fmt, ...) \
- _DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
-#define DRM_NOTE(fmt, ...) \
- _DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
-#define DRM_WARN(fmt, ...) \
- _DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
+ drm_printk(KERN_INFO, DRM_UT_NONE, DRM_NAME, fmt, ##__VA_ARGS__)
#define DRM_INFO_ONCE(fmt, ...) \
- _DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
+({ \
+ static bool __print_once __read_mostly; \
+ if (!__print_once) { \
+ __print_once = true; \
+ DRM_INFO(fmt, ##__VA_ARGS__); \
+ } \
+})
+
+#define DRM_NOTE(fmt, ...) \
+ drm_printk(KERN_NOTICE, DRM_UT_NONE, DRM_NAME, fmt, ##__VA_ARGS__)
+
#define DRM_NOTE_ONCE(fmt, ...) \
- _DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
+({ \
+ static bool __print_once __read_mostly; \
+ if (!__print_once) { \
+ __print_once = true; \
+ DRM_NOTE(fmt, ##__VA_ARGS__); \
+ } \
+})
+
+#define DRM_WARN(fmt, ...) \
+ drm_printk(KERN_WARNING, DRM_UT_NONE, DRM_NAME, fmt, ##__VA_ARGS__)
+
#define DRM_WARN_ONCE(fmt, ...) \
- _DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
+({ \
+ static bool __print_once __read_mostly; \
+ if (!__print_once) { \
+ __print_once = true; \
+ DRM_WARN(fmt, ##__VA_ARGS__); \
+ } \
+})
/**
* Error output.