You've already forked wifi-rtl8852bs
mirror of
https://github.com/armbian/wifi-rtl8852bs.git
synced 2026-01-06 11:09:01 -08:00
fix api changes in mainline kernel up to 6.16
This commit is contained in:
@@ -720,7 +720,11 @@ struct rtw_timer_list {
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0))
|
||||
static inline void timer_hdl(struct timer_list *in_timer)
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 16, 0)
|
||||
_timer *ptimer = timer_container_of(ptimer, in_timer, timer);
|
||||
#else
|
||||
_timer *ptimer = from_timer(ptimer, in_timer, timer);
|
||||
#endif
|
||||
|
||||
ptimer->function(ptimer->arg);
|
||||
}
|
||||
@@ -760,12 +764,20 @@ __inline static void _set_timer(_timer *ptimer, u32 delay_time)
|
||||
|
||||
__inline static void _cancel_timer(_timer *ptimer, u8 *bcancelled)
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
|
||||
*bcancelled = timer_delete_sync(&ptimer->timer) == 1 ? 1 : 0;
|
||||
#else
|
||||
*bcancelled = del_timer_sync(&ptimer->timer) == 1 ? 1 : 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
__inline static void _cancel_timer_async(_timer *ptimer)
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
|
||||
timer_delete(&ptimer->timer);
|
||||
#else
|
||||
del_timer(&ptimer->timer);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*work*/
|
||||
|
||||
@@ -238,7 +238,9 @@ u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, struct rtw_chan_def *rtw_chd
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0))
|
||||
if (started) {
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0))
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 9, 0))
|
||||
cfg80211_ch_switch_started_notify(adapter->pnetdev, &chdef, alink->mlmepriv.link_id, 0, false);
|
||||
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0))
|
||||
cfg80211_ch_switch_started_notify(adapter->pnetdev, &chdef, alink->mlmepriv.link_id, 0, false, 0);
|
||||
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
|
||||
cfg80211_ch_switch_started_notify(adapter->pnetdev, &chdef, alink->mlmepriv.link_id, 0, false);
|
||||
@@ -263,7 +265,9 @@ u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, struct rtw_chan_def *rtw_chd
|
||||
if (!rtw_cfg80211_allow_ch_switch_notify(adapter))
|
||||
goto exit;
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0))
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 9, 0))
|
||||
cfg80211_ch_switch_notify(adapter->pnetdev, &chdef, alink->mlmepriv.link_id);
|
||||
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0))
|
||||
cfg80211_ch_switch_notify(adapter->pnetdev, &chdef, alink->mlmepriv.link_id, 0);
|
||||
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2))
|
||||
cfg80211_ch_switch_notify(adapter->pnetdev, &chdef, 0);
|
||||
@@ -4599,6 +4603,9 @@ static int cfg80211_rtw_set_txpower(struct wiphy *wiphy,
|
||||
static int cfg80211_rtw_get_txpower(struct wiphy *wiphy,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
|
||||
struct wireless_dev *wdev,
|
||||
#endif
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 14, 0))
|
||||
unsigned int link_id,
|
||||
#endif
|
||||
int *dbm)
|
||||
{
|
||||
@@ -5625,7 +5632,12 @@ static int rtw_cfg80211_set_beacon_ies(struct net_device *net, const u8 *head,
|
||||
}
|
||||
|
||||
static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *ndev,
|
||||
struct cfg80211_beacon_data *info)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0))
|
||||
struct cfg80211_ap_update *info
|
||||
#else
|
||||
struct cfg80211_beacon_data *info
|
||||
#endif
|
||||
)
|
||||
{
|
||||
int ret = 0;
|
||||
_adapter *adapter = (_adapter *)rtw_netdev_priv(ndev);
|
||||
@@ -5642,15 +5654,29 @@ static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *nd
|
||||
rtw_cfg80211_set_proberesp_ies(ndev, info->proberesp_ies, info->proberesp_ies_len);
|
||||
#endif /* not_yet */
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0))
|
||||
if (info->beacon.assocresp_ies_len > 0)
|
||||
rtw_cfg80211_set_assocresp_ies(ndev, info->beacon.assocresp_ies, info->beacon.assocresp_ies_len);
|
||||
#else
|
||||
if (info->assocresp_ies_len > 0)
|
||||
rtw_cfg80211_set_assocresp_ies(ndev, info->assocresp_ies, info->assocresp_ies_len);
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0))
|
||||
if (rtw_cfg80211_check_beacon_ies(ndev, info->beacon.head, info->beacon.head_len,
|
||||
info->beacon.tail, info->beacon.tail_len) != 0) {
|
||||
ret = rtw_add_beacon(adapter, info->beacon.head, info->beacon.head_len,
|
||||
info->beacon.tail, info->beacon.tail_len);
|
||||
rtw_cfg80211_set_beacon_ies(ndev, info->beacon.head, info->beacon.head_len,
|
||||
info->beacon.tail, info->beacon.tail_len);
|
||||
#else
|
||||
if (rtw_cfg80211_check_beacon_ies(ndev, info->head, info->head_len,
|
||||
info->tail, info->tail_len) != 0) {
|
||||
ret = rtw_add_beacon(adapter, info->head, info->head_len,
|
||||
info->tail, info->tail_len);
|
||||
rtw_cfg80211_set_beacon_ies(ndev, info->head, info->head_len,
|
||||
info->tail, info->tail_len);
|
||||
#endif
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -6599,6 +6625,9 @@ static void rtw_get_chbwoff_from_cfg80211_chan_def(
|
||||
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) */
|
||||
|
||||
static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0))
|
||||
, struct net_device *dev
|
||||
#endif
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
|
||||
, struct cfg80211_chan_def *chandef
|
||||
#else
|
||||
|
||||
@@ -517,13 +517,25 @@ static void rtw_ethtool_get_drvinfo(struct net_device *dev, struct ethtool_drvin
|
||||
|
||||
wdev = dev->ieee80211_ptr;
|
||||
if (wdev) {
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0)
|
||||
strscpy(info->driver, wiphy_dev(wdev->wiphy)->driver->name,
|
||||
#else
|
||||
strlcpy(info->driver, wiphy_dev(wdev->wiphy)->driver->name,
|
||||
#endif
|
||||
sizeof(info->driver));
|
||||
} else {
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0)
|
||||
strscpy(info->driver, "N/A", sizeof(info->driver));
|
||||
#else
|
||||
strlcpy(info->driver, "N/A", sizeof(info->driver));
|
||||
#endif
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0)
|
||||
strscpy(info->version, DRIVERVERSION, sizeof(info->version));
|
||||
#else
|
||||
strlcpy(info->version, DRIVERVERSION, sizeof(info->version));
|
||||
#endif
|
||||
|
||||
padapter = (_adapter *)rtw_netdev_priv(dev);
|
||||
|
||||
@@ -540,10 +552,18 @@ static void rtw_ethtool_get_drvinfo(struct net_device *dev, struct ethtool_drvin
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0)
|
||||
strscpy(info->fw_version, "N/A", sizeof(info->fw_version));
|
||||
#else
|
||||
strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
|
||||
#endif
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0)
|
||||
strscpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)),
|
||||
#else
|
||||
strlcpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)),
|
||||
#endif
|
||||
sizeof(info->bus_info));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user