提交 dc1a73e5 编写于 作者: P Pankaj Bharadiya 提交者: Jani Nikula

drm/print: introduce new struct drm_device based WARN* macros

Add new struct drm_device based WARN* macros. These are modeled after
the core kernel device based WARN* macros. These would be preferred
over the regular WARN* macros, where possible.

These macros include device information in the backtrace, so we know
what device the warnings originate from.

Knowing the device specific information in the backtrace would be
helpful in development all around.
Signed-off-by: NPankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Reviewed-by: NJani Nikula <jani.nikula@intel.com>
Reviewed-by: NSam Ravnborg <sam@ravnborg.org>
Acked-by: NMaxime Ripard <mripard@kernel.org>
Acked-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: NSean Paul <sean@poorly.run>
Signed-off-by: NJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200115034455.17658-2-pankaj.laxminarayan.bharadiya@intel.com
上级 3cacb208
...@@ -553,4 +553,33 @@ void __drm_err(const char *format, ...); ...@@ -553,4 +553,33 @@ void __drm_err(const char *format, ...);
#define DRM_DEBUG_PRIME_RATELIMITED(fmt, ...) \ #define DRM_DEBUG_PRIME_RATELIMITED(fmt, ...) \
DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##__VA_ARGS__) DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
/*
* struct drm_device based WARNs
*
* drm_WARN*() acts like WARN*(), but with the key difference of
* using device specific information so that we know from which device
* warning is originating from.
*
* Prefer drm_device based drm_WARN* over regular WARN*
*/
/* Helper for struct drm_device based WARNs */
#define drm_WARN(drm, condition, format, arg...) \
WARN(condition, "%s %s: " format, \
dev_driver_string((drm)->dev), \
dev_name((drm)->dev), ## arg)
#define drm_WARN_ONCE(drm, condition, format, arg...) \
WARN_ONCE(condition, "%s %s: " format, \
dev_driver_string((drm)->dev), \
dev_name((drm)->dev), ## arg)
#define drm_WARN_ON(drm, x) \
drm_WARN((drm), (x), "%s", \
"drm_WARN_ON(" __stringify(x) ")")
#define drm_WARN_ON_ONCE(drm, x) \
drm_WARN_ONCE((drm), (x), "%s", \
"drm_WARN_ON_ONCE(" __stringify(x) ")")
#endif /* DRM_PRINT_H_ */ #endif /* DRM_PRINT_H_ */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册