diff options
author | Arnd Bergmann <arnd@arndb.de> | 2021-10-18 15:20:01 +0200 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2021-10-20 23:09:58 -0400 |
commit | bb4a8dcb4e9498deccaf7b257449044968e514c7 (patch) | |
tree | a7bd7a828350d7d4e9570c52172e728dc78db6d7 /drivers | |
parent | 0ae8f4785107eb7f63ac17d86d894be681427dd2 (diff) | |
download | linux-bb4a8dcb4e9498deccaf7b257449044968e514c7.tar.gz linux-bb4a8dcb4e9498deccaf7b257449044968e514c7.tar.bz2 linux-bb4a8dcb4e9498deccaf7b257449044968e514c7.zip |
scsi: ufs: mediatek: Avoid sched_clock() misuse
sched_clock() is not meant to be used in portable driver code, and assuming
a particular clock frequency is not how this is meant to be used. It also
causes a build failure because of a missing header inclusion:
drivers/scsi/ufs/ufs-mediatek.c:321:12: error: implicit declaration of function 'sched_clock' [-Werror,-Wimplicit-function-declaration]
timeout = sched_clock() + retry_ms * 1000000UL;
A better interface to use here ktime_get_mono_fast_ns(), which works mostly
like ktime_get() but is safe to use inside of a suspend callback.
Link: https://lore.kernel.org/r/20211018132022.2281589-1-arnd@kernel.org
Fixes: 9561f58442e4 ("scsi: ufs: mediatek: Support vops pre suspend to disable auto-hibern8")
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/ufs/ufs-mediatek.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c index d0a8e1319ab3..fc5b214347b3 100644 --- a/drivers/scsi/ufs/ufs-mediatek.c +++ b/drivers/scsi/ufs/ufs-mediatek.c @@ -319,15 +319,15 @@ static void ufs_mtk_wait_idle_state(struct ufs_hba *hba, u32 val, sm; bool wait_idle; - timeout = sched_clock() + retry_ms * 1000000UL; - + /* cannot use plain ktime_get() in suspend */ + timeout = ktime_get_mono_fast_ns() + retry_ms * 1000000UL; /* wait a specific time after check base */ udelay(10); wait_idle = false; do { - time_checked = sched_clock(); + time_checked = ktime_get_mono_fast_ns(); ufs_mtk_dbg_sel(hba); val = ufshcd_readl(hba, REG_UFS_PROBE); |