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>
This commit is contained in:
parent
94ed3fde38
commit
66cc016ab7
|
@ -81,9 +81,13 @@ EXPORT_SYMBOL(__delay);
|
||||||
void udelay(unsigned long usecs)
|
void udelay(unsigned long usecs)
|
||||||
{
|
{
|
||||||
u64 ucycles = (u64)usecs * lpj_fine * UDELAY_MULT;
|
u64 ucycles = (u64)usecs * lpj_fine * UDELAY_MULT;
|
||||||
|
u64 n;
|
||||||
|
|
||||||
if (unlikely(usecs > MAX_UDELAY_US)) {
|
if (unlikely(usecs > MAX_UDELAY_US)) {
|
||||||
__delay((u64)usecs * riscv_timebase / 1000000ULL);
|
n = (u64)usecs * riscv_timebase;
|
||||||
|
do_div(n, 1000000);
|
||||||
|
|
||||||
|
__delay(n);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue