git: 20c9dcd2edf3 - stable/13 - LinuxKPI: add fsleep()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Fri, 19 Nov 2021 00:02:23 UTC
The branch stable/13 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=20c9dcd2edf35f9c4cc52d48ea4d3b10af6d8091

commit 20c9dcd2edf35f9c4cc52d48ea4d3b10af6d8091
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2021-07-27 15:22:02 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2021-11-19 00:01:23 +0000

    LinuxKPI: add fsleep()
    
    Add fsleep() function now required by rtw88.  This seems to be
    making a decision depending on time to sleep on how to sleep.
    Given our compat framework already is lenient on how long to sleep,
    this is a cut down version.
    
    (cherry picked from commit cc2723370b482b923b2adeac3ad359d485f0bd82)
---
 sys/compat/linuxkpi/common/include/linux/delay.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/delay.h b/sys/compat/linuxkpi/common/include/linux/delay.h
index 860d36368a8e..d2fea37699c3 100644
--- a/sys/compat/linuxkpi/common/include/linux/delay.h
+++ b/sys/compat/linuxkpi/common/include/linux/delay.h
@@ -73,4 +73,14 @@ usleep_range(unsigned long min, unsigned long max)
 
 extern unsigned int linux_msleep_interruptible(unsigned int ms);
 
+static inline void
+fsleep(unsigned long us)
+{
+
+	if (us < 10)
+		udelay(us);
+	else
+		usleep_range(us, us);
+}
+
 #endif	/* _LINUX_DELAY_H_ */