From f0a8f533adc202f7dc83961c85187794eaed9cec Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Tue, 1 Oct 2019 17:06:14 +0300 Subject: drm/print: add drm_debug_enabled() Add helper to check if a drm debug category is enabled. Convert drm core to use it. No functional changes. v2: Move unlikely() to drm_debug_enabled() (Eric) v3: Keep unlikely() when combined with other conditions (Eric) Cc: Eric Engestrom Acked-by: Alex Deucher Reviewed-by: Eric Engestrom Signed-off-by: Jani Nikula Link: https://patchwork.freedesktop.org/patch/msgid/20191001140614.26909-1-jani.nikula@intel.com --- include/drm/drm_print.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/drm/drm_print.h') diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index fc9f218ab715..5b8049992c24 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -293,6 +293,11 @@ static inline struct drm_printer drm_err_printer(const char *prefix) #define DRM_UT_LEASE 0x80 #define DRM_UT_DP 0x100 +static inline bool drm_debug_enabled(unsigned int category) +{ + return unlikely(drm_debug & category); +} + __printf(3, 4) void drm_dev_printk(const struct device *dev, const char *level, const char *format, ...); -- cgit v1.2.3