From 038f1ea370f8e7ae71c269f2c7c77852b1c43d00 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Sat, 1 Feb 2020 07:34:27 +0100 Subject: [PATCH] Minor cleanup/fix for kernel v4.20 support (get_monotonic_boottime) --- os_dep/linux/ioctl_cfg80211.c | 6 +++--- os_dep/linux/rtw_android.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 54d0e17..9057bee 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -736,12 +736,12 @@ static int rtw_cfg80211_sync_iftype(_adapter *adapter) static u64 rtw_get_systime_us(void) { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)) - return ktime_to_us(ktime_get_boottime()); -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0)) struct timespec ts; get_monotonic_boottime(&ts); return ((u64)ts.tv_sec * 1000000) + ts.tv_nsec / 1000; +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)) + return ktime_to_us(ktime_get_boottime()); #else struct timeval tv; do_gettimeofday(&tv); diff --git a/os_dep/linux/rtw_android.c b/os_dep/linux/rtw_android.c index e468574..55fe2bd 100644 --- a/os_dep/linux/rtw_android.c +++ b/os_dep/linux/rtw_android.c @@ -656,7 +656,7 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) ret = -EFAULT; goto exit; } - + command = rtw_zmalloc(priv_cmd.total_len+1); if (!command) { RTW_INFO("%s: failed to allocate memory\n", __FUNCTION__);