From: Vineeth Pillai <[email protected]>

Replace trace_foo() with the new trace_call__foo() at sites already
guarded by trace_foo_enabled(), avoiding a redundant
static_branch_unlikely() re-evaluation inside the tracepoint.
trace_call__foo() calls the tracepoint callbacks directly without
utilizing the static branch again.

Original v2 series:
https://lore.kernel.org/linux-trace-kernel/[email protected]/

Parts of the original v2 series have already been merged in mainline.
This patch is being reposted as a follow-up cleanup for the remaining
unmerged pieces.

Suggested-by: Steven Rostedt <[email protected]>
Suggested-by: Peter Zijlstra <[email protected]>
Signed-off-by: Vineeth Pillai (Google) <[email protected]>
Assisted-by: Claude:claude-sonnet-4-6
---
 drivers/ufs/core/ufshcd.c | 37 +++++++++++++++++++------------------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index c3f08957d179..07f3126d2a94 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -421,8 +421,8 @@ static void ufshcd_add_cmd_upiu_trace(struct ufs_hba *hba,
        else
                header = &lrb->ucd_rsp_ptr->header;
 
-       trace_ufshcd_upiu(hba, str_t, header, &rq->sc.cdb,
-                         UFS_TSF_CDB);
+       trace_call__ufshcd_upiu(hba, str_t, header, &rq->sc.cdb,
+                              UFS_TSF_CDB);
 }
 
 static void ufshcd_add_query_upiu_trace(struct ufs_hba *hba,
@@ -432,8 +432,8 @@ static void ufshcd_add_query_upiu_trace(struct ufs_hba *hba,
        if (!trace_ufshcd_upiu_enabled())
                return;
 
-       trace_ufshcd_upiu(hba, str_t, &rq_rsp->header,
-                         &rq_rsp->qr, UFS_TSF_OSF);
+       trace_call__ufshcd_upiu(hba, str_t, &rq_rsp->header,
+                              &rq_rsp->qr, UFS_TSF_OSF);
 }
 
 static void ufshcd_add_tm_upiu_trace(struct ufs_hba *hba, unsigned int tag,
@@ -445,15 +445,15 @@ static void ufshcd_add_tm_upiu_trace(struct ufs_hba *hba, 
unsigned int tag,
                return;
 
        if (str_t == UFS_TM_SEND)
-               trace_ufshcd_upiu(hba, str_t,
-                                 &descp->upiu_req.req_header,
-                                 &descp->upiu_req.input_param1,
-                                 UFS_TSF_TM_INPUT);
+               trace_call__ufshcd_upiu(hba, str_t,
+                                       &descp->upiu_req.req_header,
+                                       &descp->upiu_req.input_param1,
+                                       UFS_TSF_TM_INPUT);
        else
-               trace_ufshcd_upiu(hba, str_t,
-                                 &descp->upiu_rsp.rsp_header,
-                                 &descp->upiu_rsp.output_param1,
-                                 UFS_TSF_TM_OUTPUT);
+               trace_call__ufshcd_upiu(hba, str_t,
+                                       &descp->upiu_rsp.rsp_header,
+                                       &descp->upiu_rsp.output_param1,
+                                       UFS_TSF_TM_OUTPUT);
 }
 
 static void ufshcd_add_uic_command_trace(struct ufs_hba *hba,
@@ -470,10 +470,10 @@ static void ufshcd_add_uic_command_trace(struct ufs_hba 
*hba,
        else
                cmd = ufshcd_readl(hba, REG_UIC_COMMAND);
 
-       trace_ufshcd_uic_command(hba, str_t, cmd,
-                                ufshcd_readl(hba, REG_UIC_COMMAND_ARG_1),
-                                ufshcd_readl(hba, REG_UIC_COMMAND_ARG_2),
-                                ufshcd_readl(hba, REG_UIC_COMMAND_ARG_3));
+       trace_call__ufshcd_uic_command(hba, str_t, cmd,
+                                      ufshcd_readl(hba, REG_UIC_COMMAND_ARG_1),
+                                      ufshcd_readl(hba, REG_UIC_COMMAND_ARG_2),
+                                      ufshcd_readl(hba, 
REG_UIC_COMMAND_ARG_3));
 }
 
 static void ufshcd_add_command_trace(struct ufs_hba *hba, struct scsi_cmnd 
*cmd,
@@ -522,8 +522,9 @@ static void ufshcd_add_command_trace(struct ufs_hba *hba, 
struct scsi_cmnd *cmd,
        } else {
                doorbell = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL);
        }
-       trace_ufshcd_command(cmd->device, hba, str_t, tag, doorbell, hwq_id,
-                            transfer_len, intr, lba, opcode, group_id);
+       trace_call__ufshcd_command(cmd->device, hba, str_t, tag, doorbell,
+                                  hwq_id, transfer_len, intr, lba, opcode,
+                                  group_id);
 }
 
 static void ufshcd_print_clk_freqs(struct ufs_hba *hba)
-- 
2.54.0


Reply via email to