another vfs_read(...) fix

master
Harald Wolff 2018-03-05 11:23:13 +00:00
parent 559c2fbdbc
commit 3ce2d45655
1 changed files with 16 additions and 0 deletions

View File

@ -2564,7 +2564,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__);
@ -2572,10 +2576,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 */
@ -2632,7 +2644,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;