.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * 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. |
---|
12 | 4 | */ |
---|
13 | 5 | |
---|
14 | 6 | #include <linux/delay.h> |
---|
.. | .. |
---|
89 | 81 | void udelay(unsigned long usecs) |
---|
90 | 82 | { |
---|
91 | 83 | u64 ucycles = (u64)usecs * lpj_fine * UDELAY_MULT; |
---|
| 84 | + u64 n; |
---|
92 | 85 | |
---|
93 | 86 | 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); |
---|
95 | 91 | return; |
---|
96 | 92 | } |
---|
97 | 93 | |
---|