1 /* SPDX-License-Identifier: MIT */
2
3 /* Copyright 2024 Advanced Micro Devices, Inc. */
4 /* Copyright 2019 Raptor Engineering, LLC */
5
6 #ifndef _SPL_OS_TYPES_H_
7 #define _SPL_OS_TYPES_H_
8
9 #include "spl_debug.h"
10
11 #include <linux/slab.h>
12 #include <linux/kgdb.h>
13 #include <linux/kref.h>
14 #include <linux/types.h>
15 #include <linux/delay.h>
16 #include <linux/mm.h>
17
18 /*
19 *
20 * general debug capabilities
21 *
22 */
23
spl_div_u64_rem(uint64_t dividend,uint32_t divisor,uint32_t * remainder)24 static inline uint64_t spl_div_u64_rem(uint64_t dividend, uint32_t divisor, uint32_t *remainder)
25 {
26 return div_u64_rem(dividend, divisor, remainder);
27 }
28
spl_div_u64(uint64_t dividend,uint32_t divisor)29 static inline uint64_t spl_div_u64(uint64_t dividend, uint32_t divisor)
30 {
31 return div_u64(dividend, divisor);
32 }
33
spl_div64_u64(uint64_t dividend,uint64_t divisor)34 static inline uint64_t spl_div64_u64(uint64_t dividend, uint64_t divisor)
35 {
36 return div64_u64(dividend, divisor);
37 }
38
spl_div64_u64_rem(uint64_t dividend,uint64_t divisor,uint64_t * remainder)39 static inline uint64_t spl_div64_u64_rem(uint64_t dividend, uint64_t divisor, uint64_t *remainder)
40 {
41 return div64_u64_rem(dividend, divisor, remainder);
42 }
43
spl_div64_s64(int64_t dividend,int64_t divisor)44 static inline int64_t spl_div64_s64(int64_t dividend, int64_t divisor)
45 {
46 return div64_s64(dividend, divisor);
47 }
48
49 #define spl_swap(a, b) \
50 do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
51
52 #ifndef spl_min
53 #define spl_min(a, b) (((a) < (b)) ? (a):(b))
54 #endif
55
56 #endif /* _SPL_OS_TYPES_H_ */
57