s390/debug: adjust coding style
The debug feature code hasn't been touched in ages and the code also looks like this. Therefore clean up the code so it looks a bit more like current coding style. There is no functional change - actually I made also sure that the generated code with performance_defconfig is identical. A diff of old vs new with "objdump -d" is empty. The code is still not checkpatch clean, but that was not the goal. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
0bb6bba5fb
commit
496da0d706
|
@ -13,25 +13,25 @@
|
|||
#include <linux/refcount.h>
|
||||
#include <uapi/asm/debug.h>
|
||||
|
||||
#define DEBUG_MAX_LEVEL 6 /* debug levels range from 0 to 6 */
|
||||
#define DEBUG_OFF_LEVEL -1 /* level where debug is switched off */
|
||||
#define DEBUG_FLUSH_ALL -1 /* parameter to flush all areas */
|
||||
#define DEBUG_MAX_VIEWS 10 /* max number of views in proc fs */
|
||||
#define DEBUG_MAX_NAME_LEN 64 /* max length for a debugfs file name */
|
||||
#define DEBUG_DEFAULT_LEVEL 3 /* initial debug level */
|
||||
#define DEBUG_MAX_LEVEL 6 /* debug levels range from 0 to 6 */
|
||||
#define DEBUG_OFF_LEVEL -1 /* level where debug is switched off */
|
||||
#define DEBUG_FLUSH_ALL -1 /* parameter to flush all areas */
|
||||
#define DEBUG_MAX_VIEWS 10 /* max number of views in proc fs */
|
||||
#define DEBUG_MAX_NAME_LEN 64 /* max length for a debugfs file name */
|
||||
#define DEBUG_DEFAULT_LEVEL 3 /* initial debug level */
|
||||
|
||||
#define DEBUG_DIR_ROOT "s390dbf" /* name of debug root directory in proc fs */
|
||||
|
||||
#define DEBUG_DATA(entry) (char*)(entry + 1) /* data is stored behind */
|
||||
/* the entry information */
|
||||
#define DEBUG_DATA(entry) (char *)(entry + 1) /* data is stored behind */
|
||||
/* the entry information */
|
||||
|
||||
typedef struct __debug_entry debug_entry_t;
|
||||
|
||||
struct debug_view;
|
||||
|
||||
typedef struct debug_info {
|
||||
struct debug_info* next;
|
||||
struct debug_info* prev;
|
||||
struct debug_info *next;
|
||||
struct debug_info *prev;
|
||||
refcount_t ref_count;
|
||||
spinlock_t lock;
|
||||
int level;
|
||||
|
@ -39,45 +39,45 @@ typedef struct debug_info {
|
|||
int pages_per_area;
|
||||
int buf_size;
|
||||
int entry_size;
|
||||
debug_entry_t*** areas;
|
||||
debug_entry_t ***areas;
|
||||
int active_area;
|
||||
int *active_pages;
|
||||
int *active_entries;
|
||||
struct dentry* debugfs_root_entry;
|
||||
struct dentry* debugfs_entries[DEBUG_MAX_VIEWS];
|
||||
struct debug_view* views[DEBUG_MAX_VIEWS];
|
||||
struct dentry *debugfs_root_entry;
|
||||
struct dentry *debugfs_entries[DEBUG_MAX_VIEWS];
|
||||
struct debug_view *views[DEBUG_MAX_VIEWS];
|
||||
char name[DEBUG_MAX_NAME_LEN];
|
||||
umode_t mode;
|
||||
} debug_info_t;
|
||||
|
||||
typedef int (debug_header_proc_t) (debug_info_t* id,
|
||||
struct debug_view* view,
|
||||
typedef int (debug_header_proc_t) (debug_info_t *id,
|
||||
struct debug_view *view,
|
||||
int area,
|
||||
debug_entry_t* entry,
|
||||
char* out_buf);
|
||||
debug_entry_t *entry,
|
||||
char *out_buf);
|
||||
|
||||
typedef int (debug_format_proc_t) (debug_info_t* id,
|
||||
struct debug_view* view, char* out_buf,
|
||||
const char* in_buf);
|
||||
typedef int (debug_prolog_proc_t) (debug_info_t* id,
|
||||
struct debug_view* view,
|
||||
char* out_buf);
|
||||
typedef int (debug_input_proc_t) (debug_info_t* id,
|
||||
struct debug_view* view,
|
||||
struct file* file,
|
||||
typedef int (debug_format_proc_t) (debug_info_t *id,
|
||||
struct debug_view *view, char *out_buf,
|
||||
const char *in_buf);
|
||||
typedef int (debug_prolog_proc_t) (debug_info_t *id,
|
||||
struct debug_view *view,
|
||||
char *out_buf);
|
||||
typedef int (debug_input_proc_t) (debug_info_t *id,
|
||||
struct debug_view *view,
|
||||
struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t in_buf_size, loff_t* offset);
|
||||
size_t in_buf_size, loff_t *offset);
|
||||
|
||||
int debug_dflt_header_fn(debug_info_t* id, struct debug_view* view,
|
||||
int area, debug_entry_t* entry, char* out_buf);
|
||||
int debug_dflt_header_fn(debug_info_t *id, struct debug_view *view,
|
||||
int area, debug_entry_t *entry, char *out_buf);
|
||||
|
||||
struct debug_view {
|
||||
char name[DEBUG_MAX_NAME_LEN];
|
||||
debug_prolog_proc_t* prolog_proc;
|
||||
debug_header_proc_t* header_proc;
|
||||
debug_format_proc_t* format_proc;
|
||||
debug_input_proc_t* input_proc;
|
||||
void* private_data;
|
||||
debug_prolog_proc_t *prolog_proc;
|
||||
debug_header_proc_t *header_proc;
|
||||
debug_format_proc_t *format_proc;
|
||||
debug_input_proc_t *input_proc;
|
||||
void *private_data;
|
||||
};
|
||||
|
||||
extern struct debug_view debug_hex_ascii_view;
|
||||
|
@ -86,65 +86,67 @@ extern struct debug_view debug_sprintf_view;
|
|||
|
||||
/* do NOT use the _common functions */
|
||||
|
||||
debug_entry_t* debug_event_common(debug_info_t* id, int level,
|
||||
const void* data, int length);
|
||||
debug_entry_t *debug_event_common(debug_info_t *id, int level,
|
||||
const void *data, int length);
|
||||
|
||||
debug_entry_t* debug_exception_common(debug_info_t* id, int level,
|
||||
const void* data, int length);
|
||||
debug_entry_t *debug_exception_common(debug_info_t *id, int level,
|
||||
const void *data, int length);
|
||||
|
||||
/* Debug Feature API: */
|
||||
|
||||
debug_info_t *debug_register(const char *name, int pages, int nr_areas,
|
||||
int buf_size);
|
||||
int buf_size);
|
||||
|
||||
debug_info_t *debug_register_mode(const char *name, int pages, int nr_areas,
|
||||
int buf_size, umode_t mode, uid_t uid,
|
||||
gid_t gid);
|
||||
|
||||
void debug_unregister(debug_info_t* id);
|
||||
void debug_unregister(debug_info_t *id);
|
||||
|
||||
void debug_set_level(debug_info_t* id, int new_level);
|
||||
void debug_set_level(debug_info_t *id, int new_level);
|
||||
|
||||
void debug_set_critical(void);
|
||||
void debug_stop_all(void);
|
||||
|
||||
static inline bool debug_level_enabled(debug_info_t* id, int level)
|
||||
static inline bool debug_level_enabled(debug_info_t *id, int level)
|
||||
{
|
||||
return level <= id->level;
|
||||
}
|
||||
|
||||
static inline debug_entry_t*
|
||||
debug_event(debug_info_t* id, int level, void* data, int length)
|
||||
static inline debug_entry_t *debug_event(debug_info_t *id, int level,
|
||||
void *data, int length)
|
||||
{
|
||||
if ((!id) || (level > id->level) || (id->pages_per_area == 0))
|
||||
return NULL;
|
||||
return debug_event_common(id,level,data,length);
|
||||
return debug_event_common(id, level, data, length);
|
||||
}
|
||||
|
||||
static inline debug_entry_t*
|
||||
debug_int_event(debug_info_t* id, int level, unsigned int tag)
|
||||
static inline debug_entry_t *debug_int_event(debug_info_t *id, int level,
|
||||
unsigned int tag)
|
||||
{
|
||||
unsigned int t=tag;
|
||||
unsigned int t = tag;
|
||||
|
||||
if ((!id) || (level > id->level) || (id->pages_per_area == 0))
|
||||
return NULL;
|
||||
return debug_event_common(id,level,&t,sizeof(unsigned int));
|
||||
return debug_event_common(id, level, &t, sizeof(unsigned int));
|
||||
}
|
||||
|
||||
static inline debug_entry_t *
|
||||
debug_long_event (debug_info_t* id, int level, unsigned long tag)
|
||||
static inline debug_entry_t *debug_long_event(debug_info_t *id, int level,
|
||||
unsigned long tag)
|
||||
{
|
||||
unsigned long t=tag;
|
||||
unsigned long t = tag;
|
||||
|
||||
if ((!id) || (level > id->level) || (id->pages_per_area == 0))
|
||||
return NULL;
|
||||
return debug_event_common(id,level,&t,sizeof(unsigned long));
|
||||
return debug_event_common(id, level, &t, sizeof(unsigned long));
|
||||
}
|
||||
|
||||
static inline debug_entry_t*
|
||||
debug_text_event(debug_info_t* id, int level, const char* txt)
|
||||
static inline debug_entry_t *debug_text_event(debug_info_t *id, int level,
|
||||
const char *txt)
|
||||
{
|
||||
if ((!id) || (level > id->level) || (id->pages_per_area == 0))
|
||||
return NULL;
|
||||
return debug_event_common(id,level,txt,strlen(txt));
|
||||
return debug_event_common(id, level, txt, strlen(txt));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -160,6 +162,7 @@ __debug_sprintf_event(debug_info_t *id, int level, char *string, ...)
|
|||
debug_entry_t *__ret; \
|
||||
debug_info_t *__id = _id; \
|
||||
int __level = _level; \
|
||||
\
|
||||
if ((!__id) || (__level > __id->level)) \
|
||||
__ret = NULL; \
|
||||
else \
|
||||
|
@ -168,38 +171,40 @@ __debug_sprintf_event(debug_info_t *id, int level, char *string, ...)
|
|||
__ret; \
|
||||
})
|
||||
|
||||
static inline debug_entry_t*
|
||||
debug_exception(debug_info_t* id, int level, void* data, int length)
|
||||
static inline debug_entry_t *debug_exception(debug_info_t *id, int level,
|
||||
void *data, int length)
|
||||
{
|
||||
if ((!id) || (level > id->level) || (id->pages_per_area == 0))
|
||||
return NULL;
|
||||
return debug_exception_common(id,level,data,length);
|
||||
return debug_exception_common(id, level, data, length);
|
||||
}
|
||||
|
||||
static inline debug_entry_t*
|
||||
debug_int_exception(debug_info_t* id, int level, unsigned int tag)
|
||||
static inline debug_entry_t *debug_int_exception(debug_info_t *id, int level,
|
||||
unsigned int tag)
|
||||
{
|
||||
unsigned int t=tag;
|
||||
unsigned int t = tag;
|
||||
|
||||
if ((!id) || (level > id->level) || (id->pages_per_area == 0))
|
||||
return NULL;
|
||||
return debug_exception_common(id,level,&t,sizeof(unsigned int));
|
||||
return debug_exception_common(id, level, &t, sizeof(unsigned int));
|
||||
}
|
||||
|
||||
static inline debug_entry_t *
|
||||
debug_long_exception (debug_info_t* id, int level, unsigned long tag)
|
||||
static inline debug_entry_t *debug_long_exception (debug_info_t *id, int level,
|
||||
unsigned long tag)
|
||||
{
|
||||
unsigned long t=tag;
|
||||
unsigned long t = tag;
|
||||
|
||||
if ((!id) || (level > id->level) || (id->pages_per_area == 0))
|
||||
return NULL;
|
||||
return debug_exception_common(id,level,&t,sizeof(unsigned long));
|
||||
return debug_exception_common(id, level, &t, sizeof(unsigned long));
|
||||
}
|
||||
|
||||
static inline debug_entry_t*
|
||||
debug_text_exception(debug_info_t* id, int level, const char* txt)
|
||||
static inline debug_entry_t *debug_text_exception(debug_info_t *id, int level,
|
||||
const char *txt)
|
||||
{
|
||||
if ((!id) || (level > id->level) || (id->pages_per_area == 0))
|
||||
return NULL;
|
||||
return debug_exception_common(id,level,txt,strlen(txt));
|
||||
return debug_exception_common(id, level, txt, strlen(txt));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -215,6 +220,7 @@ __debug_sprintf_exception(debug_info_t *id, int level, char *string, ...)
|
|||
debug_entry_t *__ret; \
|
||||
debug_info_t *__id = _id; \
|
||||
int __level = _level; \
|
||||
\
|
||||
if ((!__id) || (__level > __id->level)) \
|
||||
__ret = NULL; \
|
||||
else \
|
||||
|
@ -223,8 +229,8 @@ __debug_sprintf_exception(debug_info_t *id, int level, char *string, ...)
|
|||
__ret; \
|
||||
})
|
||||
|
||||
int debug_register_view(debug_info_t* id, struct debug_view* view);
|
||||
int debug_unregister_view(debug_info_t* id, struct debug_view* view);
|
||||
int debug_register_view(debug_info_t *id, struct debug_view *view);
|
||||
int debug_unregister_view(debug_info_t *id, struct debug_view *view);
|
||||
|
||||
/*
|
||||
define the debug levels:
|
||||
|
@ -247,17 +253,17 @@ int debug_unregister_view(debug_info_t* id, struct debug_view* view);
|
|||
#define INTERNAL_DEBMSG(x,y...) "D" __FILE__ "%d: " x, __LINE__, y
|
||||
|
||||
#if DEBUG_LEVEL > 0
|
||||
#define PRINT_DEBUG(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
|
||||
#define PRINT_INFO(x...) printk ( KERN_INFO PRINTK_HEADER x )
|
||||
#define PRINT_WARN(x...) printk ( KERN_WARNING PRINTK_HEADER x )
|
||||
#define PRINT_ERR(x...) printk ( KERN_ERR PRINTK_HEADER x )
|
||||
#define PRINT_FATAL(x...) panic ( PRINTK_HEADER x )
|
||||
#define PRINT_DEBUG(x...) printk(KERN_DEBUG PRINTK_HEADER x)
|
||||
#define PRINT_INFO(x...) printk(KERN_INFO PRINTK_HEADER x)
|
||||
#define PRINT_WARN(x...) printk(KERN_WARNING PRINTK_HEADER x)
|
||||
#define PRINT_ERR(x...) printk(KERN_ERR PRINTK_HEADER x)
|
||||
#define PRINT_FATAL(x...) panic(PRINTK_HEADER x)
|
||||
#else
|
||||
#define PRINT_DEBUG(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
|
||||
#define PRINT_INFO(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
|
||||
#define PRINT_WARN(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
|
||||
#define PRINT_ERR(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
|
||||
#define PRINT_FATAL(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
|
||||
#endif /* DASD_DEBUG */
|
||||
#define PRINT_DEBUG(x...) printk(KERN_DEBUG PRINTK_HEADER x)
|
||||
#define PRINT_INFO(x...) printk(KERN_DEBUG PRINTK_HEADER x)
|
||||
#define PRINT_WARN(x...) printk(KERN_DEBUG PRINTK_HEADER x)
|
||||
#define PRINT_ERR(x...) printk(KERN_DEBUG PRINTK_HEADER x)
|
||||
#define PRINT_FATAL(x...) printk(KERN_DEBUG PRINTK_HEADER x)
|
||||
#endif /* DASD_DEBUG */
|
||||
|
||||
#endif /* DEBUG_H */
|
||||
#endif /* DEBUG_H */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue