Commit 08108d31 authored by Bart Van Assche's avatar Bart Van Assche Committed by Martin K. Petersen

scsi: ufs: Improve type safety

Assign names to the enumeration types for UPIU types. Use these enumeration
types where appropriate.
Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230727194457.3152309-8-bvanassche@acm.orgSigned-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent f99533bd
...@@ -93,7 +93,7 @@ int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd); ...@@ -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, int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba,
struct utp_upiu_req *req_upiu, struct utp_upiu_req *req_upiu,
struct utp_upiu_req *rsp_upiu, struct utp_upiu_req *rsp_upiu,
int msgcode, enum upiu_request_transaction msgcode,
u8 *desc_buff, int *buff_len, u8 *desc_buff, int *buff_len,
enum query_opcode desc_op); enum query_opcode desc_op);
......
...@@ -879,7 +879,7 @@ static inline u32 ufshcd_get_dme_attr_val(struct ufs_hba *hba) ...@@ -879,7 +879,7 @@ static inline u32 ufshcd_get_dme_attr_val(struct ufs_hba *hba)
* *
* Return: UPIU type. * Return: UPIU type.
*/ */
static inline int static inline enum upiu_response_transaction
ufshcd_get_req_rsp(struct utp_upiu_rsp *ucd_rsp_ptr) ufshcd_get_req_rsp(struct utp_upiu_rsp *ucd_rsp_ptr)
{ {
return be32_to_cpu(ucd_rsp_ptr->header.dword_0) >> 24; 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) ...@@ -3032,7 +3032,7 @@ ufshcd_check_query_response(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
static int static int
ufshcd_dev_cmd_completion(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) ufshcd_dev_cmd_completion(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
{ {
int resp; enum upiu_response_transaction resp;
int err = 0; int err = 0;
hba->ufs_stats.last_hibern8_exit_tstamp = ktime_set(0, 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, ...@@ -5271,9 +5271,8 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp,
switch (ocs) { switch (ocs) {
case OCS_SUCCESS: case OCS_SUCCESS:
result = ufshcd_get_req_rsp(lrbp->ucd_rsp_ptr);
hba->ufs_stats.last_hibern8_exit_tstamp = ktime_set(0, 0); 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: case UPIU_TRANSACTION_RESPONSE:
/* /*
* get the response UPIU result to extract * get the response UPIU result to extract
...@@ -7199,7 +7198,7 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba, ...@@ -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, int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba,
struct utp_upiu_req *req_upiu, struct utp_upiu_req *req_upiu,
struct utp_upiu_req *rsp_upiu, struct utp_upiu_req *rsp_upiu,
int msgcode, enum upiu_request_transaction msgcode,
u8 *desc_buff, int *buff_len, u8 *desc_buff, int *buff_len,
enum query_opcode desc_op) enum query_opcode desc_op)
{ {
......
...@@ -78,7 +78,7 @@ enum { ...@@ -78,7 +78,7 @@ enum {
}; };
/* UTP UPIU Transaction Codes Initiator to Target */ /* UTP UPIU Transaction Codes Initiator to Target */
enum { enum upiu_request_transaction {
UPIU_TRANSACTION_NOP_OUT = 0x00, UPIU_TRANSACTION_NOP_OUT = 0x00,
UPIU_TRANSACTION_COMMAND = 0x01, UPIU_TRANSACTION_COMMAND = 0x01,
UPIU_TRANSACTION_DATA_OUT = 0x02, UPIU_TRANSACTION_DATA_OUT = 0x02,
...@@ -87,7 +87,7 @@ enum { ...@@ -87,7 +87,7 @@ enum {
}; };
/* UTP UPIU Transaction Codes Target to Initiator */ /* UTP UPIU Transaction Codes Target to Initiator */
enum { enum upiu_response_transaction {
UPIU_TRANSACTION_NOP_IN = 0x20, UPIU_TRANSACTION_NOP_IN = 0x20,
UPIU_TRANSACTION_RESPONSE = 0x21, UPIU_TRANSACTION_RESPONSE = 0x21,
UPIU_TRANSACTION_DATA_IN = 0x22, UPIU_TRANSACTION_DATA_IN = 0x22,
......
...@@ -1357,12 +1357,6 @@ int ufshcd_get_vreg(struct device *dev, struct ufs_vreg *vreg); ...@@ -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_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, 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 utp_upiu_req *rsp_upiu, struct ufs_ehs *ehs_req,
struct ufs_ehs *ehs_rsp, int sg_cnt, struct ufs_ehs *ehs_rsp, int sg_cnt,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment