diff options
| author | Rob Clark <robdclark@gmail.com> | 2013-11-21 14:29:51 -0500 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2013-12-17 19:43:49 -0500 |
| commit | 5d13d425eb58d28c8be6dc8bf706ca361373c3ba (patch) | |
| tree | 409cba74ae5a5b67e807fe1f163e50f6a27b0d61 /include/drm | |
| parent | ce456e039613b384234de4d1faf0332b513cc1e4 (diff) | |
drm: add DRM_ERROR_RATELIMITED
For error traces in situations that can run away, it is nice to have a
rate-limited version of DRM_ERROR() to avoid massive log flooding.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'include/drm')
| -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 | ||
