lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <950ff7825aa294397725d9142b1a65298e8aa026.1597100152.git.joe@perches.com>
Date:   Mon, 10 Aug 2020 15:59:19 -0700
From:   Joe Perches <joe@...ches.com>
To:     James Smart <james.smart@...adcom.com>,
        Dick Kennedy <dick.kennedy@...adcom.com>
Cc:     "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] scsi: lpfc: Neaten logging macro #defines

Use kernel standard do {} while (0) logging macros

Miscellanea:

o Use ..., ##__VA_ARGS__
o Indent and align
o Add __printf(2, 3) to lpfc_dbg_print function declaration

Signed-off-by: Joe Perches <joe@...ches.com>
---
 drivers/scsi/lpfc/lpfc_logmsg.h | 85 +++++++++++++++++++--------------
 1 file changed, 48 insertions(+), 37 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_logmsg.h b/drivers/scsi/lpfc/lpfc_logmsg.h
index 5660a8729462..c57adcdda258 100644
--- a/drivers/scsi/lpfc/lpfc_logmsg.h
+++ b/drivers/scsi/lpfc/lpfc_logmsg.h
@@ -48,49 +48,60 @@
 #define LOG_ALL_MSG	0x7fffffff	/* LOG all messages */
 
 void lpfc_dmp_dbg(struct lpfc_hba *phba);
+__printf(2, 3)
 void lpfc_dbg_print(struct lpfc_hba *phba, const char *fmt, ...);
 
 /* generate message by verbose log setting or severity */
-#define lpfc_vlog_msg(vport, level, mask, fmt, arg...) \
-{ if (((mask) & (vport)->cfg_log_verbose) || (level[1] <= '4')) \
-	dev_printk(level, &((vport)->phba->pcidev)->dev, "%d:(%d):" \
-		   fmt, (vport)->phba->brd_no, vport->vpi, ##arg); }
+#define lpfc_vlog_msg(vport, level, mask, fmt, ...)			\
+do {									\
+	if (((mask) & (vport)->cfg_log_verbose) || (level[1] <= '4'))	\
+		dev_printk(level, &((vport)->phba->pcidev)->dev,	\
+			   "%d:(%d):" fmt,				\
+			   (vport)->phba->brd_no, vport->vpi,		\
+			   ##__VA_ARGS__);				\
+} while (0)
 
-#define lpfc_log_msg(phba, level, mask, fmt, arg...) \
-do { \
-	{ uint32_t log_verbose = (phba)->pport ? \
-				 (phba)->pport->cfg_log_verbose : \
-				 (phba)->cfg_log_verbose; \
-	if (((mask) & log_verbose) || (level[1] <= '4')) \
-		dev_printk(level, &((phba)->pcidev)->dev, "%d:" \
-			   fmt, phba->brd_no, ##arg); \
-	} \
+#define lpfc_log_msg(phba, level, mask, fmt, ...)			\
+do {									\
+	uint32_t log_verbose = (phba)->pport ?				\
+		(phba)->pport->cfg_log_verbose :			\
+		(phba)->cfg_log_verbose;				\
+	if (((mask) & log_verbose) || (level[1] <= '4'))		\
+		dev_printk(level, &((phba)->pcidev)->dev,		\
+			   "%d:" fmt,					\
+			   phba->brd_no, ##__VA_ARGS__);		\
 } while (0)
 
-#define lpfc_printf_vlog(vport, level, mask, fmt, arg...) \
-do { \
-	{ if (((mask) & (vport)->cfg_log_verbose) || (level[1] <= '3')) { \
-		if ((mask) & LOG_TRACE_EVENT) \
-			lpfc_dmp_dbg((vport)->phba); \
-		dev_printk(level, &((vport)->phba->pcidev)->dev, "%d:(%d):" \
-			   fmt, (vport)->phba->brd_no, vport->vpi, ##arg);  \
-		} else if (!(vport)->cfg_log_verbose) \
-			lpfc_dbg_print((vport)->phba, "%d:(%d):" fmt, \
-				(vport)->phba->brd_no, (vport)->vpi, ##arg); \
-	} \
+#define lpfc_printf_vlog(vport, level, mask, fmt, ...)			\
+do {									\
+	if (((mask) & (vport)->cfg_log_verbose) || (level[1] <= '3')) { \
+		if ((mask) & LOG_TRACE_EVENT)				\
+			lpfc_dmp_dbg((vport)->phba);			\
+		dev_printk(level, &((vport)->phba->pcidev)->dev,	\
+			   "%d:(%d):" fmt,				\
+			   (vport)->phba->brd_no, vport->vpi,		\
+			   ##__VA_ARGS__);				\
+	} else if (!(vport)->cfg_log_verbose) {				\
+		lpfc_dbg_print((vport)->phba,				\
+			       "%d:(%d):" fmt,				\
+			       (vport)->phba->brd_no, (vport)->vpi,	\
+			       ##__VA_ARGS__);				\
+	}								\
 } while (0)
 
-#define lpfc_printf_log(phba, level, mask, fmt, arg...) \
-do { \
-	{ uint32_t log_verbose = (phba)->pport ? \
-				 (phba)->pport->cfg_log_verbose : \
-				 (phba)->cfg_log_verbose; \
-	if (((mask) & log_verbose) || (level[1] <= '3')) { \
-		if ((mask) & LOG_TRACE_EVENT) \
-			lpfc_dmp_dbg(phba); \
-		dev_printk(level, &((phba)->pcidev)->dev, "%d:" \
-			fmt, phba->brd_no, ##arg); \
-	} else  if (!(phba)->cfg_log_verbose)\
-		lpfc_dbg_print(phba, "%d:" fmt, phba->brd_no, ##arg); \
-	} \
+#define lpfc_printf_log(phba, level, mask, fmt, ...)			\
+do {									\
+	uint32_t log_verbose = (phba)->pport ?				\
+		(phba)->pport->cfg_log_verbose :			\
+		(phba)->cfg_log_verbose;				\
+	if (((mask) & log_verbose) || (level[1] <= '3')) {		\
+		if ((mask) & LOG_TRACE_EVENT)				\
+			lpfc_dmp_dbg(phba);				\
+		dev_printk(level, &((phba)->pcidev)->dev,		\
+			   "%d:" fmt,					\
+			   phba->brd_no, ##__VA_ARGS__);		\
+	} else if (!(phba)->cfg_log_verbose) {				\
+		lpfc_dbg_print(phba, "%d:" fmt,				\
+			       phba->brd_no, ##__VA_ARGS__);		\
+	}								\
 } while (0)
-- 
2.26.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