Skip to contentSkip to conversation

Added configurable debug messages to libertastf

PATCH In review Steve deRosier 3 participants 6 messages Apr 21, 2010 – Apr 28, 2010 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Added configurable debug messages to libertastf

Add the same type of configurable debug messages to libertas_tf as already exist in the libertas driver. This has facilitated creation of a interface specification and will facilitate future development of this driver.

---
 drivers/net/wireless/Kconfig                |    6 +
 drivers/net/wireless/libertas_tf/cmd.c      |  203 +++++++++++++++++++----
 drivers/net/wireless/libertas_tf/deb_defs.h |  120 +++++++++++++
 drivers/net/wireless/libertas_tf/if_usb.c   |  242 +++++++++++++++++++++++----
 drivers/net/wireless/libertas_tf/main.c     |   87 +++++++++-
 5 files changed, 583 insertions(+), 75 deletions(-)
 create mode 100644 drivers/net/wireless/libertas_tf/deb_defs.h
drivers/net/wireless/Kconfig +6 -0
index 77500cb..2fbe9b4 100644
@@ -38,6 +38,12 @@ config LIBERTAS_THINFIRM
 	---help---
 	  A library for Marvell Libertas 8xxx devices using thinfirm.
 
+config LIBERTAS_THINFIRM_DEBUG
+	bool "Enable full debugging output in the Libertas thin firmware module."
+	depends on LIBERTAS_THINFIRM
+	---help---
+	  Debugging support.
+
 config LIBERTAS_THINFIRM_USB
 	tristate "Marvell Libertas 8388 USB 802.11b/g cards with thin firmware"
 	depends on LIBERTAS_THINFIRM && USB
drivers/net/wireless/libertas_tf/cmd.c +169 -34

538 lines not on this page · raw message

drivers/net/wireless/libertas_tf/deb_defs.h new file +120 -0

120 lines not on this page · raw message

drivers/net/wireless/libertas_tf/if_usb.c +205 -37

584 lines not on this page · raw message

drivers/net/wireless/libertas_tf/main.c +83 -4

333 lines not on this page · raw message

Signature · 1 line
1.7.0
#1 lore raw
Quoted 5 lines · Steve deRosier

Add the same type of configurable debug messages to libertas_tf as already exist in the libertas driver. This has facilitated creation of a interface specification and will facilitate future development of this driver.

[]

drivers/net/wireless/libertas_tf/deb_defs.h line 92

