Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Collect `#ifdef AGP_DEBUG printf(...)' into loca...



details:   https://anonhg.NetBSD.org/src/rev/88c5f550f057
branches:  trunk
changeset: 330183:88c5f550f057
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Jun 27 22:27:16 2014 +0000

description:
Collect `#ifdef AGP_DEBUG printf(...)' into local DPRINTF macro.

diffstat:

 sys/dev/pci/agp_i810.c |  31 ++++++++++++++-----------------
 1 files changed, 14 insertions(+), 17 deletions(-)

diffs (80 lines):

diff -r 8d01b9a1da16 -r 88c5f550f057 sys/dev/pci/agp_i810.c
--- a/sys/dev/pci/agp_i810.c    Fri Jun 27 19:55:20 2014 +0000
+++ b/sys/dev/pci/agp_i810.c    Fri Jun 27 22:27:16 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: agp_i810.c,v 1.105 2014/06/25 15:04:53 riastradh Exp $ */
+/*     $NetBSD: agp_i810.c,v 1.106 2014/06/27 22:27:16 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.105 2014/06/25 15:04:53 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.106 2014/06/27 22:27:16 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -54,6 +54,13 @@
 
 #include "agp_intel.h"
 
+#ifdef AGP_DEBUG
+#define        DPRINTF(sc, fmt, ...)                                                 \
+       device_printf((sc)->as_dev, "%s: " fmt, __func__, ##__VA_ARGS__)
+#else
+#define        DPRINTF(sc, fmt, ...)   do {} while (0)
+#endif
+
 struct agp_softc *agp_i810_sc = NULL;
 
 #define READ1(off)     bus_space_read_1(isc->bst, isc->bsh, off)
@@ -1092,21 +1099,16 @@
        struct agp_i810_softc *isc = sc->as_chipc;
 
        if (offset < 0 || offset >= ((isc->gtt_size/4) << AGP_PAGE_SHIFT)) {
-#ifdef AGP_DEBUG
-               printf("%s: failed"
+               DPRINTF(sc, "failed"
                    ": offset 0x%08x, shift %d, entries %"PRIuMAX"\n",
-                   device_xname(sc->as_dev), (int)offset, AGP_PAGE_SHIFT,
+                   (int)offset, AGP_PAGE_SHIFT,
                    (uintmax_t)isc->gtt_size/4);
-#endif
                return EINVAL;
        }
 
        if (isc->chiptype != CHIP_I810) {
                if ((offset >> AGP_PAGE_SHIFT) < isc->stolen) {
-#ifdef AGP_DEBUG
-                       printf("%s: trying to bind into stolen memory\n",
-                           device_xname(sc->as_dev));
-#endif
+                       DPRINTF(sc, "trying to bind into stolen memory\n");
                        return EINVAL;
                }
        }
@@ -1124,10 +1126,7 @@
 
        if (isc->chiptype != CHIP_I810 ) {
                if ((offset >> AGP_PAGE_SHIFT) < isc->stolen) {
-#ifdef AGP_DEBUG
-                       printf("%s: trying to unbind from stolen memory\n",
-                           device_xname(sc->as_dev));
-#endif
+                       DPRINTF(sc, "trying to unbind from stolen memory\n");
                        return EINVAL;
                }
        }
@@ -1161,9 +1160,7 @@
        struct agp_memory *mem;
        int error;
 
-#ifdef AGP_DEBUG
-       printf("AGP: alloc(%d, 0x%x)\n", type, (int) size);
-#endif
+       DPRINTF(sc, "AGP: alloc(%d, 0x%x)\n", type, (int)size);
 
        if (size <= 0)
                return NULL;



Home | Main Index | Thread Index | Old Index