All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: "Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, Avri Altman <avri.altman@wdc.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Bart Van Assche <bvanassche@acm.org>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	Can Guo <quic_cang@quicinc.com>,
	Stanley Chu <stanley.chu@mediatek.com>,
	Manivannan Sadhasivam <mani@kernel.org>,
	Asutosh Das <quic_asutoshd@quicinc.com>,
	"Bao D. Nguyen" <quic_nguyenb@quicinc.com>,
	Arthur Simchaev <Arthur.Simchaev@wdc.com>,
	Bean Huo <beanhuo@micron.com>, zhanghui <zhanghui31@xiaomi.com>,
	Po-Wen Kao <powen.kao@mediatek.com>,
	Eric Biggers <ebiggers@google.com>,
	Keoseong Park <keosung.park@samsung.com>,
	Daniil Lunev <dlunev@chromium.org>
Subject: [PATCH v2 07/12] scsi: ufs: Improve type safety
Date: Thu, 27 Jul 2023 12:41:19 -0700	[thread overview]
Message-ID: <20230727194457.3152309-8-bvanassche@acm.org> (raw)
In-Reply-To: <20230727194457.3152309-1-bvanassche@acm.org>

Assign names to the enumeration types for UPIU types. Use these
enumeration types where appropriate.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/ufs/core/ufshcd-priv.h | 2 +-
 drivers/ufs/core/ufshcd.c      | 9 ++++-----
 include/ufs/ufs.h              | 4 ++--
 include/ufs/ufshcd.h           | 6 ------
 4 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/drivers/ufs/core/ufshcd-priv.h b/drivers/ufs/core/ufshcd-priv.h
index 4feccd5c1ba2..f42d99ce5bf1 100644
--- a/drivers/ufs/core/ufshcd-priv.h
+++ b/drivers/ufs/core/ufshcd-priv.h
@@ -93,7 +93,7 @@ int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd);
 int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba,
 			     struct utp_upiu_req *req_upiu,
 			     struct utp_upiu_req *rsp_upiu,
-			     int msgcode,
+			     enum upiu_request_transaction msgcode,
 			     u8 *desc_buff, int *buff_len,
 			     enum query_opcode desc_op);
 
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 5e248c60f887..19c210ef74f5 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -879,7 +879,7 @@ static inline u32 ufshcd_get_dme_attr_val(struct ufs_hba *hba)
  *
  * Return: UPIU type.
  */
-static inline int
+static inline enum upiu_response_transaction
 ufshcd_get_req_rsp(struct utp_upiu_rsp *ucd_rsp_ptr)
 {
 	return be32_to_cpu(ucd_rsp_ptr->header.dword_0) >> 24;
@@ -3032,7 +3032,7 @@ ufshcd_check_query_response(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
 static int
 ufshcd_dev_cmd_completion(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
 {
-	int resp;
+	enum upiu_response_transaction resp;
 	int err = 0;
 
 	hba->ufs_stats.last_hibern8_exit_tstamp = ktime_set(0, 0);
@@ -5271,9 +5271,8 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp,
 
 	switch (ocs) {
 	case OCS_SUCCESS:
-		result = ufshcd_get_req_rsp(lrbp->ucd_rsp_ptr);
 		hba->ufs_stats.last_hibern8_exit_tstamp = ktime_set(0, 0);
-		switch (result) {
+		switch (ufshcd_get_req_rsp(lrbp->ucd_rsp_ptr)) {
 		case UPIU_TRANSACTION_RESPONSE:
 			/*
 			 * get the response UPIU result to extract
@@ -7199,7 +7198,7 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba,
 int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba,
 			     struct utp_upiu_req *req_upiu,
 			     struct utp_upiu_req *rsp_upiu,
-			     int msgcode,
+			     enum upiu_request_transaction msgcode,
 			     u8 *desc_buff, int *buff_len,
 			     enum query_opcode desc_op)
 {
diff --git a/include/ufs/ufs.h b/include/ufs/ufs.h
index 0fb733683953..797bf033c19a 100644
--- a/include/ufs/ufs.h
+++ b/include/ufs/ufs.h
@@ -78,7 +78,7 @@ enum {
 };
 
 /* UTP UPIU Transaction Codes Initiator to Target */
-enum {
+enum upiu_request_transaction {
 	UPIU_TRANSACTION_NOP_OUT	= 0x00,
 	UPIU_TRANSACTION_COMMAND	= 0x01,
 	UPIU_TRANSACTION_DATA_OUT	= 0x02,
@@ -87,7 +87,7 @@ enum {
 };
 
 /* UTP UPIU Transaction Codes Target to Initiator */
-enum {
+enum upiu_response_transaction {
 	UPIU_TRANSACTION_NOP_IN		= 0x20,
 	UPIU_TRANSACTION_RESPONSE	= 0x21,
 	UPIU_TRANSACTION_DATA_IN	= 0x22,
diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
index 67bd089e70bc..2b1f4f2a4464 100644
--- a/include/ufs/ufshcd.h
+++ b/include/ufs/ufshcd.h
@@ -1357,12 +1357,6 @@ int ufshcd_get_vreg(struct device *dev, struct ufs_vreg *vreg);
 
 int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd);
 
-int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba,
-			     struct utp_upiu_req *req_upiu,
-			     struct utp_upiu_req *rsp_upiu,
-			     int msgcode,
-			     u8 *desc_buff, int *buff_len,
-			     enum query_opcode desc_op);
 int ufshcd_advanced_rpmb_req_handler(struct ufs_hba *hba, struct utp_upiu_req *req_upiu,
 				     struct utp_upiu_req *rsp_upiu, struct ufs_ehs *ehs_req,
 				     struct ufs_ehs *ehs_rsp, int sg_cnt,

  parent reply	other threads:[~2023-07-27 19:47 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27 19:41 [PATCH v2 00/12] Multiple cleanup patches for the UFS driver Bart Van Assche
2023-07-27 19:41 ` [PATCH v2 01/12] scsi: ufs: Follow the kernel-doc syntax for documenting return values Bart Van Assche
2023-07-27 19:41 ` [PATCH v2 02/12] scsi: ufs: Document all " Bart Van Assche
2023-07-27 19:41 ` [PATCH v2 03/12] scsi: ufs: Fix kernel-doc headers Bart Van Assche
2023-07-27 19:41 ` [PATCH v2 04/12] scsi: ufs: Rename a function argument Bart Van Assche
2023-07-27 19:41 ` [PATCH v2 05/12] scsi: ufs: Minimize #include directives Bart Van Assche
2023-07-27 19:41 ` [PATCH v2 06/12] scsi: ufs: Simplify zero-initialization Bart Van Assche
2023-07-27 19:41 ` Bart Van Assche [this message]
2023-07-27 19:41 ` [PATCH v2 08/12] scsi: ufs: Remove a local variable from ufshcd_abort_all() Bart Van Assche
2023-07-27 19:41 ` [PATCH v2 09/12] scsi: ufs: Simplify ufshcd_abort_all() Bart Van Assche
2023-11-15  6:57   ` Peter Wang (王信友)
2023-11-15 19:13     ` Bart Van Assche
2023-07-27 19:41 ` [PATCH v2 10/12] scsi: ufs: Remove a member variable Bart Van Assche
2023-07-27 19:41 ` [PATCH v2 11/12] scsi: ufs: Simplify transfer request header initialization Bart Van Assche
2023-07-28 13:40   ` Avri Altman
2023-08-02 11:25   ` Kumar, Udit
2023-08-02 16:05     ` Bart Van Assche
2023-08-02 16:44       ` Kumar, Udit
2023-08-02 16:46         ` Bart Van Assche
2023-07-27 19:41 ` [PATCH v2 12/12] scsi: ufs: Simplify response header parsing Bart Van Assche
2023-07-28 13:54   ` Avri Altman
2023-07-31 19:19 ` [PATCH v2 00/12] Multiple cleanup patches for the UFS driver Martin K. Petersen
2023-08-08  2:50 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230727194457.3152309-8-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=Arthur.Simchaev@wdc.com \
    --cc=adrian.hunter@intel.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=dlunev@chromium.org \
    --cc=ebiggers@google.com \
    --cc=jejb@linux.ibm.com \
    --cc=keosung.park@samsung.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=powen.kao@mediatek.com \
    --cc=quic_asutoshd@quicinc.com \
    --cc=quic_cang@quicinc.com \
    --cc=quic_nguyenb@quicinc.com \
    --cc=stanley.chu@mediatek.com \
    --cc=zhanghui31@xiaomi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.