Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>,
	intel-xe@lists.freedesktop.org
Subject: Re: [Intel-xe] [PATCH] drm/xe: Accept a const xe device
Date: Fri, 22 Sep 2023 20:06:26 +0200	[thread overview]
Message-ID: <db333141-3d06-69a0-5fc0-2386f2caeb20@intel.com> (raw)
In-Reply-To: <20230922174320.2372617-1-lucas.demarchi@intel.com>



On 22.09.2023 19:43, Lucas De Marchi wrote:
> Depending on the context, it's preferred to have a const pointer to make
> sure nothing is modified underneath. The assert macros only ever read
> data from xe/tile/gt for printing, so they can be made const by default.
> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>

Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>

> ---
>  drivers/gpu/drm/xe/xe_assert.h | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_assert.h b/drivers/gpu/drm/xe/xe_assert.h
> index 4cbe1b213432..035e6a44afe6 100644
> --- a/drivers/gpu/drm/xe/xe_assert.h
> +++ b/drivers/gpu/drm/xe/xe_assert.h
> @@ -86,7 +86,7 @@
>  })
>  #else
>  #define __xe_assert_msg(xe, condition, msg, arg...) ({						\
> -	typecheck(struct xe_device *, xe);							\
> +	typecheck(const struct xe_device *, xe);						\
>  	BUILD_BUG_ON_INVALID(condition);							\
>  })
>  #endif
> @@ -107,7 +107,7 @@
>   */
>  #define xe_assert(xe, condition) xe_assert_msg((xe), condition, "")
>  #define xe_assert_msg(xe, condition, msg, arg...) ({						\
> -	struct xe_device *__xe = (xe);								\
> +	const struct xe_device *__xe = (xe);							\
>  	__xe_assert_msg(__xe, condition,							\
>  			"platform: %d subplatform: %d\n"					\
>  			"graphics: %s %u.%02u step %s\n"					\
> @@ -145,7 +145,7 @@
>   */
>  #define xe_tile_assert(tile, condition) xe_tile_assert_msg((tile), condition, "")
>  #define xe_tile_assert_msg(tile, condition, msg, arg...) ({					\
> -	struct xe_tile *__tile = (tile);							\
> +	const struct xe_tile *__tile = (tile);							\
>  	char __buf[10] __maybe_unused;								\
>  	xe_assert_msg(tile_to_xe(__tile), condition, "tile: %u VRAM %s\n" msg,			\
>  		      __tile->id, ({ string_get_size(__tile->mem.vram.actual_physical_size, 1,	\
> @@ -169,7 +169,7 @@
>   */
>  #define xe_gt_assert(gt, condition) xe_gt_assert_msg((gt), condition, "")
>  #define xe_gt_assert_msg(gt, condition, msg, arg...) ({						\
> -	struct xe_gt *__gt = (gt);								\
> +	const struct xe_gt *__gt = (gt);							\
>  	xe_tile_assert_msg(gt_to_tile(__gt), condition, "GT: %u type %d\n" msg,			\
>  			   __gt->info.id, __gt->info.type, ## arg);				\
>  })

  reply	other threads:[~2023-09-22 18:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-22 17:43 [Intel-xe] [PATCH] drm/xe: Accept a const xe device Lucas De Marchi
2023-09-22 18:06 ` Michal Wajdeczko [this message]
2023-09-22 18:43 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
2023-09-22 18:43 ` [Intel-xe] ✓ CI.checkpatch: " Patchwork
2023-09-22 18:45 ` [Intel-xe] ✓ CI.KUnit: " Patchwork
2023-09-22 18:52 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-09-22 18:52 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-09-22 18:53 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-09-22 19:27 ` [Intel-xe] ✓ CI.BAT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=db333141-3d06-69a0-5fc0-2386f2caeb20@intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox