Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/include/linux/delay.h
Show All 27 Lines | |||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
* | * | ||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#ifndef _LINUX_DELAY_H_ | #ifndef _LINUX_DELAY_H_ | ||||
#define _LINUX_DELAY_H_ | #define _LINUX_DELAY_H_ | ||||
#include <linux/jiffies.h> | #include <linux/jiffies.h> | ||||
#include <sys/kernel.h> | |||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
static inline void | static inline void | ||||
linux_msleep(unsigned int ms) | linux_msleep(unsigned int ms) | ||||
{ | { | ||||
/* guard against invalid values */ | /* guard against invalid values */ | ||||
if (ms == 0) | if (ms == 0) | ||||
ms = 1; | ms = 1; | ||||
Show All 26 Lines | |||||
{ | { | ||||
/* guard against invalid values */ | /* guard against invalid values */ | ||||
if (min == 0) | if (min == 0) | ||||
min = 1; | min = 1; | ||||
pause_sbt("lnxsleep", ustosbt(min), 0, C_HARDCLOCK); | pause_sbt("lnxsleep", ustosbt(min), 0, C_HARDCLOCK); | ||||
} | } | ||||
extern unsigned int linux_msleep_interruptible(unsigned int ms); | extern unsigned int linux_msleep_interruptible(unsigned int ms); | ||||
static inline void | |||||
fsleep(unsigned long us) | |||||
{ | |||||
if (us < (20 * hz)) | |||||
emaste: IMO the scaling by hz deserves a comment | |||||
bzAuthorUnsubmitted Done Inline Actionswill do if it'll survive the update triggered by @hselasky (see below). bz: will do if it'll survive the update triggered by @hselasky (see below). | |||||
DELAY(us); | |||||
hselaskyUnsubmitted Done Inline ActionsDo you have to use DELAY() ? Else use pause_sbt! hselasky: Do you have to use DELAY() ? Else use pause_sbt! | |||||
bzAuthorUnsubmitted Done Inline ActionsI think the idea is to have a busy loop if the timeouts are small enough; now you asking make me notice that the code from this file had changed under my branch. I'll update and make this more fine grained after all. bz: I think the idea is to have a busy loop if the timeouts are small enough; now you asking make… | |||||
else | |||||
linux_msleep(howmany(us, 1000)); | |||||
} | |||||
#endif /* _LINUX_DELAY_H_ */ | #endif /* _LINUX_DELAY_H_ */ |
IMO the scaling by hz deserves a comment