[Kernel/Drive] 旧版内核按新版内核修改API导致驱动不兼容
Tofloor
poster avatar
Ethan
deepin
17 hours ago
Author

如题,上一版内核和目前版本内核区别
image.png

开源驱动根据#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0))判断,导致识别API错误。以下是个人强制修复patch代码,但是对于非驱动开发工程师来说,应该比较难理解。非常不建议合并新驱动修改API.

diff --git a/drivers/aic8800/aic8800_fdrv/rwnx_main.c b/drivers/aic8800/aic8800_fdrv/rwnx_main.c
index 2b1d07a..d9c0071 100644
--- a/drivers/aic8800/aic8800_fdrv/rwnx_main.c
+++ b/drivers/aic8800/aic8800_fdrv/rwnx_main.c
@@ -4146,7 +4146,7 @@ cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
}
#endif

-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0))
+#if 1
static int rwnx_cfg80211_set_monitor_channel(struct wiphy *wiphy, struct net_device *dev,
struct cfg80211_chan_def *chandef)
#else
@@ -4206,7 +4206,7 @@ static int rwnx_cfg80211_set_monitor_channel(struct wiphy *wiphy,
}

-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0))
+#if 1
int rwnx_cfg80211_set_monitor_channel_(struct wiphy *wiphy,
struct net_device *dev,
struct cfg80211_chan_def *chandef)
@@ -4701,7 +4701,7 @@ static int rwnx_cfg80211_get_channel(struct wiphy *wiphy,
if (rwnx_vif->vif_index == rwnx_hw->monitor_vif)
{
//retrieve channel from firmware
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0))
+#if 1
rwnx_cfg80211_set_monitor_channel(wiphy, wdev->netdev, NULL);
#else
rwnx_cfg80211_set_monitor_channel(wiphy, NULL);

Reply Favorite View the author
All Replies
deepin-superuser
deepin
7 hours ago
#1

给你的代码加个高亮

diff --git a/drivers/aic8800/aic8800_fdrv/rwnx_main.c b/drivers/aic8800/aic8800_fdrv/rwnx_main.c
index 2b1d07a..d9c0071 100644
--- a/drivers/aic8800/aic8800_fdrv/rwnx_main.c
+++ b/drivers/aic8800/aic8800_fdrv/rwnx_main.c
@@ -4146,7 +4146,7 @@ cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
}
#endif

-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0))
+#if 1
static int rwnx_cfg80211_set_monitor_channel(struct wiphy *wiphy, struct net_device *dev,
struct cfg80211_chan_def *chandef)
#else
@@ -4206,7 +4206,7 @@ static int rwnx_cfg80211_set_monitor_channel(struct wiphy *wiphy,
}

-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0))
+#if 1
int rwnx_cfg80211_set_monitor_channel_(struct wiphy *wiphy,
struct net_device *dev,
struct cfg80211_chan_def *chandef)
@@ -4701,7 +4701,7 @@ static int rwnx_cfg80211_get_channel(struct wiphy *wiphy,
if (rwnx_vif->vif_index == rwnx_hw->monitor_vif)
{
//retrieve channel from firmware
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0))
+#if 1
rwnx_cfg80211_set_monitor_channel(wiphy, wdev->netdev, NULL);
#else
rwnx_cfg80211_set_monitor_channel(wiphy, NULL);
Reply View the author
deepin-superuser
deepin
7 hours ago
#2

把 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)) 修改为 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 65)) 更好吧

Reply View the author
忘怀
deepin
5 hours ago
#3

支持别的无线网卡导致的问题,预计下个版本在6.12.66修复

Reply View the author