mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
UPSTREAM: scsi: ufs: core: Improve static type checking
Introduce an enumeration type for the overall command status to allow the
compiler to perform more static type checking.
Link: https://lore.kernel.org/r/20211020214024.2007615-4-bvanassche@acm.org
Acked-by: Avri Altman <Avri.Altman@wdc.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bug: 234653003
(cherry picked from commit 957d63e77a)
Change-Id: I53eeb670f25ffbe54e25f5c78bf0efda11cd1856
Signed-off-by: Bart Van Assche <bvanassche@google.com>
This commit is contained in:
committed by
Bart Van Assche
parent
f8f72543eb
commit
cd3c13a13f
@@ -730,7 +730,7 @@ static inline bool ufshcd_is_device_present(struct ufs_hba *hba)
|
||||
* This function is used to get the OCS field from UTRD
|
||||
* Returns the OCS field in the UTRD
|
||||
*/
|
||||
static inline int ufshcd_get_tr_ocs(struct ufshcd_lrb *lrbp)
|
||||
static enum utp_ocs ufshcd_get_tr_ocs(struct ufshcd_lrb *lrbp)
|
||||
{
|
||||
return le32_to_cpu(lrbp->utr_descriptor_ptr->header.dword_2) & MASK_OCS;
|
||||
}
|
||||
@@ -5160,7 +5160,7 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
|
||||
{
|
||||
int result = 0;
|
||||
int scsi_status;
|
||||
int ocs;
|
||||
enum utp_ocs ocs;
|
||||
|
||||
/* overall command status of utrd */
|
||||
ocs = ufshcd_get_tr_ocs(lrbp);
|
||||
@@ -6702,7 +6702,8 @@ static int ufshcd_issue_tm_cmd(struct ufs_hba *hba, int lun_id, int task_id,
|
||||
u8 tm_function, u8 *tm_response)
|
||||
{
|
||||
struct utp_task_req_desc treq = { { 0 }, };
|
||||
int ocs_value, err;
|
||||
enum utp_ocs ocs_value;
|
||||
int err;
|
||||
|
||||
/* Configure task request descriptor */
|
||||
treq.header.dword_0 = cpu_to_le32(UTP_REQ_DESC_INT_CMD);
|
||||
@@ -6865,7 +6866,7 @@ int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba,
|
||||
int err;
|
||||
enum dev_cmd_type cmd_type = DEV_CMD_TYPE_QUERY;
|
||||
struct utp_task_req_desc treq = { { 0 }, };
|
||||
int ocs_value;
|
||||
enum utp_ocs ocs_value;
|
||||
u8 tm_f = be32_to_cpu(req_upiu->header.dword_1) >> 16 & MASK_TM_FUNC;
|
||||
|
||||
switch (msgcode) {
|
||||
|
||||
@@ -390,7 +390,7 @@ enum {
|
||||
};
|
||||
|
||||
/* Overall command status values */
|
||||
enum {
|
||||
enum utp_ocs {
|
||||
OCS_SUCCESS = 0x0,
|
||||
OCS_INVALID_CMD_TABLE_ATTR = 0x1,
|
||||
OCS_INVALID_PRDT_ATTR = 0x2,
|
||||
@@ -403,6 +403,9 @@ enum {
|
||||
OCS_INVALID_CRYPTO_CONFIG = 0x9,
|
||||
OCS_GENERAL_CRYPTO_ERROR = 0xA,
|
||||
OCS_INVALID_COMMAND_STATUS = 0x0F,
|
||||
};
|
||||
|
||||
enum {
|
||||
MASK_OCS = 0x0F,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user