Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>,
	dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Subject: Re: [PATCH 2/3] drm/print: Improve drm_dbg_printer
Date: Fri, 17 May 2024 16:35:12 +0300	[thread overview]
Message-ID: <87pltka7e7.fsf@intel.com> (raw)
In-Reply-To: <20240517125730.2304-3-michal.wajdeczko@intel.com>

On Fri, 17 May 2024, Michal Wajdeczko <michal.wajdeczko@intel.com> wrote:
> With recent introduction of a generic drm dev printk function, we
> can now store and use location where drm_dbg_printer was invoked
> and output it's symbolic name like we do for all drm debug prints.
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/drm_print.c | 3 +--
>  include/drm/drm_print.h     | 2 ++
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
> index a2b60c8245a1..0a205fdee7cf 100644
> --- a/drivers/gpu/drm/drm_print.c
> +++ b/drivers/gpu/drm/drm_print.c
> @@ -191,8 +191,7 @@ void __drm_printfn_dbg(struct drm_printer *p, struct va_format *vaf)
>  	if (!__drm_debug_enabled(category))
>  		return;
>  
> -	/* Note: __builtin_return_address(0) is useless here. */
> -	__drm_dev_vprintk(dev, KERN_DEBUG, NULL, p->prefix, vaf);
> +	__drm_dev_vprintk(dev, KERN_DEBUG, p->origin, p->prefix, vaf);
>  }
>  EXPORT_SYMBOL(__drm_printfn_dbg);
>  
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index bb1801c58544..761ce01761b7 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -175,6 +175,7 @@ struct drm_printer {
>  	void (*printfn)(struct drm_printer *p, struct va_format *vaf);
>  	void (*puts)(struct drm_printer *p, const char *str);
>  	void *arg;
> +	const void *origin;
>  	const char *prefix;
>  	enum drm_debug_category category;
>  };
> @@ -332,6 +333,7 @@ static inline struct drm_printer drm_dbg_printer(struct drm_device *drm,
>  	struct drm_printer p = {
>  		.printfn = __drm_printfn_dbg,
>  		.arg = drm,
> +		.origin = (void *)_THIS_IP_, /* it's fine as we will be inlined */

Not that it makes a difference, but I guess I'd cast to (const void *)
to match the member.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>


>  		.prefix = prefix,
>  		.category = category,
>  	};

-- 
Jani Nikula, Intel

  reply	other threads:[~2024-05-17 13:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-17 12:57 [PATCH 0/3] Improve drm printer code Michal Wajdeczko
2024-05-17 12:57 ` [PATCH 1/3] drm/print: Add generic drm dev printk function Michal Wajdeczko
2024-05-17 13:33   ` Jani Nikula
2024-05-17 15:42     ` Michal Wajdeczko
2024-05-17 12:57 ` [PATCH 2/3] drm/print: Improve drm_dbg_printer Michal Wajdeczko
2024-05-17 13:35   ` Jani Nikula [this message]
2024-05-17 12:57 ` [PATCH 3/3] drm/i915: Don't use __func__ as prefix for drm_dbg_printer Michal Wajdeczko
2024-05-17 13:35   ` Jani Nikula
2024-05-17 14:12 ` ✗ Fi.CI.CHECKPATCH: warning for Improve drm printer code Patchwork
2024-05-17 14:12 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-05-17 14:28 ` ✓ Fi.CI.BAT: success " 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=87pltka7e7.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=michal.wajdeczko@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