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...


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to