scsi: ufs: Make ufshcd_wait_for_register() sleep instead of busy-waiting
authorBart Van Assche <bvanassche@acm.org>
Thu, 7 May 2020 22:27:50 +0000 (15:27 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 20 May 2020 01:03:07 +0000 (21:03 -0400)
commit5cac1095cf289f7623f835a9212b9ec0ad3b85b3
tree097ea26424ddf2b3ad5ac2182bf4279131f325f6
parentd0b1e4a638d670a09f42017a3e567dc846931ba8
scsi: ufs: Make ufshcd_wait_for_register() sleep instead of busy-waiting

The ufshcd_wait_for_register() function either sleeps or spins until the
specified register has reached the desired value. Busy-waiting is not only
considered a bad practice but also has a bad impact on energy
consumption. Always sleep instead of spinning by making sure that all
ufshcd_wait_for_register() calls happen from a context where it is allowed
to sleep. The only function call that has to be moved is the
ufshcd_hba_stop() call in ufshcd_host_reset_and_restore().

Link: https://lore.kernel.org/r/20200507222750.19113-1-bvanassche@acm.org
Cc: Can Guo <cang@codeaurora.org>
Cc: Avri Altman <avri.altman@wdc.com>
Cc: Bean Huo <beanhuo@micron.com>
Cc: Alim Akhtar <alim.akhtar@samsung.com>
Cc: Asutosh Das <asutoshd@codeaurora.org>
Tested-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufshcd.c
drivers/scsi/ufs/ufshcd.h