Fix builds for kernels older than 4.11.0

This commit is contained in:
kimocoder 2018-11-10 21:22:12 +01:00
parent 6a85cb90dd
commit dae6545ef1
2 changed files with 13 additions and 1 deletions

View File

@ -686,7 +686,11 @@ static int rtw_cfg80211_sync_iftype(_adapter *adapter)
static u64 rtw_get_systime_us(void)
{
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0))
ktime_t ts;
ts = ktime_get_boottime();
return do_div(ts, 1000);
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
struct timespec ts;
get_monotonic_boottime(&ts);
return ((u64)ts.tv_sec * 1000000) + ts.tv_nsec / 1000;

View File

@ -20,6 +20,14 @@
#define RT_TAG '1178'
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0))
static inline ssize_t call_read_iter(struct file *file, struct kiocb *kio,
struct iov_iter *iter)
{
return file->f_op->read_iter(kio, iter);
}
#endif
#ifdef DBG_MEMORY_LEAK
#ifdef PLATFORM_LINUX
atomic_t _malloc_cnt = ATOMIC_INIT(0);