jcs's openbsd hax
openbsd
at jcs 53 lines 772 B view raw
1/* Public domain. */ 2 3#ifndef _LINUX_DELAY_H 4#define _LINUX_DELAY_H 5 6#include <sys/param.h> 7#include <sys/systm.h> 8 9static inline void 10udelay(unsigned long usecs) 11{ 12 DELAY(usecs); 13} 14 15static inline void 16ndelay(unsigned long nsecs) 17{ 18 DELAY(MAX(nsecs / 1000, 1)); 19} 20 21static inline void 22usleep_range(unsigned long min, unsigned long max) 23{ 24 DELAY((min + max) / 2); 25} 26 27static inline void 28mdelay(unsigned long msecs) 29{ 30 int loops = msecs; 31 while (loops--) 32 DELAY(1000); 33} 34 35#define drm_msleep(x) mdelay(x) 36 37static inline void 38fsleep(unsigned long usecs) 39{ 40 DELAY(usecs); 41} 42 43static inline unsigned int 44msleep_interruptible(unsigned int msecs) 45{ 46 int r = tsleep_nsec(&nowake, PWAIT|PCATCH, "msleepi", 47 MSEC_TO_NSEC(msecs)); 48 if (r == EINTR) 49 return 1; 50 return 0; 51} 52 53#endif