Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm Rework drm print routines for...



details:   https://anonhg.NetBSD.org/src/rev/0b29a84fb09a
branches:  trunk
changeset: 1027890:0b29a84fb09a
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 01:07:52 2021 +0000

description:
Rework drm print routines for NetBSD.

diffstat:

 sys/external/bsd/drm2/dist/drm/drm_print.c |  46 ++++++++++++++++++++++++++++-
 1 files changed, 43 insertions(+), 3 deletions(-)

diffs (126 lines):

diff -r 220d6ae95505 -r 0b29a84fb09a sys/external/bsd/drm2/dist/drm/drm_print.c
--- a/sys/external/bsd/drm2/dist/drm/drm_print.c        Sun Dec 19 01:04:33 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_print.c        Sun Dec 19 01:07:52 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_print.c,v 1.3 2021/12/19 00:29:09 riastradh Exp $  */
+/*     $NetBSD: drm_print.c,v 1.4 2021/12/19 01:07:52 riastradh Exp $  */
 
 /*
  * Copyright (C) 2016 Red Hat
@@ -26,9 +26,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_print.c,v 1.3 2021/12/19 00:29:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_print.c,v 1.4 2021/12/19 01:07:52 riastradh Exp $");
 
+#ifndef __NetBSD__             /* XXX ??? */
 #define DEBUG /* for pr_debug() */
+#endif
 
 #ifdef __NetBSD__
 #include <sys/stdarg.h>
@@ -97,7 +99,7 @@
 
                len = min_t(ssize_t, strlen(str), iterator->remain);
 
-               memcpy(iterator->data + pos, str, len);
+               memcpy((char *)iterator->data + pos, str, len);
 
                iterator->offset += len;
                iterator->remain -= len;
@@ -151,17 +153,21 @@
 }
 EXPORT_SYMBOL(__drm_printfn_coredump);
 
+#ifndef __NetBSD__             /* XXX seq file */
 void __drm_puts_seq_file(struct drm_printer *p, const char *str)
 {
        seq_puts(p->arg, str);
 }
 EXPORT_SYMBOL(__drm_puts_seq_file);
+#endif
 
+#ifndef __NetBSD__             /* XXX seq file */
 void __drm_printfn_seq_file(struct drm_printer *p, struct va_format *vaf)
 {
        seq_printf(p->arg, "%pV", vaf);
 }
 EXPORT_SYMBOL(__drm_printfn_seq_file);
+#endif
 
 void __drm_printfn_info(struct drm_printer *p, struct va_format *vaf)
 {
@@ -247,6 +253,15 @@
 void drm_dev_printk(const struct device *dev, const char *level,
                    const char *format, ...)
 {
+#ifdef __NetBSD__
+       va_list va;
+
+       va_start(va, format);
+       if (dev)
+               printf("%s: ", device_xname(__UNCONST(dev)));
+       vprintf(format, va);
+       va_end(va);
+#else
        struct va_format vaf;
        va_list args;
 
@@ -262,12 +277,25 @@
                       level, __builtin_return_address(0), &vaf);
 
        va_end(args);
+#endif
 }
 EXPORT_SYMBOL(drm_dev_printk);
 
 void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                 const char *format, ...)
 {
+#ifdef __NetBSD__
+       va_list va;
+
+       if (!(drm_debug & category))
+               return;
+
+       va_start(va, format);
+       if (dev)
+               printf("%s: ", device_xname(__UNCONST(dev)));
+       vprintf(format, va);
+       va_end(va);
+#else
        struct va_format vaf;
        va_list args;
 
@@ -286,11 +314,22 @@
                       __builtin_return_address(0), &vaf);
 
        va_end(args);
+#endif
 }
 EXPORT_SYMBOL(drm_dev_dbg);
 
 void __drm_dbg(enum drm_debug_category category, const char *format, ...)
 {
+#ifdef __NetBSD__
+       va_list va;
+
+       if (!(drm_debug & category))
+               return;
+
+       va_start(va, format);
+       vprintf(format, va);
+       va_end(va);
+#else
        struct va_format vaf;
        va_list args;
 
@@ -305,6 +344,7 @@
               __builtin_return_address(0), &vaf);
 
        va_end(args);
+#endif
 }
 EXPORT_SYMBOL(__drm_dbg);
 



Home | Main Index | Thread Index | Old Index