summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/bcm/Debug.c59
-rw-r--r--drivers/staging/bcm/Debug.h66
-rw-r--r--drivers/staging/bcm/InterfaceInit.c7
3 files changed, 61 insertions, 71 deletions
diff --git a/drivers/staging/bcm/Debug.c b/drivers/staging/bcm/Debug.c
index 2703f304756d..9f7f70ca1716 100644
--- a/drivers/staging/bcm/Debug.c
+++ b/drivers/staging/bcm/Debug.c
@@ -1,41 +1,40 @@
#include "headers.h"
-static UINT current_debug_level=BCM_SCREAM;
-
-int bcm_print_buffer( UINT debug_level, const char *function_name,
- char *file_name, int line_number, unsigned char *buffer, int bufferlen, enum _BASE_TYPE base)
+void bcm_print_buffer(UINT debug_level, const char *function_name,
+ const char *file_name, int line_number,
+ const unsigned char *buffer, int bufferlen,
+ BASE_TYPE base)
{
+ int i;
static const char * const buff_dump_base[] = {
"DEC", "HEX", "OCT", "BIN"
};
- if(debug_level>=current_debug_level)
- {
- int i=0;
- printk("\n%s:%s:%d:Buffer dump of size 0x%x in the %s:\n", file_name, function_name, line_number, bufferlen, buff_dump_base[1]);
- for(;i<bufferlen;i++)
- {
- if(i && !(i%16) )
- printk("\n");
- switch(base)
- {
- case BCM_BASE_TYPE_DEC:
- printk("%03d ", buffer[i]);
- break;
- case BCM_BASE_TYPE_OCT:
- printk("%0x03o ", buffer[i]);
- break;
- case BCM_BASE_TYPE_BIN:
- printk("%02x ", buffer[i]);
- break;
- case BCM_BASE_TYPE_HEX:
- default:
- printk("%02X ", buffer[i]);
- break;
- }
+
+ if(debug_level < BCM_SCREAM)
+ return;
+
+ printk("\n" KERN_DEBUG "%s:%s:%d:Buffer dump of size 0x%x in the %s:\n",
+ file_name, function_name, line_number, bufferlen, buff_dump_base[1]);
+
+ for(i = 0; i < bufferlen;i++) {
+ if(i && !(i%16) )
+ printk("\n");
+ switch(base) {
+ case BCM_BASE_TYPE_DEC:
+ printk("%03d ", buffer[i]);
+ break;
+ case BCM_BASE_TYPE_OCT:
+ printk("%0x03o ", buffer[i]);
+ break;
+ case BCM_BASE_TYPE_BIN:
+ printk("%02x ", buffer[i]);
+ break;
+ case BCM_BASE_TYPE_HEX:
+ default:
+ printk("%02X ", buffer[i]);
+ break;
}
printk("\n");
}
- return 0;
}
-
diff --git a/drivers/staging/bcm/Debug.h b/drivers/staging/bcm/Debug.h
index b384115cab3a..58e46a601dec 100644
--- a/drivers/staging/bcm/Debug.h
+++ b/drivers/staging/bcm/Debug.h
@@ -18,11 +18,9 @@ typedef enum _BASE_TYPE
BCM_BASE_TYPE_NONE,
} BASE_TYPE, *PBASE_TYPE;
-int bcm_print_buffer( UINT debug_level, const char *function_name,
- char *file_name, int line_number, unsigned char *buffer, int bufferlen, BASE_TYPE base);
-
-
-
+void bcm_print_buffer(UINT debug_level, const char *function_name,
+ const char *file_name, int line_number,
+ const unsigned char *buffer, int bufferlen, BASE_TYPE base);
//--------------------------------------------------------------------------------
@@ -229,44 +227,32 @@ typedef struct _S_BCM_DEBUG_STATE {
//--- Only for direct printk's; "hidden" to API.
#define DBG_TYPE_PRINTK 3
-#define PRINTKS_ON 1 // "hidden" from API, set to 0 to turn off all printk's
-
-#define BCM_DEBUG_PRINT(Adapter, Type, SubType, dbg_level, string, args...) do { \
- if ((DBG_TYPE_PRINTK == Type) && (PRINTKS_ON)) { \
- printk ("%s:" string, __FUNCTION__, ##args); \
- printk("\n"); \
- } else if (!Adapter) \
- ; \
- else { \
- if (((dbg_level & DBG_LVL_BITMASK) <= Adapter->stDebugState.debug_level) && \
- ((Type & Adapter->stDebugState.type) && (SubType & Adapter->stDebugState.subtype[Type]))) { \
- if (dbg_level & DBG_NO_FUNC_PRINT) \
- printk (string, ##args); \
- else \
- { \
- printk ("%s:" string, __FUNCTION__, ##args); \
- printk("\n"); \
- } \
- } \
- } \
-} while (0)
-#define BCM_DEBUG_PRINT_BUFFER(Adapter, Type, SubType, dbg_level, buffer, bufferlen) do { \
- if ((DBG_TYPE_PRINTK == Type) && (PRINTKS_ON)) { \
- bcm_print_buffer( dbg_level, __FUNCTION__, __FILE__, __LINE__, buffer, bufferlen, BCM_BASE_TYPE_HEX); \
- } else if (!Adapter) \
- ; \
- else { \
- if (((dbg_level & DBG_LVL_BITMASK) <= Adapter->stDebugState.debug_level) && \
- ((Type & Adapter->stDebugState.type) && (SubType & Adapter->stDebugState.subtype[Type]))) { \
- if (dbg_level & DBG_NO_FUNC_PRINT) \
- bcm_print_buffer( dbg_level, NULL, NULL, __LINE__, buffer, bufferlen, BCM_BASE_TYPE_HEX); \
- else \
- bcm_print_buffer( dbg_level, __FUNCTION__, __FILE__, __LINE__, buffer, bufferlen, BCM_BASE_TYPE_HEX); \
- } \
- } \
+#define BCM_DEBUG_PRINT(Adapter, Type, SubType, dbg_level, string, args...) \
+ do { \
+ if (DBG_TYPE_PRINTK == Type) \
+ pr_info("%s:" string "\n", __func__, ##args); \
+ else if (Adapter && \
+ (dbg_level & DBG_LVL_BITMASK) <= Adapter->stDebugState.debug_level && \
+ (Type & Adapter->stDebugState.type) && \
+ (SubType & Adapter->stDebugState.subtype[Type])) { \
+ if (dbg_level & DBG_NO_FUNC_PRINT) \
+ printk(KERN_DEBUG string, ##args); \
+ else \
+ printk(KERN_DEBUG "%s:" string "\n", __func__, ##args); \
+ } \
} while (0)
+#define BCM_DEBUG_PRINT_BUFFER(Adapter, Type, SubType, dbg_level, buffer, bufferlen) do { \
+ if (DBG_TYPE_PRINTK == Type || \
+ (Adapter && \
+ (dbg_level & DBG_LVL_BITMASK) <= Adapter->stDebugState.debug_level && \
+ (Type & Adapter->stDebugState.type) && \
+ (SubType & Adapter->stDebugState.subtype[Type]))) \
+ bcm_print_buffer(dbg_level, __func__, __FILE__, __LINE__, \
+ buffer, bufferlen, BCM_BASE_TYPE_HEX); \
+} while(0)
+
#define BCM_SHOW_DEBUG_BITMAP(Adapter) do { \
int i; \
diff --git a/drivers/staging/bcm/InterfaceInit.c b/drivers/staging/bcm/InterfaceInit.c
index 958d16ad5289..f810bfd0b1a5 100644
--- a/drivers/staging/bcm/InterfaceInit.c
+++ b/drivers/staging/bcm/InterfaceInit.c
@@ -11,6 +11,11 @@ static struct usb_device_id InterfaceUsbtable[] = {
};
MODULE_DEVICE_TABLE(usb, InterfaceUsbtable);
+static unsigned int debug_level = DBG_LVL_CURR;
+module_param(debug_level, uint, 0644);
+MODULE_PARM_DESC(debug_level, "Debug level (0=none,...,7=all)");
+
+
VOID InterfaceAdapterFree(PS_INTERFACE_ADAPTER psIntfAdapter)
{
INT i = 0;
@@ -198,7 +203,7 @@ usbbcm_device_probe(struct usb_interface *intf, const struct usb_device_id *id)
/* Init default driver debug state */
- psAdapter->stDebugState.debug_level = DBG_LVL_CURR;
+ psAdapter->stDebugState.debug_level = debug_level;
psAdapter->stDebugState.type = DBG_TYPE_INITEXIT;
memset (psAdapter->stDebugState.subtype, 0, sizeof (psAdapter->stDebugState.subtype));