diff options
-rw-r--r-- | include/drm/drmP.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 1d4a920ef7ff..bc07c7af0f6e 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -56,6 +56,7 @@ | |||
56 | #include <linux/mutex.h> | 56 | #include <linux/mutex.h> |
57 | #include <linux/io.h> | 57 | #include <linux/io.h> |
58 | #include <linux/slab.h> | 58 | #include <linux/slab.h> |
59 | #include <linux/ratelimit.h> | ||
59 | #if defined(__alpha__) || defined(__powerpc__) | 60 | #if defined(__alpha__) || defined(__powerpc__) |
60 | #include <asm/pgtable.h> /* For pte_wrprotect */ | 61 | #include <asm/pgtable.h> /* For pte_wrprotect */ |
61 | #endif | 62 | #endif |
@@ -180,6 +181,22 @@ int drm_err(const char *func, const char *format, ...); | |||
180 | #define DRM_ERROR(fmt, ...) \ | 181 | #define DRM_ERROR(fmt, ...) \ |
181 | drm_err(__func__, fmt, ##__VA_ARGS__) | 182 | drm_err(__func__, fmt, ##__VA_ARGS__) |
182 | 183 | ||
184 | /** | ||
185 | * Rate limited error output. Like DRM_ERROR() but won't flood the log. | ||
186 | * | ||
187 | * \param fmt printf() like format string. | ||
188 | * \param arg arguments | ||
189 | */ | ||
190 | #define DRM_ERROR_RATELIMITED(fmt, ...) \ | ||
191 | ({ \ | ||
192 | static DEFINE_RATELIMIT_STATE(_rs, \ | ||
193 | DEFAULT_RATELIMIT_INTERVAL, \ | ||
194 | DEFAULT_RATELIMIT_BURST); \ | ||
195 | \ | ||
196 | if (__ratelimit(&_rs)) \ | ||
197 | drm_err(__func__, fmt, ##__VA_ARGS__); \ | ||
198 | }) | ||
199 | |||
183 | #define DRM_INFO(fmt, ...) \ | 200 | #define DRM_INFO(fmt, ...) \ |
184 | printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__) | 201 | printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__) |
185 | 202 | ||