Skip to content

Commit

Permalink
scsi: ufs: Invert the return value of ufshcd_is_hba_active()
Browse files Browse the repository at this point in the history
It is confusing that ufshcd_is_hba_active() returns 'true' if the HBA is
not active. Clear up this confusion by inverting the return value of
ufshcd_is_hba_active(). This patch does not change any functionality.

Link: https://lore.kernel.org/r/[email protected]
Tested-by: Bean Huo <[email protected]>
Reviewed-by: Avri Altman <[email protected]>
Reviewed-by: Bean Huo <[email protected]>
Signed-off-by: Bart Van Assche <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
  • Loading branch information
bvanassche authored and martinkpetersen committed Apr 26, 2022
1 parent aead21f commit acbbfe4
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/scsi/ufs/ufshcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -917,12 +917,11 @@ static inline void ufshcd_hba_start(struct ufs_hba *hba)
* ufshcd_is_hba_active - Get controller state
* @hba: per adapter instance
*
* Returns false if controller is active, true otherwise
* Returns true if and only if the controller is active.
*/
static inline bool ufshcd_is_hba_active(struct ufs_hba *hba)
{
return (ufshcd_readl(hba, REG_CONTROLLER_ENABLE) & CONTROLLER_ENABLE)
? false : true;
return ufshcd_readl(hba, REG_CONTROLLER_ENABLE) & CONTROLLER_ENABLE;
}

u32 ufshcd_get_local_unipro_ver(struct ufs_hba *hba)
Expand Down Expand Up @@ -4552,7 +4551,7 @@ static int ufshcd_hba_execute_hce(struct ufs_hba *hba)
int retry_inner;

start:
if (!ufshcd_is_hba_active(hba))
if (ufshcd_is_hba_active(hba))
/* change controller state to "reset state" */
ufshcd_hba_stop(hba);

Expand All @@ -4578,7 +4577,7 @@ static int ufshcd_hba_execute_hce(struct ufs_hba *hba)

/* wait for the host controller to complete initialization */
retry_inner = 50;
while (ufshcd_is_hba_active(hba)) {
while (!ufshcd_is_hba_active(hba)) {
if (retry_inner) {
retry_inner--;
} else {
Expand Down

0 comments on commit acbbfe4

Please sign in to comment.