From 5f4d2d5fc32dfe41c73cac36ec6747c34e5562a3 Mon Sep 17 00:00:00 2001
From: pbiel <pbiel7@gmail.com>
Date: Wed, 15 Mar 2023 23:04:27 +0100
Subject: [PATCH] wireless: Adapt uwe5622 wifi driver to kernel 6.1

---
 drivers/net/wireless/uwe5622/tty-sdio/lpm.c            |  2 +-
 .../uwe5622/unisocwcn/boot/wcn_integrate_dev.c         |  2 +-
 .../uwe5622/unisocwcn/platform/wcn_parn_parser.c       |  2 +-
 .../wireless/uwe5622/unisocwcn/platform/wcn_procfs.c   |  2 +-
 .../wireless/uwe5622/unisocwcn/usb/wcn_usb_download.c  |  2 +-
 .../net/wireless/uwe5622/unisocwcn/usb/wcn_usb_test.c  |  6 +++---
 drivers/net/wireless/uwe5622/unisocwifi/cfg80211.c     | 10 +++++-----
 drivers/net/wireless/uwe5622/unisocwifi/cmdevt.c       |  2 +-
 8 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/uwe5622/tty-sdio/lpm.c b/drivers/net/wireless/uwe5622/tty-sdio/lpm.c
