]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
IB/mthca: Always build debugging code unless CONFIG_EMBEDDED=y
authorRoland Dreier <rolandd@cisco.com>
Sun, 2 Apr 2006 21:39:20 +0000 (14:39 -0700)
committerRoland Dreier <rolandd@cisco.com>
Sun, 2 Apr 2006 21:39:20 +0000 (14:39 -0700)
Change the mthca debugging trace output code so that it can enabled
and disabled at runtime with the debug_level module parameter in
sysfs.  Also, don't allow CONFIG_INFINIBAND_MTHCA_DEBUG to be disabled
unless CONFIG_EMBEDDED is selected.  We want users (and especially
distros) to have this turned on unless they really need to save space,
because by the time we want debugging output, it's usually too late to
rebuild a kernel.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/mthca/Kconfig
drivers/infiniband/hw/mthca/Makefile
drivers/infiniband/hw/mthca/mthca_dev.h
drivers/infiniband/hw/mthca/mthca_main.c

index e88be85b3d5cac6724e99532e0589ac0c391a0cd..9aa5a4468a753c0ee241277e8d957ffb8207b8d4 100644 (file)
@@ -7,10 +7,11 @@ config INFINIBAND_MTHCA
          ("Tavor") and the MT25208 PCI Express HCA ("Arbel").
 
 config INFINIBAND_MTHCA_DEBUG
-       bool "Verbose debugging output"
+       bool "Verbose debugging output" if EMBEDDED
        depends on INFINIBAND_MTHCA
-       default n
+       default y
        ---help---
-         This option causes the mthca driver produce a bunch of debug
-         messages.  Select this is you are developing the driver or
-         trying to diagnose a problem.
+         This option causes debugging code to be compiled into the
+         mthca driver.  The output can be turned on via the
+         debug_level module parameter (which can also be set after
+         the driver is loaded through sysfs).
index 47ec5a7cba0b61ba39744769866b5c91120b91e8..e388d95d0cf1e76c6eceeb61a1b793585b26e1ff 100644 (file)
@@ -1,7 +1,3 @@
-ifdef CONFIG_INFINIBAND_MTHCA_DEBUG
-EXTRA_CFLAGS += -DDEBUG
-endif
-
 obj-$(CONFIG_INFINIBAND_MTHCA) += ib_mthca.o
 
 ib_mthca-y :=  mthca_main.o mthca_cmd.o mthca_profile.o mthca_reset.o \
index ad52edbefe98b16da4bb538cda021da760b539d0..bb2a9d628d7d8682f6707c5c21fbd05bf9fe55c6 100644 (file)
@@ -355,8 +355,21 @@ struct mthca_dev {
        spinlock_t            sm_lock;
 };
 
-#define mthca_dbg(mdev, format, arg...) \
-       dev_dbg(&mdev->pdev->dev, format, ## arg)
+#ifdef CONFIG_INFINIBAND_MTHCA_DEBUG
+extern int mthca_debug_level;
+
+#define mthca_dbg(mdev, format, arg...)                                        \
+       do {                                                            \
+               if (mthca_debug_level)                                  \
+                       dev_printk(KERN_DEBUG, &mdev->pdev->dev, format, ## arg); \
+       } while (0)
+
+#else /* CONFIG_INFINIBAND_MTHCA_DEBUG */
+
+#define mthca_dbg(mdev, format, arg...) do { (void) mdev; } while (0)
+
+#endif /* CONFIG_INFINIBAND_MTHCA_DEBUG */
+
 #define mthca_err(mdev, format, arg...) \
        dev_err(&mdev->pdev->dev, format, ## arg)
 #define mthca_info(mdev, format, arg...) \
index 266f347c670767285c138299a554de729b5b3697..597d7dc7088e70f2a0abd1933f7da320e128a0b8 100644 (file)
@@ -52,6 +52,14 @@ MODULE_DESCRIPTION("Mellanox InfiniBand HCA low-level driver");
 MODULE_LICENSE("Dual BSD/GPL");
 MODULE_VERSION(DRV_VERSION);
 
+#ifdef CONFIG_INFINIBAND_MTHCA_DEBUG
+
+int mthca_debug_level = 0;
+module_param_named(debug_level, mthca_debug_level, int, 0644);
+MODULE_PARM_DESC(debug_level, "Enable debug tracing if > 0");
+
+#endif /* CONFIG_INFINIBAND_MTHCA_DEBUG */
+
 #ifdef CONFIG_PCI_MSI
 
 static int msi_x = 0;