diff options
author | Matthew Brost <matthew.brost@intel.com> | 2025-04-23 10:17:24 -0700 |
---|---|---|
committer | Matthew Brost <matthew.brost@intel.com> | 2025-04-24 15:51:41 -0700 |
commit | fa4b8b3e3a11765a42066f23db7100c09a661c25 (patch) | |
tree | 355c35f6aa1acce6bcf0f756a360e608d0d60bb7 | |
parent | 270172f64b114451876c1b68912653e72ab99f38 (diff) |
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 <matthew.brost@intel.com>
Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
Link: https://lore.kernel.org/r/20250423171725.597955-4-matthew.brost@intel.com
-rw-r--r-- | include/drm/drm_print.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index f31eba1c7cab..ab017b05e175 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -345,6 +345,26 @@ drm_coredump_printer(struct drm_print_iterator *iter) } /** + * drm_coredump_printer_is_full() - DRM coredump printer output is full + * @p: DRM coredump printer + * + * DRM printer output is full, useful to short circuit coredump printing once + * printer is full. + * + * RETURNS: + * True if DRM coredump printer output buffer is full, False otherwise + */ +static inline bool drm_coredump_printer_is_full(struct drm_printer *p) +{ + struct drm_print_iterator *iterator = p->arg; + + if (p->printfn != __drm_printfn_coredump) + return true; + + return !iterator->remain; +} + +/** * drm_seq_file_printer - construct a &drm_printer that outputs to &seq_file * @f: the &struct seq_file to output to * |