Skip to content

Commit fa4b8b3

Browse files
committed
drm/print: Add drm_coredump_printer_is_full
Add drm_coredump_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. v2: - s/drm_printer_is_full/drm_coredump_printer_is_full (Jani) v3: - Bail if not a coredump printer (Michal) Signed-off-by: Matthew Brost <[email protected]> Reviewed-by: Jonathan Cavitt <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 270172f commit fa4b8b3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

include/drm/drm_print.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,26 @@ drm_coredump_printer(struct drm_print_iterator *iter)
344344
return p;
345345
}
346346

347+
/**
348+
* drm_coredump_printer_is_full() - DRM coredump printer output is full
349+
* @p: DRM coredump printer
350+
*
351+
* DRM printer output is full, useful to short circuit coredump printing once
352+
* printer is full.
353+
*
354+
* RETURNS:
355+
* True if DRM coredump printer output buffer is full, False otherwise
356+
*/
357+
static inline bool drm_coredump_printer_is_full(struct drm_printer *p)
358+
{
359+
struct drm_print_iterator *iterator = p->arg;
360+
361+
if (p->printfn != __drm_printfn_coredump)
362+
return true;
363+
364+
return !iterator->remain;
365+
}
366+
347367
/**
348368
* drm_seq_file_printer - construct a &drm_printer that outputs to &seq_file
349369
* @f: the &struct seq_file to output to

0 commit comments

Comments
 (0)