s390/s390dbf: use debug_level_enabled() where applicable
Refactor direct debug level comparisons with the (internal) s390db->level member. Use the debug_level_enabled() function instead. Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
f1d86b61fb
commit
8e6a828566
|
@ -107,7 +107,7 @@ extern debug_info_t *scm_debug;
|
|||
|
||||
static inline void SCM_LOG_HEX(int level, void *data, int length)
|
||||
{
|
||||
if (level > scm_debug->level)
|
||||
if (!debug_level_enabled(scm_debug, level))
|
||||
return;
|
||||
while (length > 0) {
|
||||
debug_event(scm_debug, level, data, length);
|
||||
|
|
|
@ -42,7 +42,7 @@ static debug_info_t *eadm_debug;
|
|||
|
||||
static void EADM_LOG_HEX(int level, void *data, int length)
|
||||
{
|
||||
if (level > eadm_debug->level)
|
||||
if (!debug_level_enabled(eadm_debug, level))
|
||||
return;
|
||||
while (length > 0) {
|
||||
debug_event(eadm_debug, level, data, length);
|
||||
|
|
|
@ -16,12 +16,6 @@
|
|||
extern debug_info_t *qdio_dbf_setup;
|
||||
extern debug_info_t *qdio_dbf_error;
|
||||
|
||||
/* sort out low debug levels early to avoid wasted sprints */
|
||||
static inline int qdio_dbf_passes(debug_info_t *dbf_grp, int level)
|
||||
{
|
||||
return (level <= dbf_grp->level);
|
||||
}
|
||||
|
||||
#define DBF_ERR 3 /* error conditions */
|
||||
#define DBF_WARN 4 /* warning conditions */
|
||||
#define DBF_INFO 6 /* informational */
|
||||
|
@ -65,7 +59,7 @@ static inline void DBF_ERROR_HEX(void *addr, int len)
|
|||
#define DBF_DEV_EVENT(level, device, text...) \
|
||||
do { \
|
||||
char debug_buffer[QDIO_DBF_LEN]; \
|
||||
if (qdio_dbf_passes(device->debug_area, level)) { \
|
||||
if (debug_level_enabled(device->debug_area, level)) { \
|
||||
snprintf(debug_buffer, QDIO_DBF_LEN, text); \
|
||||
debug_text_event(device->debug_area, level, debug_buffer); \
|
||||
} \
|
||||
|
|
|
@ -11,12 +11,6 @@
|
|||
/* that gives us 15 characters in the text event views */
|
||||
#define ZCRYPT_DBF_LEN 16
|
||||
|
||||
/* sort out low debug levels early to avoid wasted sprints */
|
||||
static inline int zcrypt_dbf_passes(debug_info_t *dbf_grp, int level)
|
||||
{
|
||||
return (level <= dbf_grp->level);
|
||||
}
|
||||
|
||||
#define DBF_ERR 3 /* error conditions */
|
||||
#define DBF_WARN 4 /* warning conditions */
|
||||
#define DBF_INFO 6 /* informational */
|
||||
|
@ -25,7 +19,7 @@ static inline int zcrypt_dbf_passes(debug_info_t *dbf_grp, int level)
|
|||
|
||||
#define ZCRYPT_DBF_COMMON(level, text...) \
|
||||
do { \
|
||||
if (zcrypt_dbf_passes(zcrypt_dbf_common, level)) { \
|
||||
if (debug_level_enabled(zcrypt_dbf_common, level)) { \
|
||||
char debug_buffer[ZCRYPT_DBF_LEN]; \
|
||||
snprintf(debug_buffer, ZCRYPT_DBF_LEN, text); \
|
||||
debug_text_event(zcrypt_dbf_common, level, \
|
||||
|
@ -35,7 +29,7 @@ static inline int zcrypt_dbf_passes(debug_info_t *dbf_grp, int level)
|
|||
|
||||
#define ZCRYPT_DBF_DEVICES(level, text...) \
|
||||
do { \
|
||||
if (zcrypt_dbf_passes(zcrypt_dbf_devices, level)) { \
|
||||
if (debug_level_enabled(zcrypt_dbf_devices, level)) { \
|
||||
char debug_buffer[ZCRYPT_DBF_LEN]; \
|
||||
snprintf(debug_buffer, ZCRYPT_DBF_LEN, text); \
|
||||
debug_text_event(zcrypt_dbf_devices, level, \
|
||||
|
@ -45,7 +39,7 @@ static inline int zcrypt_dbf_passes(debug_info_t *dbf_grp, int level)
|
|||
|
||||
#define ZCRYPT_DBF_DEV(level, device, text...) \
|
||||
do { \
|
||||
if (zcrypt_dbf_passes(device->dbf_area, level)) { \
|
||||
if (debug_level_enabled(device->dbf_area, level)) { \
|
||||
char debug_buffer[ZCRYPT_DBF_LEN]; \
|
||||
snprintf(debug_buffer, ZCRYPT_DBF_LEN, text); \
|
||||
debug_text_event(device->dbf_area, level, \
|
||||
|
|
|
@ -114,15 +114,9 @@ do { \
|
|||
debug_event(claw_dbf_##name,level,(void*)(addr),len); \
|
||||
} while (0)
|
||||
|
||||
/* Allow to sort out low debug levels early to avoid wasted sprints */
|
||||
static inline int claw_dbf_passes(debug_info_t *dbf_grp, int level)
|
||||
{
|
||||
return (level <= dbf_grp->level);
|
||||
}
|
||||
|
||||
#define CLAW_DBF_TEXT_(level,name,text...) \
|
||||
do { \
|
||||
if (claw_dbf_passes(claw_dbf_##name, level)) { \
|
||||
if (debug_level_enabled(claw_dbf_##name, level)) { \
|
||||
sprintf(debug_buffer, text); \
|
||||
debug_text_event(claw_dbf_##name, level, \
|
||||
debug_buffer); \
|
||||
|
|
|
@ -66,7 +66,7 @@ void ctcm_dbf_longtext(enum ctcm_dbf_names dbf_nix, int level, char *fmt, ...)
|
|||
char dbf_txt_buf[64];
|
||||
va_list args;
|
||||
|
||||
if (level > (ctcm_dbf[dbf_nix].id)->level)
|
||||
if (!debug_level_enabled(ctcm_dbf[dbf_nix].id, level))
|
||||
return;
|
||||
va_start(args, fmt);
|
||||
vsnprintf(dbf_txt_buf, sizeof(dbf_txt_buf), fmt, args);
|
||||
|
|
|
@ -16,15 +16,9 @@ do { \
|
|||
debug_event(lcs_dbf_##name,level,(void*)(addr),len); \
|
||||
} while (0)
|
||||
|
||||
/* Allow to sort out low debug levels early to avoid wasted sprints */
|
||||
static inline int lcs_dbf_passes(debug_info_t *dbf_grp, int level)
|
||||
{
|
||||
return (level <= dbf_grp->level);
|
||||
}
|
||||
|
||||
#define LCS_DBF_TEXT_(level,name,text...) \
|
||||
do { \
|
||||
if (lcs_dbf_passes(lcs_dbf_##name, level)) { \
|
||||
if (debug_level_enabled(lcs_dbf_##name, level)) { \
|
||||
sprintf(debug_buffer, text); \
|
||||
debug_text_event(lcs_dbf_##name, level, debug_buffer); \
|
||||
} \
|
||||
|
|
|
@ -105,15 +105,9 @@ MODULE_DESCRIPTION ("Linux for S/390 IUCV network driver");
|
|||
|
||||
DECLARE_PER_CPU(char[256], iucv_dbf_txt_buf);
|
||||
|
||||
/* Allow to sort out low debug levels early to avoid wasted sprints */
|
||||
static inline int iucv_dbf_passes(debug_info_t *dbf_grp, int level)
|
||||
{
|
||||
return (level <= dbf_grp->level);
|
||||
}
|
||||
|
||||
#define IUCV_DBF_TEXT_(name, level, text...) \
|
||||
do { \
|
||||
if (iucv_dbf_passes(iucv_dbf_##name, level)) { \
|
||||
if (debug_level_enabled(iucv_dbf_##name, level)) { \
|
||||
char* __buf = get_cpu_var(iucv_dbf_txt_buf); \
|
||||
sprintf(__buf, text); \
|
||||
debug_text_event(iucv_dbf_##name, level, __buf); \
|
||||
|
|
|
@ -5096,7 +5096,7 @@ void qeth_dbf_longtext(debug_info_t *id, int level, char *fmt, ...)
|
|||
char dbf_txt_buf[32];
|
||||
va_list args;
|
||||
|
||||
if (level > id->level)
|
||||
if (!debug_level_enabled(id, level))
|
||||
return;
|
||||
va_start(args, fmt);
|
||||
vsnprintf(dbf_txt_buf, sizeof(dbf_txt_buf), fmt, args);
|
||||
|
|
|
@ -278,7 +278,7 @@ struct zfcp_dbf {
|
|||
static inline
|
||||
void zfcp_dbf_hba_fsf_resp(char *tag, int level, struct zfcp_fsf_req *req)
|
||||
{
|
||||
if (level <= req->adapter->dbf->hba->level)
|
||||
if (debug_level_enabled(req->adapter->dbf->hba, level))
|
||||
zfcp_dbf_hba_fsf_res(tag, req);
|
||||
}
|
||||
|
||||
|
@ -317,7 +317,7 @@ void _zfcp_dbf_scsi(char *tag, int level, struct scsi_cmnd *scmd,
|
|||
struct zfcp_adapter *adapter = (struct zfcp_adapter *)
|
||||
scmd->device->host->hostdata[0];
|
||||
|
||||
if (level <= adapter->dbf->scsi->level)
|
||||
if (debug_level_enabled(adapter->dbf->scsi, level))
|
||||
zfcp_dbf_scsi(tag, scmd, req);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue