From 8e6a8285668b139460cc6852bfd58fdbd00c7157 Mon Sep 17 00:00:00 2001 From: Hendrik Brueckner Date: Wed, 18 Sep 2013 17:21:34 +0200 Subject: 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 Signed-off-by: Martin Schwidefsky --- drivers/s390/block/scm_blk.h | 2 +- drivers/s390/cio/eadm_sch.c | 2 +- drivers/s390/cio/qdio_debug.h | 8 +------- drivers/s390/crypto/zcrypt_debug.h | 12 +++--------- drivers/s390/net/claw.h | 8 +------- drivers/s390/net/ctcm_dbug.c | 2 +- drivers/s390/net/lcs.h | 8 +------- drivers/s390/net/netiucv.c | 8 +------- drivers/s390/net/qeth_core_main.c | 2 +- drivers/s390/scsi/zfcp_dbf.h | 4 ++-- 10 files changed, 13 insertions(+), 43 deletions(-) diff --git a/drivers/s390/block/scm_blk.h b/drivers/s390/block/scm_blk.h index 8b387b32fd6..e59331e6c2e 100644 --- a/drivers/s390/block/scm_blk.h +++ b/drivers/s390/block/scm_blk.h @@ -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); diff --git a/drivers/s390/cio/eadm_sch.c b/drivers/s390/cio/eadm_sch.c index d9eddcba7e8..6b54d8a05cd 100644 --- a/drivers/s390/cio/eadm_sch.c +++ b/drivers/s390/cio/eadm_sch.c @@ -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); diff --git a/drivers/s390/cio/qdio_debug.h b/drivers/s390/cio/qdio_debug.h index 647b422bb22..dfac9bfefea 100644 --- a/drivers/s390/cio/qdio_debug.h +++ b/drivers/s390/cio/qdio_debug.h @@ -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); \ } \ diff --git a/drivers/s390/crypto/zcrypt_debug.h b/drivers/s390/crypto/zcrypt_debug.h index 841ea72e4a4..28d9349de1a 100644 --- a/drivers/s390/crypto/zcrypt_debug.h +++ b/drivers/s390/crypto/zcrypt_debug.h @@ -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, \ diff --git a/drivers/s390/net/claw.h b/drivers/s390/net/claw.h index 1bc5904df19..3339b9b607b 100644 --- a/drivers/s390/net/claw.h +++ b/drivers/s390/net/claw.h @@ -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); \ diff --git a/drivers/s390/net/ctcm_dbug.c b/drivers/s390/net/ctcm_dbug.c index 6514e1cb3f1..8363f1c966e 100644 --- a/drivers/s390/net/ctcm_dbug.c +++ b/drivers/s390/net/ctcm_dbug.c @@ -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); diff --git a/drivers/s390/net/lcs.h b/drivers/s390/net/lcs.h index 8c03392ac83..150fcb4cebc 100644 --- a/drivers/s390/net/lcs.h +++ b/drivers/s390/net/lcs.h @@ -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); \ } \ diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c index 279ad504ec3..9b333fcf1a4 100644 --- a/drivers/s390/net/netiucv.c +++ b/drivers/s390/net/netiucv.c @@ -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); \ diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 0a328d0d11b..d7b66a28fe7 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c @@ -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); diff --git a/drivers/s390/scsi/zfcp_dbf.h b/drivers/s390/scsi/zfcp_dbf.h index 3ac7a4b30dd..0be3d48681a 100644 --- a/drivers/s390/scsi/zfcp_dbf.h +++ b/drivers/s390/scsi/zfcp_dbf.h @@ -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); } -- cgit v1.2.3-18-g5258