treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / h8300 / lib / delay.c
blobf4277529a9b94b7d7e4e115a1bf167644febd0d3
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * delay loops
5 * Copyright (C) 2015 Yoshinori Sato
6 */
8 #include <linux/module.h>
9 #include <linux/delay.h>
10 #include <asm/param.h>
11 #include <asm/processor.h>
12 #include <asm/timex.h>
14 void __delay(unsigned long cycles)
16 __asm__ volatile ("1: dec.l #1,%0\n\t"
17 "bne 1b":"=r"(cycles):"0"(cycles));
19 EXPORT_SYMBOL(__delay);
21 void __const_udelay(unsigned long xloops)
23 u64 loops;
25 loops = (u64)xloops * loops_per_jiffy * HZ;
27 __delay(loops >> 32);
29 EXPORT_SYMBOL(__const_udelay);
31 void __udelay(unsigned long usecs)
33 __const_udelay(usecs * 0x10C7UL); /* 2**32 / 1000000 (rounded up) */
35 EXPORT_SYMBOL(__udelay);
37 void __ndelay(unsigned long nsecs)
39 __const_udelay(nsecs * 0x5UL); /* 2**32 / 1000000000 (rounded up) */
41 EXPORT_SYMBOL(__ndelay);