Skip to content

Commit

Permalink
scsi: ufs: make ufshcd_get_lists_status() register operation obvious
Browse files Browse the repository at this point in the history
It could be just cmp 0xe instead of >>1 and cmp 0x7, with readable code.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Tomohiro Kusumi authored and Martin K. Petersen committed Apr 26, 2017
1 parent d7e2ddd commit 6cf1611
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
11 changes: 1 addition & 10 deletions drivers/scsi/ufs/ufshcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -673,16 +673,7 @@ static inline void ufshcd_outstanding_req_clear(struct ufs_hba *hba, int tag)
*/
static inline int ufshcd_get_lists_status(u32 reg)
{
/*
* The mask 0xFF is for the following HCS register bits
* Bit Description
* 0 Device Present
* 1 UTRLRDY
* 2 UTMRLRDY
* 3 UCRDY
* 4-7 reserved
*/
return ((reg & 0xFF) >> 1) ^ 0x07;
return !((reg & UFSHCD_STATUS_READY) == UFSHCD_STATUS_READY);
}

/**
Expand Down
4 changes: 4 additions & 0 deletions drivers/scsi/ufs/ufshci.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ enum {
#define DEVICE_ERROR_INDICATOR UFS_BIT(5)
#define UIC_POWER_MODE_CHANGE_REQ_STATUS_MASK UFS_MASK(0x7, 8)

#define UFSHCD_STATUS_READY (UTP_TRANSFER_REQ_LIST_READY |\
UTP_TASK_REQ_LIST_READY |\
UIC_COMMAND_READY)

enum {
PWR_OK = 0x0,
PWR_LOCAL = 0x01,
Expand Down

0 comments on commit 6cf1611

Please sign in to comment.