[PATCH v1 6/8] drm/print: add drm_dev_* logging functions
Joe Perches
joe at perches.com
Sat Dec 21 13:56:17 UTC 2019
On Sat, 2019-12-21 at 10:55 +0100, Sam Ravnborg wrote:
> There are a lot of cases where we have a device * but no drm_device *.
> Add drm_dev_* variants of the logging functions to cover these cases.
[]
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
[]
> @@ -468,6 +511,60 @@ static inline bool drm_debug_enabled(enum drm_debug_category category)
> #define drm_dbg_dp(drm, fmt, ...) \
> __drm_cat_printk((drm), DRM_UT_DP, fmt, ##__VA_ARGS__)
>
> +/* struct device based logging. */
> +#define __drm_dev_printk(dev, level, type, fmt, ...) \
> + dev_##level##type(dev, "[drm] " fmt, ##__VA_ARGS__)
> +
> +#define __drm_dev_cat_printk(dev, cat, type, fmt, ...) \
> +({ \
> + if (drm_debug_enabled(cat)) \
> + dev_dbg##type((dev), "[drm] " fmt, ##__VA_ARGS__); \
trivia: The parentheses around dev aren't necessary.
> +})
> +
> +#define drm_dev_info(dev, fmt, ...) \
> + __drm_dev_printk((dev), info,, fmt, ##__VA_ARGS__)
etc...
More information about the dri-devel
mailing list