Fix for 4.14.0 kernel

This commit is contained in:
Matt Robinson 2017-10-22 19:05:31 -04:00
parent c6e7607eac
commit 65a6213446
No known key found for this signature in database
GPG Key ID: C5A21DBAA7BB0D70
3 changed files with 24 additions and 0 deletions

View File

@ -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;

View File

@ -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);
}

View File

@ -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