Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F171125817
D58757.id186176.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D58757.id186176.diff
View Options
diff --git a/sys/compat/linuxkpi/common/include/linux/hrtimer.h b/sys/compat/linuxkpi/common/include/linux/hrtimer.h
--- a/sys/compat/linuxkpi/common/include/linux/hrtimer.h
+++ b/sys/compat/linuxkpi/common/include/linux/hrtimer.h
@@ -55,11 +55,20 @@
#define hrtimer_try_to_cancel(hrtimer) linux_hrtimer_try_to_cancel(hrtimer)
#define hrtimer_cancel(hrtimer) linux_hrtimer_cancel(hrtimer)
+/* hrtimer_init() is replaced by hrtimer_setup() in Linux 6.15. */
+#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION < 61500
#define hrtimer_init(hrtimer, clock, mode) do { \
CTASSERT((clock) == CLOCK_MONOTONIC); \
CTASSERT((mode) == HRTIMER_MODE_REL); \
linux_hrtimer_init(hrtimer); \
} while (0)
+#endif
+
+#define hrtimer_setup(hrtimer, restart, clock, mode) do { \
+ CTASSERT((clock) == CLOCK_MONOTONIC); \
+ CTASSERT((mode) == HRTIMER_MODE_REL); \
+ linuxkpi_hrtimer_setup(hrtimer, restart); \
+} while (0)
#define hrtimer_set_expires(hrtimer, time) \
linux_hrtimer_set_expires(hrtimer, time)
@@ -81,10 +90,20 @@
bool linux_hrtimer_active(struct hrtimer *);
int linux_hrtimer_try_to_cancel(struct hrtimer *);
int linux_hrtimer_cancel(struct hrtimer *);
+/*
+ * The corresponding `hrtimer_init()` was dropped in Linux 6.15, thus the "#if
+ * LINUXKPI_VERSION < 61500" above. We keep this prototype here though because
+ * the underlying `linux_hrtimer_init()` is used by `linuxkpi_hrtimer_setup()`.
+ */
void linux_hrtimer_init(struct hrtimer *);
+void linuxkpi_hrtimer_setup(struct hrtimer *hrtimer,
+ enum hrtimer_restart (*function)(struct hrtimer *));
void linux_hrtimer_set_expires(struct hrtimer *, ktime_t);
void linux_hrtimer_start(struct hrtimer *, ktime_t);
void linux_hrtimer_start_range_ns(struct hrtimer *, ktime_t, int64_t);
void linux_hrtimer_forward_now(struct hrtimer *, ktime_t);
+enum hrtimer_restart linuxkpi_hrtimer_dummy_timeout(struct hrtimer *unused);
+#define hrtimer_dummy_timeout(hrtimer) linuxkpi_hrtimer_dummy_timeout(hrtimer)
+
#endif /* _LINUXKPI_LINUX_HRTIMER_H_ */
diff --git a/sys/compat/linuxkpi/common/src/linux_hrtimer.c b/sys/compat/linuxkpi/common/src/linux_hrtimer.c
--- a/sys/compat/linuxkpi/common/src/linux_hrtimer.c
+++ b/sys/compat/linuxkpi/common/src/linux_hrtimer.c
@@ -105,6 +105,23 @@
callout_init_mtx(&hrtimer->callout, &hrtimer->mtx, 0);
}
+enum hrtimer_restart
+linuxkpi_hrtimer_dummy_timeout(struct hrtimer *unused __unused)
+{
+ return (HRTIMER_NORESTART);
+}
+
+void
+linuxkpi_hrtimer_setup(struct hrtimer *hrtimer,
+ enum hrtimer_restart (*function)(struct hrtimer *))
+{
+ linux_hrtimer_init(hrtimer);
+ if (function != NULL)
+ hrtimer->function = function;
+ else
+ hrtimer->function = linuxkpi_hrtimer_dummy_timeout;
+}
+
void
linux_hrtimer_set_expires(struct hrtimer *hrtimer, ktime_t time)
{
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Sep 9, 9:03 PM (32 m, 53 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38611122
Default Alt Text
D58757.id186176.diff (2 KB)
Attached To
Mode
D58757: linuxkpi: Add `hrtimer_setup()`
Attached
Detach File
Event Timeline
Log In to Comment