14be47400SFrançois Tigeot /*
24be47400SFrançois Tigeot * Copyright (C) 2016 Red Hat
34be47400SFrançois Tigeot *
44be47400SFrançois Tigeot * Permission is hereby granted, free of charge, to any person obtaining a
54be47400SFrançois Tigeot * copy of this software and associated documentation files (the "Software"),
64be47400SFrançois Tigeot * to deal in the Software without restriction, including without limitation
74be47400SFrançois Tigeot * the rights to use, copy, modify, merge, publish, distribute, sublicense,
84be47400SFrançois Tigeot * and/or sell copies of the Software, and to permit persons to whom the
94be47400SFrançois Tigeot * Software is furnished to do so, subject to the following conditions:
104be47400SFrançois Tigeot *
114be47400SFrançois Tigeot * The above copyright notice and this permission notice shall be included in
124be47400SFrançois Tigeot * all copies or substantial portions of the Software.
134be47400SFrançois Tigeot *
144be47400SFrançois Tigeot * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
154be47400SFrançois Tigeot * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
164be47400SFrançois Tigeot * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
174be47400SFrançois Tigeot * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
184be47400SFrançois Tigeot * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
194be47400SFrançois Tigeot * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
204be47400SFrançois Tigeot * OTHER DEALINGS IN THE SOFTWARE.
214be47400SFrançois Tigeot *
224be47400SFrançois Tigeot * Authors:
234be47400SFrançois Tigeot * Rob Clark <robdclark@gmail.com>
244be47400SFrançois Tigeot */
254be47400SFrançois Tigeot
264be47400SFrançois Tigeot #include <linux/seq_file.h>
274be47400SFrançois Tigeot #include <drm/drmP.h>
284be47400SFrançois Tigeot #include <drm/drm_print.h>
294be47400SFrançois Tigeot
__drm_printfn_seq_file(struct drm_printer * p,struct va_format * vaf)304be47400SFrançois Tigeot void __drm_printfn_seq_file(struct drm_printer *p, struct va_format *vaf)
314be47400SFrançois Tigeot {
324be47400SFrançois Tigeot seq_printf(p->arg, "%pV", vaf);
334be47400SFrançois Tigeot }
344be47400SFrançois Tigeot EXPORT_SYMBOL(__drm_printfn_seq_file);
354be47400SFrançois Tigeot
__drm_printfn_info(struct drm_printer * p,struct va_format * vaf)364be47400SFrançois Tigeot void __drm_printfn_info(struct drm_printer *p, struct va_format *vaf)
374be47400SFrançois Tigeot {
38*a85cb24fSFrançois Tigeot dev_info(p->arg, "[" DRM_NAME "] %pV", vaf);
394be47400SFrançois Tigeot }
404be47400SFrançois Tigeot EXPORT_SYMBOL(__drm_printfn_info);
414be47400SFrançois Tigeot
__drm_printfn_debug(struct drm_printer * p,struct va_format * vaf)42*a85cb24fSFrançois Tigeot void __drm_printfn_debug(struct drm_printer *p, struct va_format *vaf)
43*a85cb24fSFrançois Tigeot {
44*a85cb24fSFrançois Tigeot pr_debug("%s %pV", p->prefix, vaf);
45*a85cb24fSFrançois Tigeot }
46*a85cb24fSFrançois Tigeot EXPORT_SYMBOL(__drm_printfn_debug);
47*a85cb24fSFrançois Tigeot
484be47400SFrançois Tigeot /**
494be47400SFrançois Tigeot * drm_printf - print to a &drm_printer stream
504be47400SFrançois Tigeot * @p: the &drm_printer
514be47400SFrançois Tigeot * @f: format string
524be47400SFrançois Tigeot */
drm_printf(struct drm_printer * p,const char * f,...)534be47400SFrançois Tigeot void drm_printf(struct drm_printer *p, const char *f, ...)
544be47400SFrançois Tigeot {
554be47400SFrançois Tigeot struct va_format vaf;
564be47400SFrançois Tigeot va_list args;
574be47400SFrançois Tigeot
584be47400SFrançois Tigeot va_start(args, f);
594be47400SFrançois Tigeot vaf.fmt = f;
604be47400SFrançois Tigeot vaf.va = &args;
614be47400SFrançois Tigeot p->printfn(p, &vaf);
624be47400SFrançois Tigeot va_end(args);
634be47400SFrançois Tigeot }
644be47400SFrançois Tigeot EXPORT_SYMBOL(drm_printf);
65