From 65a62134461330d66f73f87929b0bf1023b2cebc Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Sun, 22 Oct 2017 19:05:31 -0400 Subject: [PATCH] Fix for 4.14.0 kernel --- core/efuse/rtw_efuse.c | 16 ++++++++++++++++ core/rtw_wlan_util.c | 4 ++++ os_dep/osdep_service.c | 4 ++++ 3 files changed, 24 insertions(+) diff --git a/core/efuse/rtw_efuse.c b/core/efuse/rtw_efuse.c index 1bb5105..e3554f8 100644 --- a/core/efuse/rtw_efuse.c +++ b/core/efuse/rtw_efuse.c @@ -2566,7 +2566,11 @@ u32 rtw_read_efuse_from_file(const char *path, u8 *buf) set_fs(KERNEL_DS); for (i = 0 ; i < HWSET_MAX_SIZE ; i++) { +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)) + kernel_read(fp, temp, 2, &pos); +#else vfs_read(fp, temp, 2, &pos); +#endif if (sscanf(temp, "%hhx", &buf[i]) != 1) { if (0) RTW_ERR("%s sscanf fail\n", __func__); @@ -2574,10 +2578,18 @@ u32 rtw_read_efuse_from_file(const char *path, u8 *buf) } if ((i % EFUSE_FILE_COLUMN_NUM) == (EFUSE_FILE_COLUMN_NUM - 1)) { /* Filter the lates space char. */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)) + kernel_read(fp, temp, 1, &pos); +#else vfs_read(fp, temp, 1, &pos); +#endif if (strchr(temp, ' ') == NULL) { pos--; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)) + kernel_read(fp, temp, 2, &pos); +#else vfs_read(fp, temp, 2, &pos); +#endif } } else { pos += 1; /* Filter the space character */ @@ -2634,7 +2646,11 @@ u32 rtw_read_macaddr_from_file(const char *path, u8 *buf) fs = get_fs(); set_fs(KERNEL_DS); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)) + kernel_read(fp, source_addr, 18, &pos); +#else vfs_read(fp, source_addr, 18, &pos); +#endif source_addr[17] = ':'; head = end = source_addr; diff --git a/core/rtw_wlan_util.c b/core/rtw_wlan_util.c index 6844da9..5943c12 100644 --- a/core/rtw_wlan_util.c +++ b/core/rtw_wlan_util.c @@ -4475,7 +4475,11 @@ int rtw_dev_nlo_info_set(struct pno_nlo_info *nlo_info, pno_ssid_t *ssid, source = rtw_zmalloc(2048); if (source != NULL) { +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)) + len = kernel_read(fp, source, len, &pos); +#else len = vfs_read(fp, source, len, &pos); +#endif rtw_parse_cipher_list(nlo_info, source); rtw_mfree(source, 2048); } diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c index 7fb0b4b..13a5bea 100644 --- a/os_dep/osdep_service.c +++ b/os_dep/osdep_service.c @@ -1920,7 +1920,11 @@ static int readFile(struct file *fp, char *buf, int len) while (sum < len) { #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)) + rlen = kernel_read(fp, buf + sum, len - sum, &fp->f_pos); +#else rlen = __vfs_read(fp, buf + sum, len - sum, &fp->f_pos); +#endif #else rlen = fp->f_op->read(fp, buf + sum, len - sum, &fp->f_pos); #endif