diff options
author | Jordan Crouse <jcrouse@codeaurora.org> | 2018-07-24 10:33:21 -0600 |
---|---|---|
committer | Rob Clark <robdclark@gmail.com> | 2018-07-30 08:49:35 -0400 |
commit | 63f4cc015b66dd265c2fd6e7c94be1b9a3b72267 (patch) | |
tree | cc66779ca5c9f64b0e35021e1d868d50052d6f5d /drivers/gpu/drm/drm_print.c | |
parent | cfc57a18a3c5dc95d06db80bddd30015162c57d2 (diff) | |
download | linux-63f4cc015b66dd265c2fd6e7c94be1b9a3b72267.tar.gz linux-63f4cc015b66dd265c2fd6e7c94be1b9a3b72267.tar.bz2 linux-63f4cc015b66dd265c2fd6e7c94be1b9a3b72267.zip |
drm: Add drm_puts() to complement drm_printf()
Add drm_puts() for a much faster path to print constant strings
into a drm_printer object with memcpy and friends. This can
have seconds off of really large outputs such as GPU dumps.
If the drm_printer object supports a custom puts function then
use that otherwise fall back to the slower legacy printf call.
v2: Add documentation for drm_puts() per Daniel Vetter
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
[robclark fix minor htmldocs warning]
Signed-off-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/drm_print.c')
-rw-r--r-- | drivers/gpu/drm/drm_print.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index 03d1f98e5ac7..01d4e5583b5d 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -123,6 +123,23 @@ void __drm_printfn_debug(struct drm_printer *p, struct va_format *vaf) EXPORT_SYMBOL(__drm_printfn_debug); /** + * drm_puts - print a const string to a &drm_printer stream + * @p: the &drm printer + * @str: const string + * + * Allow &drm_printer types that have a constant string + * option to use it. + */ +void drm_puts(struct drm_printer *p, const char *str) +{ + if (p->puts) + p->puts(p, str); + else + drm_printf(p, "%s", str); +} +EXPORT_SYMBOL(drm_puts); + +/** * drm_printf - print to a &drm_printer stream * @p: the &drm_printer * @f: format string |