Loading drivers/staging/bcm/Debug.c +29 −30 Original line number Diff line number Diff line #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(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) { switch(base) { case BCM_BASE_TYPE_DEC: printk("%03d ", buffer[i]); break; Loading @@ -32,10 +34,7 @@ int bcm_print_buffer( UINT debug_level, const char *function_name, printk("%02X ", buffer[i]); break; } } printk("\n"); } return 0; } drivers/staging/bcm/Debug.h +26 −40 Original line number Diff line number Diff line Loading @@ -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); //-------------------------------------------------------------------------------- Loading Loading @@ -229,42 +227,30 @@ 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]))) { \ #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 (string, ##args); \ printk(KERN_DEBUG string, ##args); \ else \ { \ printk ("%s:" string, __FUNCTION__, ##args); \ printk("\n"); \ } \ } \ 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) && (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); \ } \ } \ 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) Loading drivers/staging/bcm/InterfaceInit.c +6 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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)); Loading Loading
drivers/staging/bcm/Debug.c +29 −30 Original line number Diff line number Diff line #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(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) { switch(base) { case BCM_BASE_TYPE_DEC: printk("%03d ", buffer[i]); break; Loading @@ -32,10 +34,7 @@ int bcm_print_buffer( UINT debug_level, const char *function_name, printk("%02X ", buffer[i]); break; } } printk("\n"); } return 0; }
drivers/staging/bcm/Debug.h +26 −40 Original line number Diff line number Diff line Loading @@ -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); //-------------------------------------------------------------------------------- Loading Loading @@ -229,42 +227,30 @@ 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]))) { \ #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 (string, ##args); \ printk(KERN_DEBUG string, ##args); \ else \ { \ printk ("%s:" string, __FUNCTION__, ##args); \ printk("\n"); \ } \ } \ 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) && (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); \ } \ } \ 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) Loading
drivers/staging/bcm/InterfaceInit.c +6 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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)); Loading