forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/net/wireless/rockchip_wlan/rtl8723cs/os_dep/osdep_service.c
....@@ -2496,22 +2496,18 @@
24962496 {
24972497 struct file *fp;
24982498 int ret = 0;
2499
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
25002499 mm_segment_t oldfs;
2501
- #endif
25022500 char buf;
25032501
25042502 fp = filp_open(path, O_RDONLY, 0);
25052503 if (IS_ERR(fp))
25062504 ret = PTR_ERR(fp);
25072505 else {
2508
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
25092506 oldfs = get_fs();
25102507 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
25112508 set_fs(KERNEL_DS);
25122509 #else
2513
- set_fs(get_ds());
2514
- #endif
2510
+ set_fs(KERNEL_DS);
25152511 #endif
25162512
25172513 if (1 != readFile(fp, &buf, 1))
....@@ -2525,9 +2521,7 @@
25252521 #endif
25262522 }
25272523
2528
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
25292524 set_fs(oldfs);
2530
- #endif
25312525 filp_close(fp, NULL);
25322526 }
25332527 return ret;
....@@ -2543,9 +2537,7 @@
25432537 static int retriveFromFile(const char *path, u8 *buf, u32 sz)
25442538 {
25452539 int ret = -1;
2546
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
25472540 mm_segment_t oldfs;
2548
- #endif
25492541 struct file *fp;
25502542
25512543 if (path && buf) {
....@@ -2553,20 +2545,14 @@
25532545 if (0 == ret) {
25542546 RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp);
25552547
2556
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
25572548 oldfs = get_fs();
25582549 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
25592550 set_fs(KERNEL_DS);
25602551 #else
2561
- set_fs(get_ds());
2552
+ set_fs(KERNEL_DS);
25622553 #endif
2563
- #endif
2564
-
25652554 ret = readFile(fp, buf, sz);
2566
-
2567
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
25682555 set_fs(oldfs);
2569
- #endif
25702556 closeFile(fp);
25712557
25722558 RTW_INFO("%s readFile, ret:%d\n", __FUNCTION__, ret);
....@@ -2590,9 +2576,7 @@
25902576 static int storeToFile(const char *path, u8 *buf, u32 sz)
25912577 {
25922578 int ret = 0;
2593
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
25942579 mm_segment_t oldfs;
2595
- #endif
25962580 struct file *fp;
25972581
25982582 if (path && buf) {
....@@ -2600,20 +2584,14 @@
26002584 if (0 == ret) {
26012585 RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp);
26022586
2603
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
26042587 oldfs = get_fs();
26052588 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
26062589 set_fs(KERNEL_DS);
26072590 #else
2608
- set_fs(get_ds());
2591
+ set_fs(KERNEL_DS);
26092592 #endif
2610
- #endif
2611
-
26122593 ret = writeFile(fp, buf, sz);
2613
-
2614
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
26152594 set_fs(oldfs);
2616
- #endif
26172595 closeFile(fp);
26182596
26192597 RTW_INFO("%s writeFile, ret:%d\n", __FUNCTION__, ret);