Author: adrian
Date: Mon May 16 20:22:52 2016
New Revision: 299975
URL: https://svnweb.freebsd.org/changeset/base/299975

Log:
  [siba] fix up debugging.
  
  * unbreak non-debug builds - don't default to debugging SCAN; that was
    left-over from my testing.
  * include opt_siba.h, now that it's generated as appropriate.
  * stick the debug enum outside the debug block, just so it's there for
    any code that wants to set siba_debug for some reason (like say,
    my debugging muckup.)
  * make DPRINTF() use __VA_ARGS__ for formatting too, so it correctly
    handles printing w/ no args.
  * Make DPRINTF() use device_printf().
  
  Sponsored by: Palm Springs

Modified:
  head/sys/dev/siba/siba_core.c

Modified: head/sys/dev/siba/siba_core.c
==============================================================================
--- head/sys/dev/siba/siba_core.c       Mon May 16 20:18:54 2016        
(r299974)
+++ head/sys/dev/siba/siba_core.c       Mon May 16 20:22:52 2016        
(r299975)
@@ -34,6 +34,8 @@ __FBSDID("$FreeBSD$");
  * the Sonics Silicon Backplane driver.
  */
 
+#include "opt_siba.h"
+
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/malloc.h>
@@ -60,7 +62,6 @@ __FBSDID("$FreeBSD$");
 #include <dev/siba/sibareg.h>
 #include <dev/siba/sibavar.h>
 
-#ifdef SIBA_DEBUG
 enum {
        SIBA_DEBUG_SCAN         = 0x00000001,   /* scan */
        SIBA_DEBUG_PMU          = 0x00000002,   /* PMU */
@@ -70,13 +71,16 @@ enum {
        SIBA_DEBUG_CORE         = 0x00000020,   /* handling cores */
        SIBA_DEBUG_ANY          = 0xffffffff
 };
-#define DPRINTF(siba, m, fmt, ...) do {                        \
-       if (siba->siba_debug & (m))                     \
-               printf(fmt, __VA_ARGS__);               \
+
+#ifdef SIBA_DEBUG
+#define DPRINTF(siba, m, ...) do {                             \
+       if (siba->siba_debug & (m))                             \
+               device_printf(siba->siba_dev, __VA_ARGS__);     \
 } while (0)
 #else
-#define DPRINTF(siba, m, fmt, ...) do { (void) siba; } while (0)
+#define DPRINTF(siba, m, ...) do { (void) siba; } while (0)
 #endif
+
 #define        N(a)                    (sizeof(a) / sizeof(a[0]))
 
 static void    siba_pci_gpio(struct siba_softc *, uint32_t, int);
@@ -184,8 +188,6 @@ siba_core_attach(struct siba_softc *siba
 
        siba->siba_ops = &siba_pci_ops;
 
-       siba->siba_debug = SIBA_DEBUG_SCAN;
-
        siba_pci_gpio(siba, SIBA_GPIO_CRYSTAL | SIBA_GPIO_PLL, 1);
        siba_scan(siba);
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to