[PATCH] header: Add fsleep()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This was added in upstream Linux commit c6af13d33475 ("timer: add fsleep
for flexible sleeping") and is now used by the rtw88 driver.

Signed-off-by: Hauke Mehrtens <hauke@xxxxxxxxxx>
---
 backport/backport-include/linux/delay.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 backport/backport-include/linux/delay.h

diff --git a/backport/backport-include/linux/delay.h b/backport/backport-include/linux/delay.h
new file mode 100644
index 00000000..c19f4322
--- /dev/null
+++ b/backport/backport-include/linux/delay.h
@@ -0,0 +1,21 @@
+#ifndef __BACKPORT_LINUX_DELAY_H
+#define __BACKPORT_LINUX_DELAY_H
+#include_next <linux/delay.h>
+
+#include <linux/version.h>
+
+#if LINUX_VERSION_IS_LESS(5,8,0)
+#define fsleep LINUX_BACKPORT(fsleep)
+/* see Documentation/timers/timers-howto.rst for the thresholds */
+static inline void fsleep(unsigned long usecs)
+{
+	if (usecs <= 10)
+		udelay(usecs);
+	else if (usecs <= 20000)
+		usleep_range(usecs, 2 * usecs);
+	else
+		msleep(DIV_ROUND_UP(usecs, 1000));
+}
+#endif /* < 5.8.0 */
+
+#endif /* __BACKPORT_LINUX_DELAY_H */
-- 
2.30.2

--
To unsubscribe from this list: send the line "unsubscribe backports" in



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux