#ifndef __ASM_GENERIC_DELAY_H
#define __ASM_GENERIC_DELAY_H

/* Undefined functions to get compile-time errors */
extern void __bad_udelay(void);
extern void __bad_ndelay(void);

extern void __udelay(unsigned long usecs);
extern void __ndelay(unsigned long nsecs);
extern void __const_udelay(unsigned long xloops);
extern void __delay(unsigned long loops);

/*
 * The weird n/20000 thing suppresses a "comparison is always false due to
 * limited range of data type" warning with non-const 8-bit arguments.
 */

/* 0x10c7 is 2**32 / 1000000 (rounded up) */
#define udelay(n)							\
	({								\
		if (__builtin_constant_p(n)) {				\
			if ((n) / 20000 >= 1)				\
				 __bad_udelay();			\
			else						\
				__const_udelay((n) * 0x10c7ul);		\
		} else {						\
			__udelay(n);					\
		}							\
	})

/* 0x5 is 2**32 / 1000000000 (rounded up) */
#define ndelay(n)							\
	({								\
		if (__builtin_constant_p(n)) {				\
			if ((n) / 20000 >= 1)				\
				__bad_ndelay();				\
			else						\
				__const_udelay((n) * 5ul);		\
		} else {						\
			__ndelay(n);					\
		}							\
	})

#endif /* __ASM_GENERIC_DELAY_H */
anup</option>
<option value='master' selected='selected'>master</option>
<option value='nds-private-remove'>nds-private-remove</option>
<option value='packet-loop-back'>packet-loop-back</option>
<option value='packet-rx-pump-back'>packet-rx-pump-back</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>net-next plumbings</td><td class='sub right'>Tobias Klauser</td></tr></table>
<table class='tabs'><tr><td>
<a href='/cgit.cgi/linux/net-next.git/'>summary</a><a href='/cgit.cgi/linux/net-next.git/refs/?id=e3426e12fee11cb7949b65428955127ca3dcb433'>refs</a><a class='active' href='/cgit.cgi/linux/net-next.git/log/tools/include/asm/alternative-asm.h?showmsg=1'>log</a><a href='/cgit.cgi/linux/net-next.git/tree/tools/include/asm/alternative-asm.h?id=e3426e12fee11cb7949b65428955127ca3dcb433'>tree</a><a href='/cgit.cgi/linux/net-next.git/commit/tools/include/asm/alternative-asm.h?id=e3426e12fee11cb7949b65428955127ca3dcb433'>commit</a><a href='/cgit.cgi/linux/net-next.git/diff/tools/include/asm/alternative-asm.h?id=e3426e12fee11cb7949b65428955127ca3dcb433'>diff</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/linux/net-next.git/log/tools/include/asm/alternative-asm.h'>
<input type='hidden' name='id' value='e3426e12fee11cb7949b65428955127ca3dcb433'/><input type='hidden' name='showmsg' value='1'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/log/?id=e3426e12fee11cb7949b65428955127ca3dcb433&amp;showmsg=1'>root</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools?id=e3426e12fee11cb7949b65428955127ca3dcb433&amp;showmsg=1'>tools</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/include?id=e3426e12fee11cb7949b65428955127ca3dcb433&amp;showmsg=1'>include</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/include/asm?id=e3426e12fee11cb7949b65428955127ca3dcb433&amp;showmsg=1'>asm</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/include/asm/alternative-asm.h?id=e3426e12fee11cb7949b65428955127ca3dcb433&amp;showmsg=1'>alternative-asm.h</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th class='left'>Age</th><th class='left'>Commit message (<a href='/cgit.cgi/linux/net-next.git/log/tools/include/asm/alternative-asm.h?id=e3426e12fee11cb7949b65428955127ca3dcb433'>Collapse</a>)</th><th class='left'>Author</th><th class='left'>Files</th><th class='left'>Lines</th></tr>