index b2d9a8994e5e..35e30651a921 100644
--- a/drivers/net/wireless/uwe5622/tty-sdio/lpm.c
+++ b/drivers/net/wireless/uwe5622/tty-sdio/lpm.c
@@ -70,7 +70,7 @@ static int btwrite_proc_show(struct seq_file *m, void *v)
 
 static int bluesleep_open_proc_btwrite(struct inode *inode, struct file *file)
 {
-	return single_open(file, btwrite_proc_show, PDE_DATA(inode));
+	return single_open(file, btwrite_proc_show, pde_data(inode));
 }
 
 static const struct proc_ops lpm_proc_btwrite_fops = {
diff --git a/drivers/net/wireless/uwe5622/unisocwcn/boot/wcn_integrate_dev.c b/drivers/net/wireless/uwe5622/unisocwcn/boot/wcn_integrate_dev.c
index 3ee6910e7cf7..29a3ec298bc1 100644
--- a/drivers/net/wireless/uwe5622/unisocwcn/boot/wcn_integrate_dev.c
+++ b/drivers/net/wireless/uwe5622/unisocwcn/boot/wcn_integrate_dev.c
@@ -562,7 +562,7 @@ static struct wcn_proc_data g_proc_data = {
 static int wcn_platform_open(struct inode *inode, struct file *filp)
 {
 	struct platform_proc_file_entry
-	*entry = (struct platform_proc_file_entry *)PDE_DATA(inode);
+	*entry = (struct platform_proc_file_entry *)pde_data(inode);
 
 	WCN_INFO("entry name:%s\n!", entry->name);
 
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 aea7d6d0fe57..bd841f0b32d3 100644
--- a/drivers/net/wireless/uwe5622/unisocwcn/platform/wcn_parn_parser.c
+++ b/drivers/net/wireless/uwe5622/unisocwcn/platform/wcn_parn_parser.c
@@ -146,7 +146,7 @@ static int prefixcmp(const char *str, const char *prefix)
 }
 
 #if KERNEL_VERSION(3, 19, 0) <= LINUX_VERSION_CODE
-static int find_callback(struct dir_context *ctx, const char *name, int namlen,
+static bool find_callback(struct dir_context *ctx, const char *name, int namlen,
 		     loff_t offset, u64 ino, unsigned int d_type)
 #else
 static int find_callback(void *ctx, const char *name, int namlen,
diff --git a/drivers/net/wireless/uwe5622/unisocwcn/platform/wcn_procfs.c b/drivers/net/wireless/uwe5622/unisocwcn/platform/wcn_procfs.c
index 2edb7903d80e..9e453365bba8 100644
--- a/drivers/net/wireless/uwe5622/unisocwcn/platform/wcn_procfs.c
+++ b/drivers/net/wireless/uwe5622/unisocwcn/platform/wcn_procfs.c
@@ -431,7 +431,7 @@ static const struct proc_ops mdbg_snap_shoot_seq_fops = {
 static int mdbg_proc_open(struct inode *inode, struct file *filp)
 {
 	struct mdbg_proc_entry *entry =
-		(struct mdbg_proc_entry *)PDE_DATA(inode);
+		(struct mdbg_proc_entry *)pde_data(inode);
 	filp->private_data = entry;
 
 	return 0;
diff --git a/drivers/net/wireless/uwe5622/unisocwcn/usb/wcn_usb_download.c b/drivers/net/wireless/uwe5622/unisocwcn/usb/wcn_usb_download.c
index 8f228d403909..750bfc0466cb 100644
--- a/drivers/net/wireless/uwe5622/unisocwcn/usb/wcn_usb_download.c
+++ b/drivers/net/wireless/uwe5622/unisocwcn/usb/wcn_usb_download.c
@@ -82,7 +82,7 @@ static int wcn_usb_dopen(struct inode *inode, struct file *file)
 {
 	struct wcn_usb_ddata *data;
 
-	data = (struct wcn_usb_ddata *)PDE_DATA(inode);
+	data = (struct wcn_usb_ddata *)pde_data(inode);
 
 	if (!data)
 		return -EIO;
diff --git a/drivers/net/wireless/uwe5622/unisocwcn/usb/wcn_usb_test.c b/drivers/net/wireless/uwe5622/unisocwcn/usb/wcn_usb_test.c
index c2cccc658c0d..e7a9f258943e 100644
--- a/drivers/net/wireless/uwe5622/unisocwcn/usb/wcn_usb_test.c
+++ b/drivers/net/wireless/uwe5622/unisocwcn/usb/wcn_usb_test.c
@@ -61,7 +61,7 @@ static int wcn_usb_channel_open(struct inode *inode, struct file *file)
 {
 	struct channel *channel;
 
-	channel = (struct channel *)PDE_DATA(inode);
+	channel = (struct channel *)pde_data(inode);
 
 	if (!channel)
 		return -EIO;
@@ -467,7 +467,7 @@ static int wcn_usb_chnmg_open(struct inode *inode, struct file *file)
 {
 	struct chnmg *chnmg;
 	/* get channel_list head */
-	chnmg = (struct chnmg *)PDE_DATA(inode);
+	chnmg = (struct chnmg *)pde_data(inode);
 
 	file->private_data = chnmg;
 	return 0;
@@ -916,7 +916,7 @@ static int print_level_open(struct inode *inode, struct file *file)
 {
 	struct chnmg *chnmg;
 	/* get channel_list head */
-	chnmg = (struct chnmg *)PDE_DATA(inode);
+	chnmg = (struct chnmg *)pde_data(inode);
 
 	file->private_data = chnmg;
 	return 0;
diff --git a/drivers/net/wireless/uwe5622/unisocwifi/cfg80211.c b/drivers/net/wireless/uwe5622/unisocwifi/cfg80211.c
index daef880ae3c0..2231388da70a 100644
--- a/drivers/net/wireless/uwe5622/unisocwifi/cfg80211.c
+++ b/drivers/net/wireless/uwe5622/unisocwifi/cfg80211.c
@@ -703,7 +703,7 @@ static int sprdwl_add_cipher_key(struct sprdwl_vif *vif, bool pairwise,
 }
 
 static int sprdwl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
-				   u8 key_index, bool pairwise,
+				   int link_id, u8 key_index, bool pairwise,
 				   const u8 *mac_addr,
 				   struct key_params *params)
 {
@@ -725,7 +725,7 @@ static int sprdwl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
 }
 
 static int sprdwl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev,
-				   u8 key_index, bool pairwise,
+				   int link_id, u8 key_index, bool pairwise,
 				   const u8 *mac_addr)
 {
 	struct sprdwl_vif *vif = netdev_priv(ndev);
@@ -755,7 +755,7 @@ static int sprdwl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev,
 
 static int sprdwl_cfg80211_set_default_key(struct wiphy *wiphy,
 					   struct net_device *ndev,
-					   u8 key_index, bool unicast,
+					   int link_id, u8 key_index, bool unicast,
 					   bool multicast)
 {
 	struct sprdwl_vif *vif = netdev_priv(ndev);
@@ -984,7 +984,7 @@ static int sprdwl_cfg80211_change_beacon(struct wiphy *wiphy,
 	return sprdwl_change_beacon(vif, beacon);
 }
 
-static int sprdwl_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
+static int sprdwl_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev, unsigned int link_id)
 {
 #ifdef DFS_MASTER
 	struct sprdwl_vif *vif = netdev_priv(ndev);
@@ -2367,7 +2367,7 @@ void sprdwl_report_connection(struct sprdwl_vif *vif,
 		 conn_info->status == SPRDWL_ROAM_SUCCESS){
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
 		struct cfg80211_roam_info roam_info = {
-			.bss = bss,
+			.links[0].bss = bss,
 			.req_ie = conn_info->req_ie,
 			.req_ie_len = conn_info->req_ie_len,
 			.resp_ie = conn_info->resp_ie,
diff --git a/drivers/net/wireless/uwe5622/unisocwifi/cmdevt.c b/drivers/net/wireless/uwe5622/unisocwifi/cmdevt.c
index e81619b12e39..1ecbfac5b490 100644
--- a/drivers/net/wireless/uwe5622/unisocwifi/cmdevt.c
+++ b/drivers/net/wireless/uwe5622/unisocwifi/cmdevt.c
@@ -3296,7 +3296,7 @@ void sprdwl_event_chan_changed(struct sprdwl_vif *vif, u8 *data, u16 len)
 						NL80211_CHAN_HT20);
 		else
 			wl_err("%s, ch is null!\n", __func__);
-		cfg80211_ch_switch_notify(vif->ndev, &chandef);
+		cfg80211_ch_switch_notify(vif->ndev, &chandef, 0);
 	}
 }
 
-- 
2.34.1

