scsi: ufs: core: Do not open code read_poll_timeout
ufshcd_wait_for_register() practically does just that - replace with read_poll_timeout. Signed-off-by: Avri Altman <avri.altman@wdc.com> Link: https://lore.kernel.org/r/20240919112442.48491-1-avri.altman@wdc.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
committed by
Martin K. Petersen
parent
09822c231a
commit
71ef4e6b05
@@ -739,25 +739,15 @@ EXPORT_SYMBOL_GPL(ufshcd_delay_us);
|
||||
* Return: -ETIMEDOUT on error, zero on success.
|
||||
*/
|
||||
static int ufshcd_wait_for_register(struct ufs_hba *hba, u32 reg, u32 mask,
|
||||
u32 val, unsigned long interval_us,
|
||||
unsigned long timeout_ms)
|
||||
u32 val, unsigned long interval_us,
|
||||
unsigned long timeout_ms)
|
||||
{
|
||||
int err = 0;
|
||||
unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms);
|
||||
u32 v;
|
||||
|
||||
/* ignore bits that we don't intend to wait on */
|
||||
val = val & mask;
|
||||
val &= mask; /* ignore bits that we don't intend to wait on */
|
||||
|
||||
while ((ufshcd_readl(hba, reg) & mask) != val) {
|
||||
usleep_range(interval_us, interval_us + 50);
|
||||
if (time_after(jiffies, timeout)) {
|
||||
if ((ufshcd_readl(hba, reg) & mask) != val)
|
||||
err = -ETIMEDOUT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
return read_poll_timeout(ufshcd_readl, v, (v & mask) == val,
|
||||
interval_us, timeout_ms * 1000, false, hba, reg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user