[PATCH v2 3/6] scsi: ufs: Don't call trace_ufshcd_upiu() in case trace poit is disabled

From: Bean Huo
Date: Mon Dec 14 2020 - 11:16:53 EST


From: Bean Huo <beanhuo@xxxxxxxxxx>

Don't call trace_ufshcd_upiu() in case ufshba_upiu trace poit is not enabled.

Suggested-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
Signed-off-by: Bean Huo <beanhuo@xxxxxxxxxx>
---
drivers/scsi/ufs/ufshcd.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index f7ebecb4af1a..da677147755d 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -312,6 +312,9 @@ static void ufshcd_add_cmd_upiu_trace(struct ufs_hba *hba, unsigned int tag,
{
struct utp_upiu_req *rq = hba->lrb[tag].ucd_req_ptr;

+ if (!trace_ufshcd_upiu_enabled())
+ return;
+
trace_ufshcd_upiu(dev_name(hba->dev), str_t, &rq->header, &rq->sc.cdb);
}

@@ -320,6 +323,9 @@ static void ufshcd_add_query_upiu_trace(struct ufs_hba *hba, unsigned int tag,
{
struct utp_upiu_req *rq = hba->lrb[tag].ucd_req_ptr;

+ if (!trace_ufshcd_upiu_enabled())
+ return;
+
trace_ufshcd_upiu(dev_name(hba->dev), str_t, &rq->header, &rq->qr);
}

@@ -329,6 +335,9 @@ static void ufshcd_add_tm_upiu_trace(struct ufs_hba *hba, unsigned int tag,
int off = (int)tag - hba->nutrs;
struct utp_task_req_desc *descp = &hba->utmrdl_base_addr[off];

+ if (!trace_ufshcd_upiu_enabled())
+ return;
+
trace_ufshcd_upiu(dev_name(hba->dev), str_t, &descp->req_header,
&descp->input_param1);
}
--
2.17.1