Quoted 6 lines
drivers/net/wireless/libertas_tf/deb_defs.h new file +6 -0
+#define lbtf_pr_info(format, args...) \
+	printk(KERN_INFO DRV_NAME": " format, ## args)
+#define lbtf_pr_err(format, args...) \
+	printk(KERN_ERR DRV_NAME": " format, ## args)
+#define lbtf_pr_alert(format, args...) \
+	printk(KERN_ALERT DRV_NAME": " format, ## args)

I think it'd be better to add

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

and use the more standard pr_<level>s.

Quoted 10 lines
drivers/net/wireless/libertas_tf/deb_defs.h new file +10 -0
+#ifdef DEBUG
+static inline void lbtf_deb_hex(unsigned int grp, const char *prompt, u8 *buf, int len)
+{
+	int i = 0;
+
+	if (len &&
+	    (lbtf_debug & LBTF_DEB_HEX) &&
+	    (lbtf_debug & grp))	{
+		for (i = 1; i <= len; i++) {
+			if ((i & 0xf) == 1) {

drivers/net/wireless/libertas_tf/deb_defs.h line 113

Quoted 10 lines
drivers/net/wireless/libertas_tf/deb_defs.h new file +10 -0
+				if (i != 1)
+					printk("\n");
+				printk(DRV_NAME " %s: ", prompt);
+			}
+			printk("%02x ", (u8) *buf);
+			buf++;
+		}
+		printk("\n");
+	}
+}

print_hex_dump_bytes

#2 lore raw

Joe,

Thanks for the pointers. Sorry it took so long to correct the patch, but I'll post it asap.

Thanks,
- Steve

Quoted 45 lines · Joe Perches
Quoted 5 lines · Steve deRosier

Add the same type of configurable debug messages to libertas_tf as already exist in the libertas driver.  This has facilitated creation of a interface specification and will facilitate future development of this driver.

[]

drivers/net/wireless/libertas_tf/deb_defs.h line 92

Quoted 6 lines
drivers/net/wireless/libertas_tf/deb_defs.h new file +6 -0
+#define lbtf_pr_info(format, args...) \
+     printk(KERN_INFO DRV_NAME": " format, ## args)
+#define lbtf_pr_err(format, args...) \
+     printk(KERN_ERR DRV_NAME": " format, ## args)
+#define lbtf_pr_alert(format, args...) \
+     printk(KERN_ALERT DRV_NAME": " format, ## args)

I think it'd be better to add

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

and use the more standard pr_<level>s.

Quoted 10 lines
drivers/net/wireless/libertas_tf/deb_defs.h new file +10 -0
+#ifdef DEBUG
+static inline void lbtf_deb_hex(unsigned int grp, const char *prompt, u8 *buf, int len)
+{
+     int i = 0;
+
+     if (len &&
+         (lbtf_debug & LBTF_DEB_HEX) &&
+         (lbtf_debug & grp)) {
+             for (i = 1; i <= len; i++) {
+                     if ((i & 0xf) == 1) {

drivers/net/wireless/libertas_tf/deb_defs.h line 113

Quoted 10 lines
drivers/net/wireless/libertas_tf/deb_defs.h new file +10 -0
+                             if (i != 1)
+                                     printk("\n");
+                             printk(DRV_NAME " %s: ", prompt);
+                     }
+                     printk("%02x ", (u8) *buf);
+                     buf++;
+             }
+             printk("\n");
+     }
+}

print_hex_dump_bytes

#3 lore raw

PATCH 1/1 Added configurable debug messages to libertastf

Add the same type of configurable debug messages to libertas_tf as already exist in the libertas driver. This has facilitated creation of a interface specification and will facilitate future development of this driver.

---
 drivers/net/wireless/Kconfig                |    6 +
 drivers/net/wireless/libertas_tf/cmd.c      |  205 ++++++++++++++++++----
 drivers/net/wireless/libertas_tf/deb_defs.h |  106 +++++++++++
 drivers/net/wireless/libertas_tf/if_usb.c   |  250 ++++++++++++++++++++++-----
 drivers/net/wireless/libertas_tf/main.c     |   90 +++++++++-
 5 files changed, 576 insertions(+), 81 deletions(-)
 create mode 100644 drivers/net/wireless/libertas_tf/deb_defs.h
drivers/net/wireless/Kconfig +6 -0
index 77500cb..2fbe9b4 100644
@@ -38,6 +38,12 @@ config LIBERTAS_THINFIRM
 	---help---
 	  A library for Marvell Libertas 8xxx devices using thinfirm.
 
+config LIBERTAS_THINFIRM_DEBUG
+	bool "Enable full debugging output in the Libertas thin firmware module."
+	depends on LIBERTAS_THINFIRM
+	---help---
+	  Debugging support.
+
 config LIBERTAS_THINFIRM_USB
 	tristate "Marvell Libertas 8388 USB 802.11b/g cards with thin firmware"
 	depends on LIBERTAS_THINFIRM && USB
drivers/net/wireless/libertas_tf/cmd.c +170 -35

542 lines not on this page · raw message

drivers/net/wireless/libertas_tf/deb_defs.h new file +106 -0

106 lines not on this page · raw message

drivers/net/wireless/libertas_tf/if_usb.c +209 -41

598 lines not on this page · raw message

drivers/net/wireless/libertas_tf/main.c +85 -5

338 lines not on this page · raw message

Signature · 1 line
1.7.0
#4 lore raw
Quoted 12 lines · On Sun, 25 Apr 2010 14:40:46 -0700 Steve deRosier <[email protected]> wrote:

Add the same type of configurable debug messages to libertas_tf as already exist in the libertas driver. This has facilitated creation of a interface specification and will facilitate future development of this driver.

...

drivers/net/wireless/libertas_tf/deb_defs.h new file +3 -0
@@ -0,0 +1,106 @@
+/**
+  * This header file contains global constant/enum definitions,
+  * global variable declaration.

drivers/net/wireless/libertas_tf/deb_defs.h line 13

Quoted 10 lines
drivers/net/wireless/libertas_tf/deb_defs.h new file +10 -0
+  */
+#ifndef _LBS_DEB_DEFS_H_
+#define _LBS_DEB_EFS_H_
+
+#ifndef DRV_NAME
+#define DRV_NAME "libertas_tf"
+#endif
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+

I dunno what this pr_fmt() definition is doing here, but it has unpleasant effects with a x86_64 allmodconfig build:

In file included from drivers/net/wireless/libertas_tf/main.c:12:
drivers/net/wireless/libertas_tf/deb_defs.h:12:1: warning: "pr_fmt" redefined In file included from /usr/src/devel/arch/x86/include/asm/percpu.h:44,

	from /usr/src/devel/arch/x86/include/asm/current.h:5,
	from /usr/src/devel/arch/x86/include/asm/processor.h:15,
	from /usr/src/devel/arch/x86/include/asm/thread_info.h:22,
	from include/linux/thread_info.h:56,
	from include/linux/preempt.h:9,
	from include/linux/spinlock.h:50,
	from include/linux/mmzone.h:7,
	from include/linux/gfp.h:4,
	from include/linux/slab.h:12,
	from drivers/net/wireless/libertas_tf/main.c:10:

include/linux/kernel.h:376:1: warning: this is the location of the previous definition

so I cheerily deleted it.

#5 lore raw
Quoted 5 lines · Andrew Morton

I dunno what this pr_fmt() definition is doing here, but it has unpleasant effects with a x86_64 allmodconfig build:
...
so I cheerily deleted it.

Andrew,

I apologize for the pain. I was trying to comply with a comment to my original patch:

Quoted 9 lines · Joe Perches

Review

Quoted 6 lines
(quoted diff) +6 -0
+#define lbtf_pr_info(format, args...) \
+     printk(KERN_INFO DRV_NAME": " format, ## args)
+#define lbtf_pr_err(format, args...) \
+     printk(KERN_ERR DRV_NAME": " format, ## args)
+#define lbtf_pr_alert(format, args...) \
+     printk(KERN_ALERT DRV_NAME": " format, ## args)

I think it'd be better to add

Quoted 3 lines

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

and use the more standard pr_<level>s.

Unfortunately it turned into a mess, partly due to me wanting to keep the definition in only one place (my .h file) for the module, and partly to my lack of full understanding of the pr_fmt macro.

"cheerily" deleting it is fine. I'll followup with a second (better) patch for that part if I don't like the result.

Thanks,
- Steve