[PATCH 1/2] scsi: lpfc: Neaten logging macro #defines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
---
 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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux