Wed Jul 24 03:36:10 2013 UTC ()
Add mdelay to <linux/delay.h>.


(riastradh)
diff -r1.1.2.3 -r1.1.2.4 src/sys/external/bsd/drm2/include/linux/delay.h

cvs diff -r1.1.2.3 -r1.1.2.4 src/sys/external/bsd/drm2/include/linux/delay.h (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/include/linux/delay.h 2013/07/24 03:31:29 1.1.2.3
+++ src/sys/external/bsd/drm2/include/linux/delay.h 2013/07/24 03:36:10 1.1.2.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: delay.h,v 1.1.2.3 2013/07/24 03:31:29 riastradh Exp $ */ 1/* $NetBSD: delay.h,v 1.1.2.4 2013/07/24 03:36:10 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2013 The NetBSD Foundation, Inc. 4 * Copyright (c) 2013 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Taylor R. Campbell. 8 * by Taylor R. Campbell.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -30,20 +30,33 @@ @@ -30,20 +30,33 @@
30 */ 30 */
31 31
32#ifndef _LINUX_DELAY_H_ 32#ifndef _LINUX_DELAY_H_
33#define _LINUX_DELAY_H_ 33#define _LINUX_DELAY_H_
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/kernel.h> 36#include <sys/kernel.h>
37#include <sys/proc.h> 37#include <sys/proc.h>
38 38
39#include <machine/param.h> 39#include <machine/param.h>
40 40
41#define udelay DELAY 41#define udelay DELAY
42 42
 43#define MAX_UDELAY_MS 5
 44
43static inline void 45static inline void
44msleep(unsigned int msec) 46msleep(unsigned int msec)
45{ 47{
46 (void)kpause("lnxmslep", false, mstohz(msec), NULL); 48 (void)kpause("lnxmslep", false, mstohz(msec), NULL);
47} 49}
48 50
 51static inline void
 52mdelay(unsigned int msec)
 53{
 54
 55 if (msec < MAX_UDELAY_MS)
 56 udelay(msec * 1000);
 57 else
 58 while (msec--)
 59 udelay(1000);
 60}
 61
49#endif /* _LINUX_DELAY_H_ */ 62#endif /* _LINUX_DELAY_H_ */