[Intel-gfx] [PATCH v3 1/3] drm/print: Add drm_debug_once* macros
Souza, Jose
jose.souza at intel.com
Tue May 10 19:22:40 UTC 2022
On Tue, 2022-05-10 at 21:33 +0300, Jouni Högander wrote:
> Add drm_debug_once* macros to allow printing out one time debug
> messages which can be still controlled via drm.debug parameter.
Reviewed-by: José Roberto de Souza <jose.souza at intel.com>
>
> Cc: José Roberto de Souza <jose.souza at intel.com>
> Cc: Mika Kahola <mika.kahola at intel.com>
> Cc: Mark Pearson <markpearson at lenovo.com>
> Signed-off-by: Jouni Högander <jouni.hogander at intel.com>
> ---
> include/drm/drm_print.h | 29 +++++++++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
>
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index 22fabdeed297..e339f47eeb6d 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -476,6 +476,35 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
> #define drm_dbg_drmres(drm, fmt, ...) \
> drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DRMRES, fmt, ##__VA_ARGS__)
>
> +#define drm_dev_dbg_once(dev, cat, fmt, ...) \
> +({ \
> + static bool __print_once __read_mostly; \
> + if (!__print_once) { \
> + __print_once = true; \
> + drm_dev_dbg(dev, cat, fmt, ##__VA_ARGS__); \
> + } \
> +})
> +
> +#define drm_dbg_once_core(drm, fmt, ...) \
> + drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_CORE, fmt, ##__VA_ARGS__)
> +#define drm_dbg_once(drm, fmt, ...) \
> + drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
> +#define drm_dbg_once_kms(drm, fmt, ...) \
> + drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_KMS, fmt, ##__VA_ARGS__)
> +#define drm_dbg_once_prime(drm, fmt, ...) \
> + drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
> +#define drm_dbg_once_atomic(drm, fmt, ...) \
> + drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
> +#define drm_dbg_once_vbl(drm, fmt, ...) \
> + drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_VBL, fmt, ##__VA_ARGS__)
> +#define drm_dbg_once_state(drm, fmt, ...) \
> + drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_STATE, fmt, ##__VA_ARGS__)
> +#define drm_dbg_once_lease(drm, fmt, ...) \
> + drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_LEASE, fmt, ##__VA_ARGS__)
> +#define drm_dbg_once_dp(drm, fmt, ...) \
> + drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_DP, fmt, ##__VA_ARGS__)
> +#define drm_dbg_once_drmres(drm, fmt, ...) \
> + drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_DRMRES, fmt, ##__VA_ARGS__)
>
> /*
> * printk based logging
More information about the Intel-gfx
mailing list