mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-24 17:59:32 +00:00
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>
This commit is contained in:
parent
ce456e0396
commit
5d13d425eb
1 changed files with 17 additions and 0 deletions
|
@ -56,6 +56,7 @@
|
|||
#include <linux/mutex.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/ratelimit.h>
|
||||
#if defined(__alpha__) || defined(__powerpc__)
|
||||
#include <asm/pgtable.h> /* For pte_wrprotect */
|
||||
#endif
|
||||
|
@ -180,6 +181,22 @@ int drm_err(const char *func, const char *format, ...);
|
|||
#define DRM_ERROR(fmt, ...) \
|
||||
drm_err(__func__, fmt, ##__VA_ARGS__)
|
||||
|
||||
/**
|
||||
* Rate limited error output. Like DRM_ERROR() but won't flood the log.
|
||||
*
|
||||
* \param fmt printf() like format string.
|
||||
* \param arg arguments
|
||||
*/
|
||||
#define DRM_ERROR_RATELIMITED(fmt, ...) \
|
||||
({ \
|
||||
static DEFINE_RATELIMIT_STATE(_rs, \
|
||||
DEFAULT_RATELIMIT_INTERVAL, \
|
||||
DEFAULT_RATELIMIT_BURST); \
|
||||
\
|
||||
if (__ratelimit(&_rs)) \
|
||||
drm_err(__func__, fmt, ##__VA_ARGS__); \
|
||||
})
|
||||
|
||||
#define DRM_INFO(fmt, ...) \
|
||||
printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
|
||||
|
||||
|
|
Loading…
Reference in a new issue