summaryrefslogtreecommitdiffstats
path: root/arch/riscv
diff options
context:
space:
mode:
authorPaul Walmsley2019-08-07 03:28:33 +0200
committerPaul Walmsley2019-08-09 01:05:38 +0200
commit66cc016ab7c780d53450fd1648010da02ddf2770 (patch)
tree2b30cec4d28347b7787c8239a0d4d5d9fdd1801b /arch/riscv
parentdt-bindings: Update the riscv,isa string description (diff)
downloadkernel-qcow2-linux-66cc016ab7c780d53450fd1648010da02ddf2770.tar.gz
kernel-qcow2-linux-66cc016ab7c780d53450fd1648010da02ddf2770.tar.xz
kernel-qcow2-linux-66cc016ab7c780d53450fd1648010da02ddf2770.zip
riscv: delay: use do_div() instead of __udivdi3()
In preparation for removing __udivdi3() from the RISC-V architecture-specific files, convert its one user to use do_div(). This avoids breaking the RV32 build after __udivdi3() is removed. This second version removes the assignment of the remainder to an unused temporary variable. Thanks to Nicolas Pitre <nico@fluxnic.net> for the suggestion. Signed-off-by: Paul Walmsley <paul.walmsley@sifive.com> Cc: Nicolas Pitre <nico@fluxnic.net>
Diffstat (limited to 'arch/riscv')
-rw-r--r--arch/riscv/lib/delay.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/riscv/lib/delay.c b/arch/riscv/lib/delay.c
index 87ff89e88f2c..f51c9a03bca1 100644
--- a/arch/riscv/lib/delay.c
+++ b/arch/riscv/lib/delay.c
@@ -81,9 +81,13 @@ EXPORT_SYMBOL(__delay);
void udelay(unsigned long usecs)
{
u64 ucycles = (u64)usecs * lpj_fine * UDELAY_MULT;
+ u64 n;
if (unlikely(usecs > MAX_UDELAY_US)) {
- __delay((u64)usecs * riscv_timebase / 1000000ULL);
+ n = (u64)usecs * riscv_timebase;
+ do_div(n, 1000000);
+
+ __delay(n);
return;
}