Hi,

On Thu Sep 24, 2026 at 2:01 PM CEST, Krzysztof Karas wrote:
> Add i915_* family of printer macros, following existing example
> of gt_* and xe_* prints.
>
> Suggested-by: Andi Shyti <[email protected]>
> Signed-off-by: Krzysztof Karas <[email protected]>
> ---
>  drivers/gpu/drm/i915/i915_printk.h | 53 ++++++++++++++++++++++++++++++
>  1 file changed, 53 insertions(+)
>  create mode 100644 drivers/gpu/drm/i915/i915_printk.h
>
> diff --git a/drivers/gpu/drm/i915/i915_printk.h 
> b/drivers/gpu/drm/i915/i915_printk.h
> new file mode 100644
> index 000000000000..5bbbe604cae8
> --- /dev/null
> +++ b/drivers/gpu/drm/i915/i915_printk.h
> @@ -0,0 +1,53 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2026 Intel Corporation
> + */
> +
> +#ifndef _I915_PRINTK_H_
> +#define _I915_PRINTK_H_
> +
> +#include <drm/drm_print.h>
> +
> +#define i915_printk(_i915, _level, _fmt, ...) \
> +     drm_##_level(&(_i915)->drm, _fmt, ## __VA_ARGS__)
> +
> +#define i915_err(_i915, _fmt, ...) \
> +     i915_printk((_i915), err, _fmt, ##__VA_ARGS__)
> +
> +#define i915_err_once(_i915, _fmt, ...) \
> +     i915_printk((_i915), err_once, _fmt, ##__VA_ARGS__)
> +
> +#define i915_err_ratelimited(_i915, _fmt, ...) \
> +     i915_printk((_i915), err_ratelimited, _fmt, ##__VA_ARGS__)
> +
> +#define i915_warn(_i915, _fmt, ...) \
> +     i915_printk((_i915), warn, _fmt, ##__VA_ARGS__)
> +
> +#define i915_notice(_i915, _fmt, ...) \
> +     i915_printk((_i915), notice, _fmt, ##__VA_ARGS__)
> +
> +#define i915_info(_i915, _fmt, ...) \
> +     i915_printk((_i915), info, _fmt, ##__VA_ARGS__)
> +
> +#define i915_dbg(_i915, _fmt, ...) \
> +     i915_printk((_i915), dbg, _fmt, ##__VA_ARGS__)
> +
> +#define i915_dbg_ratelimited(_i915, _fmt, ...) \
> +     i915_printk((_i915), dbg_ratelimited, _fmt, ##__VA_ARGS__)
> +
> +#define i915_WARN_type(_i915, _type, _condition, _fmt, ...) \
> +     drm_WARN##_type(&(_i915)->drm, _condition, _fmt, ## __VA_ARGS__)
> +
> +#define i915_WARN(_i915, _condition, _fmt, ...) \
> +     i915_WARN_type((_i915), _condition, __I915_PRINTK_FMT((_i915), _fmt, ## 
> __VA_ARGS__))
> +
> +#define i915_WARN_ONCE(_i915, _condition, _fmt, ...) \
> +     i915_WARN_type((_i915), _ONCE, _condition, __I915_PRINTK_FMT((_i915), 
> _fmt, ## __VA_ARGS__))
> +
> +#define i915_WARN_ON(_i915, _condition) \
> +     i915_WARN((_i915), _condition, "%s(%s)", "WARN_ON", 
> __stringify(_condition))
> +
> +#define i915_WARN_ON_ONCE(_i915, _condition) \
> +     i915_WARN_ONCE((_i915), _condition, "%s(%s)", "WARN_ON_ONCE", 
> __stringify(_condition))

There is something wrong with the WARN macros. I noticed that they aren't
used anywhere in the series, so the compiler never expands them. I added
one to a file just to test it.
diff --git a/drivers/gpu/drm/i915/selftests/i915_selftest.c 
b/drivers/gpu/drm/i915/selftests/i915_selftest.c
index 4e2566189879..7446c265813a 100644
--- a/drivers/gpu/drm/i915/selftests/i915_selftest.c
+++ b/drivers/gpu/drm/i915/selftests/i915_selftest.c
@@ -50,6 +50,7 @@ int i915_mock_sanitycheck(void)
 int i915_live_sanitycheck(struct drm_i915_private *i915)
 {
        i915_info(i915, "%s() - ok!\n", __func__);
+       i915_WARN_ON(i915, false);
        return 0;
 }


This is what I get when compiled:
vers/gpu/drm/i915/selftests/i915_selftest.c: In function 
'i915_live_sanitycheck':
drivers/gpu/drm/i915/selftests/i915_selftest.c:53:33: error: macro 
"i915_WARN_type" requires 5 arguments, but only 3 given
   53 |         i915_WARN_ON(i915, false); /* TEMP: reviewer repro, will be 
reverted */
      |                                 ^
In file included from drivers/gpu/drm/i915/selftests/i915_selftest.c:26:
./drivers/gpu/drm/i915/i915_printk.h:38:9: note: macro "i915_WARN_type" defined 
here
   38 | #define i915_WARN_type(_i915, _type, _condition, _fmt, ...) \
      |         ^~~~~~~~~~~~~~
./drivers/gpu/drm/i915/i915_printk.h:42:9: error: 'i915_WARN_type' undeclared 
(first use in this function); did you mean 'i915_map_type'?
   42 |         i915_WARN_type((_i915), _condition, __I915_PRINTK_FMT((_i915), 
_fmt, ## __VA_ARGS__))
      |         ^~~~~~~~~~~~~~
./drivers/gpu/drm/i915/i915_printk.h:48:9: note: in expansion of macro 
'i915_WARN'
   48 |         i915_WARN((_i915), _condition, "%s(%s)", "WARN_ON", 
__stringify(_condition))
      |         ^~~~~~~~~
drivers/gpu/drm/i915/selftests/i915_selftest.c:53:9: note: in expansion of 
macro 'i915_WARN_ON'
   53 |         i915_WARN_ON(i915, false); /* TEMP: reviewer repro, will be 
reverted */
      |         ^~~~~~~~~~~~
./drivers/gpu/drm/i915/i915_printk.h:42:9: note: each undeclared identifier is 
reported only once for each function it appears in
   42 |         i915_WARN_type((_i915), _condition, __I915_PRINTK_FMT((_i915), 
_fmt, ## __VA_ARGS__))
      |         ^~~~~~~~~~~~~~
./drivers/gpu/drm/i915/i915_printk.h:48:9: note: in expansion of macro 
'i915_WARN'
   48 |         i915_WARN((_i915), _condition, "%s(%s)", "WARN_ON", 
__stringify(_condition))
      |         ^~~~~~~~~
drivers/gpu/drm/i915/selftests/i915_selftest.c:53:9: note: in expansion of 
macro 'i915_WARN_ON'
   53 |         i915_WARN_ON(i915, false); /* TEMP: reviewer repro, will be 
reverted */
      |         ^~~~~~~~~~~~
  CC [M]  drivers/gpu/drm/i915/gvt/cmd_parser.o
make[6]: *** [scripts/Makefile.build:290: 
drivers/gpu/drm/i915/selftests/i915_selftest.o] Error 1


-- 
Best regards,
Sebastian

Reply via email to