[PATCH v2 3/4] drm/print: Add drm_printer_is_full
Cavitt, Jonathan
jonathan.cavitt at intel.com
Thu Apr 3 21:28:54 UTC 2025
-----Original Message-----
From: Intel-xe <intel-xe-bounces at lists.freedesktop.org> On Behalf Of Matthew Brost
Sent: Thursday, April 3, 2025 1:27 PM
To: intel-xe at lists.freedesktop.org
Cc: dri-devel at lists.freedesktop.org
Subject: [PATCH v2 3/4] drm/print: Add drm_printer_is_full
>
> Add drm_printer_is_full which indicates if a drm printer's output is
> full. Useful to short circuit coredump printing once printer's output is
> full.
>
> Signed-off-by: Matthew Brost <matthew.brost at intel.com>
LGTM, though I will admit that "remain" is a bit of a strange name for the
iterator variable. I'd almost imagine "remain" to refer to the "remaining
output the iterator needs to print", rather than the "remaining space in
the output buffer of the iterator".
But that's just an aside. Nothing worth blocking on.
Reviewed-by: Jonathan Cavitt <jonathan.cavitt at intel.com>
-Jonathan Cavitt
> ---
> include/drm/drm_print.h | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index f31eba1c7cab..db7517ee1b19 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -242,6 +242,23 @@ struct drm_print_iterator {
> ssize_t offset;
> };
>
> +/**
> + * drm_printer_is_full() - DRM printer output is full
> + * @p: DRM printer
> + *
> + * DRM printer output is full, useful to short circuit coredump printing once
> + * printer is full.
> + *
> + * RETURNS:
> + * True if DRM printer output buffer is full, False otherwise
> + */
> +static inline bool drm_printer_is_full(struct drm_printer *p)
> +{
> + struct drm_print_iterator *iterator = p->arg;
> +
> + return !iterator->remain;
> +}
> +
> /**
> * drm_coredump_printer - construct a &drm_printer that can output to a buffer
> * from the read function for devcoredump
> --
> 2.34.1
>
>
More information about the Intel-xe
mailing list