hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/arch/riscv/lib/delay.c
....@@ -1,14 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2012 Regents of the University of California
3
- *
4
- * This program is free software; you can redistribute it and/or
5
- * modify it under the terms of the GNU General Public License
6
- * as published by the Free Software Foundation, version 2.
7
- *
8
- * This program is distributed in the hope that it will be useful,
9
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- * GNU General Public License for more details.
124 */
135
146 #include <linux/delay.h>
....@@ -89,9 +81,13 @@
8981 void udelay(unsigned long usecs)
9082 {
9183 u64 ucycles = (u64)usecs * lpj_fine * UDELAY_MULT;
84
+ u64 n;
9285
9386 if (unlikely(usecs > MAX_UDELAY_US)) {
94
- __delay((u64)usecs * riscv_timebase / 1000000ULL);
87
+ n = (u64)usecs * riscv_timebase;
88
+ do_div(n, 1000000);
89
+
90
+ __delay(n);
9591 return;
9692 }
9793