meta-sunxi/recipes-kernel/linux/linux-mainline/sunxi-kmeta/bsp/uwe5622/uwe5622-warnings.patch

207 lines
8.1 KiB
Diff
Raw Normal View History

From b758478655da935b50a973b0aa2ddbc20893b789 Mon Sep 17 00:00:00 2001
From: Paolo Sabatino <paolo.sabatino@gmail.com>
Date: Sun, 12 Jun 2022 14:33:59 +0000
Subject: [PATCH] uwe5622: various warning and firmware path fixes
---
drivers/net/wireless/uwe5622/Makefile | 2 +-
.../uwe5622/unisocwcn/platform/rdc_debug.c | 4 +-
.../uwe5622/unisocwcn/platform/wcn_boot.c | 2 -
.../unisocwcn/platform/wcn_parn_parser.c | 2 +-
.../uwe5622/unisocwcn/sdio/sdiohal_ctl.c | 42 ++++++-------------
.../wireless/uwe5622/unisocwifi/cfg80211.c | 4 --
6 files changed, 17 insertions(+), 39 deletions(-)
diff --git a/drivers/net/wireless/uwe5622/Makefile b/drivers/net/wireless/uwe5622/Makefile
index 71c863c1017..d2210439f3c 100644
--- a/drivers/net/wireless/uwe5622/Makefile
+++ b/drivers/net/wireless/uwe5622/Makefile
@@ -6,5 +6,5 @@ UNISOCWCN_DIR := $(shell cd $(src)/unisocwcn/ && /bin/pwd)
UNISOC_BSP_INCLUDE := $(UNISOCWCN_DIR)/include
export UNISOC_BSP_INCLUDE
-UNISOC_FW_PATH_CONFIG := "/lib/firmware/"
+UNISOC_FW_PATH_CONFIG := "/lib/firmware/uwe5622/"
export UNISOC_FW_PATH_CONFIG
diff --git a/drivers/net/wireless/uwe5622/unisocwcn/platform/rdc_debug.c b/drivers/net/wireless/uwe5622/unisocwcn/platform/rdc_debug.c
index 86fa3b103ad..1343cb98362 100755
--- a/drivers/net/wireless/uwe5622/unisocwcn/platform/rdc_debug.c
+++ b/drivers/net/wireless/uwe5622/unisocwcn/platform/rdc_debug.c
@@ -41,13 +41,13 @@ static unsigned int wcn_cp2_file_max_num = UNISOC_DBG_FILENUM_DEFAULT;
*/
static unsigned int wcn_cp2_log_cover_old = 1;
/* path of config file unisoc_cp2log_config.txt */
-#define WCN_DEBUG_CFG_MAX_PATH_NUM 0
+#define WCN_DEBUG_CFG_MAX_PATH_NUM 2
static char *wcn_cp2_config_path[WCN_DEBUG_CFG_MAX_PATH_NUM] = {
"/data/unisoc_cp2log_config.txt",
"/vendor/etc/wifi/unisoc_cp2log_config.txt"
};
/* path of cp2 log and mem files. */
-#define WCN_UNISOC_DBG_MAX_PATH_NUM 0
+#define WCN_UNISOC_DBG_MAX_PATH_NUM 3
static char *wcn_unisoc_dbg_path[WCN_UNISOC_DBG_MAX_PATH_NUM] = {
UNISOC_DBG_PATH_DEFAULT,/* most of projects */
"/data", /* amlogic s905w... */
diff --git a/drivers/net/wireless/uwe5622/unisocwcn/platform/wcn_boot.c b/drivers/net/wireless/uwe5622/unisocwcn/platform/wcn_boot.c
index d82f56357f3..58b9d290f23 100755
--- a/drivers/net/wireless/uwe5622/unisocwcn/platform/wcn_boot.c
+++ b/drivers/net/wireless/uwe5622/unisocwcn/platform/wcn_boot.c
@@ -325,8 +325,6 @@ static struct regmap *reg_map;
#define AFC_CALI_READ_FINISH 0x12121212
#define WCN_AFC_CALI_PATH "/productinfo/wcn/tsx_bt_data.txt"
-#define BIT(nr) (1UL << (nr))
-
#ifdef CONFIG_WCN_DOWNLOAD_FIRMWARE_FROM_HEX
#define POWER_WQ_DELAYED_MS 0
#else
diff --git a/drivers/net/wireless/uwe5622/unisocwcn/platform/wcn_parn_parser.c b/drivers/net/wireless/uwe5622/unisocwcn/platform/wcn_parn_parser.c
index 9abcd326972..c1557dcce3f 100755
--- a/drivers/net/wireless/uwe5622/unisocwcn/platform/wcn_parn_parser.c
+++ b/drivers/net/wireless/uwe5622/unisocwcn/platform/wcn_parn_parser.c
@@ -183,7 +183,7 @@ int parse_firmware_path(char *firmware_path)
continue;
}
memset(fstab_name, 0, sizeof(fstab_name));
- strncpy(fstab_name, fstab_dir[loop], sizeof(fstab_dir[loop]));
+ strncpy(fstab_name, fstab_dir[loop], sizeof(fstab_name));
if (strlen(fstab_name) > 1)
fstab_name[strlen(fstab_name)] = '/';
iterate_dir(file1, &ctx);
diff --git a/drivers/net/wireless/uwe5622/unisocwcn/sdio/sdiohal_ctl.c b/drivers/net/wireless/uwe5622/unisocwcn/sdio/sdiohal_ctl.c
index b426bf89cd9..8000bfea378 100755
--- a/drivers/net/wireless/uwe5622/unisocwcn/sdio/sdiohal_ctl.c
+++ b/drivers/net/wireless/uwe5622/unisocwcn/sdio/sdiohal_ctl.c
@@ -9,6 +9,7 @@
#include <linux/uaccess.h>
#include <linux/version.h>
#include <linux/vmalloc.h>
+#include <linux/ktime.h>
#include <wcn_bus.h>
#include "sdiohal.h"
@@ -96,8 +97,10 @@ char *tp_tx_buf[TP_TX_BUF_CNT];
struct mchn_ops_t at_tx_ops;
struct mchn_ops_t at_rx_ops;
-struct timeval tp_tx_start_time;
-struct timeval tp_tx_stop_time;
+ktime_t tp_tx_start_time;
+ktime_t tp_tx_stop_time;
+ktime_t tp_rx_start_time;
+ktime_t tp_rx_stop_time;
int tp_tx_cnt;
int tp_tx_flag;
int tp_tx_buf_cnt = TP_TX_BUF_CNT;
@@ -222,7 +225,6 @@ static int sdiohal_throughput_tx(void)
static void sdiohal_throughput_tx_compute_time(void)
{
static signed long long times_count;
- struct timespec64 now;
if (tp_tx_flag != 1)
return;
@@ -230,17 +232,12 @@ static void sdiohal_throughput_tx_compute_time(void)
/* throughput test */
tp_tx_cnt++;
if (tp_tx_cnt % 500 == 0) {
- getnstimeofday(&now);
- tp_tx_stop_time.tv_sec = now.tv_sec;
- tp_tx_stop_time.tv_usec = now.tv_nsec/1000;
- times_count = timeval_to_ns(&tp_tx_stop_time) -
- timeval_to_ns(&tp_tx_start_time);
+ tp_tx_stop_time = ktime_get();
+ times_count = tp_tx_stop_time - tp_tx_start_time;
sdiohal_info("tx->times(500c) is %lldns, tx %d, rx %d\n",
times_count, tp_tx_cnt, rx_pop_cnt);
tp_tx_cnt = 0;
- getnstimeofday(&now);
- tp_tx_start_time.tv_sec = now.tv_sec;
- tp_tx_start_time.tv_usec = now.tv_nsec/1000;
+ tp_tx_start_time = ktime_get();
}
sdiohal_throughput_tx();
}
@@ -544,14 +541,10 @@ int at_list_tx_pop(int channel, struct mbuf_t *head,
}
int tp_rx_cnt;
-struct timeval tp_rx_start_time;
-struct timeval tp_rx_stop_time;
-struct timespec tp_tm_begin;
int at_list_rx_pop(int channel, struct mbuf_t *head,
struct mbuf_t *tail, int num)
{
- static signed long long times_count;
- struct timespec64 now;
+ ktime_t times_count;
sdiohal_debug("%s channel:%d head:%p tail:%p num:%d\n",
__func__, channel, head, tail, num);
@@ -568,19 +561,13 @@ int at_list_rx_pop(int channel, struct mbuf_t *head,
/* throughput test */
tp_rx_cnt += num;
if (tp_rx_cnt / (500*64) == 1) {
- getnstimeofday(&now);
- tp_rx_stop_time.tv_sec = now.tv_sec;
- tp_rx_stop_time.tv_usec = now.tv_nsec/1000;
- times_count = timeval_to_ns(&tp_rx_stop_time)
- - timeval_to_ns(&tp_rx_start_time);
+ tp_rx_stop_time = ktime_get();
+ times_count = tp_rx_stop_time - tp_rx_start_time;
sdiohal_info("rx->times(%dc) is %lldns, tx %d, rx %d\n",
tp_rx_cnt, times_count, tp_tx_cnt, rx_pop_cnt);
tp_rx_cnt = 0;
- getnstimeofday(&now);
- tp_rx_start_time.tv_sec = now.tv_sec;
- tp_rx_start_time.tv_usec = now.tv_nsec/1000;
+ tp_rx_start_time = ktime_get();
}
- getnstimeofday(&tp_tm_begin);
return 0;
}
@@ -834,7 +821,6 @@ static ssize_t at_cmd_write(struct file *filp,
long int long_data;
int ret;
unsigned char *send_buf = NULL;
- struct timespec64 now;
if (count > SDIOHAL_WRITE_SIZE) {
sdiohal_err("%s write size > %d\n",
@@ -1127,9 +1113,7 @@ static ssize_t at_cmd_write(struct file *filp,
__func__, tp_tx_buf_cnt, tp_tx_buf_len);
tp_tx_flag = 1;
tp_tx_cnt = 0;
- getnstimeofday(&now);
- tp_tx_start_time.tv_sec = now.tv_sec;
- tp_tx_start_time.tv_usec = now.tv_nsec/1000;
+ tp_tx_start_time = ktime_get();
if ((tp_tx_buf_cnt <= TP_TX_BUF_CNT) &&
(tp_tx_buf_len <= TP_TX_BUF_LEN)) {
sprdwcn_bus_chn_deinit(&at_tx_ops);
diff --git a/drivers/net/wireless/uwe5622/unisocwifi/wl_core.c b/drivers/net/wireless/uwe5622/unisocwifi/wl_core.c
index ad310450e79..206824604ec 100755
--- a/drivers/net/wireless/uwe5622/unisocwifi/wl_core.c
+++ b/drivers/net/wireless/uwe5622/unisocwifi/wl_core.c
@@ -628,12 +628,12 @@ static int sprdwl_probe(struct platform_device *pdev)
ret = -ENXIO;
goto err_core_create;
}
- memcpy(priv->wl_ver.kernel_ver, utsname()->release,
- strlen(utsname()->release));
- memcpy(priv->wl_ver.drv_ver, SPRDWL_DRIVER_VERSION,
- strlen(SPRDWL_DRIVER_VERSION));
- memcpy(priv->wl_ver.update, SPRDWL_UPDATE, strlen(SPRDWL_UPDATE));
- memcpy(priv->wl_ver.reserve, SPRDWL_RESERVE, strlen(SPRDWL_RESERVE));
+ strncpy(priv->wl_ver.kernel_ver, utsname()->release,
+ sizeof(priv->wl_ver.kernel_ver));
+ strncpy(priv->wl_ver.drv_ver, SPRDWL_DRIVER_VERSION,
+ sizeof(priv->wl_ver.drv_ver));
+ strncpy(priv->wl_ver.update, SPRDWL_UPDATE, sizeof(priv->wl_ver.update));
+ strncpy(priv->wl_ver.reserve, SPRDWL_RESERVE, sizeof(priv->wl_ver.reserve));
wl_info("Spreadtrum WLAN Version:");
wl_info("Kernel:%s,Driver:%s,update:%s,reserved:%s\n",
utsname()->release, SPRDWL_DRIVER_VERSION,