From: Jie Liu <[email protected]> sxe2_drv_cmd_params_fill() passes the opcode string as a parameter to __sxe2_drv_cmd_params_fill() just to emit a debug log. The debug log is level-gated by PMD_DEV_LOG_DEBUG either way; moving it into the macro body only consolidates the call sites.
Wrap the log and the fill helper in a do/while block, dropping the opc_str parameter so the opcode stringization happens at the call site. Evaluate the adapter argument exactly once through a local variable. Cc: [email protected] Signed-off-by: Jie Liu <[email protected]> --- drivers/net/sxe2/sxe2_cmd_chnl.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/sxe2/sxe2_cmd_chnl.c b/drivers/net/sxe2/sxe2_cmd_chnl.c index 16a2c3fea4..84fe401ec4 100644 --- a/drivers/net/sxe2/sxe2_cmd_chnl.c +++ b/drivers/net/sxe2/sxe2_cmd_chnl.c @@ -26,10 +26,9 @@ static void sxe2_drv_trace_id_alloc(uint64_t *trace_id) } static void __sxe2_drv_cmd_params_fill(struct sxe2_adapter *adapter, - struct sxe2_drv_cmd_params *cmd, uint32_t opc, const char *opc_str, + struct sxe2_drv_cmd_params *cmd, uint32_t opc, void *in_data, uint32_t in_len, void *out_data, uint32_t out_len) { - PMD_DEV_LOG_DEBUG(adapter, DRV, "cmd opcode:%s", opc_str); cmd->timeout = SXE2_DRV_CMD_DFLT_TIMEOUT; cmd->opcode = opc; cmd->vsi_id = adapter->vsi_ctxt.dpdk_vsi_id; @@ -44,8 +43,11 @@ static void __sxe2_drv_cmd_params_fill(struct sxe2_adapter *adapter, } #define sxe2_drv_cmd_params_fill(adapter, cmd, opc, in_data, in_len, out_data, out_len) \ - __sxe2_drv_cmd_params_fill(adapter, cmd, opc, #opc, in_data, in_len, out_data, out_len) - + do { \ + struct sxe2_adapter *__adapter = (adapter); \ + PMD_DEV_LOG_DEBUG(__adapter, DRV, "cmd opcode:%s", #opc); \ + __sxe2_drv_cmd_params_fill(__adapter, cmd, opc, in_data, in_len, out_data, out_len); \ + } while (0) int32_t sxe2_drv_dev_caps_get(struct sxe2_adapter *adapter, struct sxe2_drv_dev_caps_resp *dev_caps) { -- 2.52.0

