hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/include/linux/ktime.h
....@@ -23,6 +23,7 @@
2323
2424 #include <linux/time.h>
2525 #include <linux/jiffies.h>
26
+#include <asm/bug.h>
2627
2728 /* Nanosecond scalar representation for kernel time values */
2829 typedef s64 ktime_t;
....@@ -66,32 +67,14 @@
6667 */
6768 #define ktime_sub_ns(kt, nsval) ((kt) - (nsval))
6869
69
-/* convert a timespec to ktime_t format: */
70
-static inline ktime_t timespec_to_ktime(struct timespec ts)
71
-{
72
- return ktime_set(ts.tv_sec, ts.tv_nsec);
73
-}
74
-
7570 /* convert a timespec64 to ktime_t format: */
7671 static inline ktime_t timespec64_to_ktime(struct timespec64 ts)
7772 {
7873 return ktime_set(ts.tv_sec, ts.tv_nsec);
7974 }
8075
81
-/* convert a timeval to ktime_t format: */
82
-static inline ktime_t timeval_to_ktime(struct timeval tv)
83
-{
84
- return ktime_set(tv.tv_sec, tv.tv_usec * NSEC_PER_USEC);
85
-}
86
-
87
-/* Map the ktime_t to timespec conversion to ns_to_timespec function */
88
-#define ktime_to_timespec(kt) ns_to_timespec((kt))
89
-
9076 /* Map the ktime_t to timespec conversion to ns_to_timespec function */
9177 #define ktime_to_timespec64(kt) ns_to_timespec64((kt))
92
-
93
-/* Map the ktime_t to timeval conversion to ns_to_timeval function */
94
-#define ktime_to_timeval(kt) ns_to_timeval((kt))
9578
9679 /* Convert ktime_t to nanoseconds */
9780 static inline s64 ktime_to_ns(const ktime_t kt)
....@@ -214,25 +197,6 @@
214197 }
215198
216199 extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs);
217
-
218
-/**
219
- * ktime_to_timespec_cond - convert a ktime_t variable to timespec
220
- * format only if the variable contains data
221
- * @kt: the ktime_t variable to convert
222
- * @ts: the timespec variable to store the result in
223
- *
224
- * Return: %true if there was a successful conversion, %false if kt was 0.
225
- */
226
-static inline __must_check bool ktime_to_timespec_cond(const ktime_t kt,
227
- struct timespec *ts)
228
-{
229
- if (kt) {
230
- *ts = ktime_to_timespec(kt);
231
- return true;
232
- } else {
233
- return false;
234
- }
235
-}
236200
237201 /**
238202 * ktime_to_timespec64_cond - convert a ktime_t variable to timespec64