Skip to content

Commit bb4a8dc

Browse files
arndbmartinkpetersen
authored andcommitted
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/[email protected] Fixes: 9561f58 ("scsi: ufs: mediatek: Support vops pre suspend to disable auto-hibern8") Reviewed-by: Stanley Chu <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 0ae8f47 commit bb4a8dc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/scsi/ufs/ufs-mediatek.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,15 +319,15 @@ static void ufs_mtk_wait_idle_state(struct ufs_hba *hba,
319319
u32 val, sm;
320320
bool wait_idle;
321321

322-
timeout = sched_clock() + retry_ms * 1000000UL;
323-
322+
/* cannot use plain ktime_get() in suspend */
323+
timeout = ktime_get_mono_fast_ns() + retry_ms * 1000000UL;
324324

325325
/* wait a specific time after check base */
326326
udelay(10);
327327
wait_idle = false;
328328

329329
do {
330-
time_checked = sched_clock();
330+
time_checked = ktime_get_mono_fast_ns();
331331
ufs_mtk_dbg_sel(hba);
332332
val = ufshcd_readl(hba, REG_UFS_PROBE);
333333

0 commit comments

Comments
 (0)