@@ -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)
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@perches.com> --- drivers/scsi/lpfc/lpfc_logmsg.h | 85 +++++++++++++++++++-------------- 1 file changed, 48 insertions(+), 37 deletions(-)