From 76df854db43320ca4adf83e1c543cf1ba85b6a53 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Sat, 16 Feb 2019 01:13:16 +0100 Subject: [PATCH 1/5] =?UTF-8?q?Fix=20implicit=20declaration=20of=20functio?= =?UTF-8?q?n=20=E2=80=98rtw=5Fresume=5Fprocess=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/hal_data.h | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/include/hal_data.h b/include/hal_data.h index 516f5df..fca1c2e 100644 --- a/include/hal_data.h +++ b/include/hal_data.h @@ -1024,18 +1024,29 @@ int rtw_halmac_deinit_adapter(struct dvobj_priv *); #define REG_APK rAPK #define REG_ANTSEL_SW_JAGUAR r_ANTSEL_SW_Jaguar - - #define rf_welut_jaguar RF_WeLut_Jaguar #define rf_mode_table_addr RF_ModeTableAddr #define rf_mode_table_data0 RF_ModeTableData0 #define rf_mode_table_data1 RF_ModeTableData1 - - - - - #define RX_SMOOTH_FACTOR Rx_Smooth_Factor +#if defined(CONFIG_RESUME_IN_WORKQUEUE) || defined(CONFIG_HAS_EARLYSUSPEND) +int rtw_resume_process(_adapter *padapter); +#endif +#ifdef CONFIG_ANDROID_POWER +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) +int rtw_resume_process(PADAPTER padapter); +#endif +#endif +#ifdef CONFIG_AUTOSUSPEND +void autosuspend_enter(_adapter* padapter); +int autoresume_enter(_adapter* padapter); +#endif + +#ifdef SUPPORT_HW_RFOFF_DETECTED +int rtw_hw_suspend(_adapter *padapter ); +int rtw_hw_resume(_adapter *padapter); +#endif + #endif /* __HAL_DATA_H__ */ From 1ff4839d5bbe42448dd66ea27d6ae5338601e86c Mon Sep 17 00:00:00 2001 From: kimocoder Date: Sat, 16 Feb 2019 02:11:55 +0100 Subject: [PATCH 2/5] Make proper fix for freeze on unload --- include/autoconf.h | 2 +- os_dep/linux/os_intfs.c | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/autoconf.h b/include/autoconf.h index 20588ab..030a3c0 100644 --- a/include/autoconf.h +++ b/include/autoconf.h @@ -33,7 +33,7 @@ #define PLATFORM_LINUX -/* #define CONFIG_IOCTL_CFG80211 1 */ +#define CONFIG_IOCTL_CFG80211 1 #ifdef CONFIG_IOCTL_CFG80211 /* #define RTW_USE_CFG80211_STA_EVENT */ /* Indecate new sta asoc through cfg80211_new_sta */ diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index cabb2e3..b3c82c8 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -1650,10 +1650,6 @@ void rtw_os_ndev_unregister(_adapter *adapter) netdev = adapter->pnetdev; -#if defined(CONFIG_IOCTL_CFG80211) - rtw_cfg80211_ndev_res_unregister(adapter); -#endif - if ((adapter->DriverState != DRIVER_DISAPPEAR) && netdev) { struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); u8 rtnl_lock_needed = rtw_rtnl_lock_needed(dvobj); @@ -1663,6 +1659,9 @@ void rtw_os_ndev_unregister(_adapter *adapter) else unregister_netdevice(netdev); } +#if defined(CONFIG_IOCTL_CFG80211) + rtw_cfg80211_ndev_res_unregister(adapter); +#endif #if defined(CONFIG_IOCTL_CFG80211) && !defined(RTW_SINGLE_WIPHY) #ifdef CONFIG_RFKILL_POLL From eaf2707950caf40bf7a444ccead524eef395404c Mon Sep 17 00:00:00 2001 From: kimocoder Date: Sat, 16 Feb 2019 02:20:27 +0100 Subject: [PATCH 3/5] Reorder shutdown to eliminate warning from cfg80211 --- os_dep/linux/os_intfs.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index b3c82c8..3e182a5 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -1650,19 +1650,21 @@ void rtw_os_ndev_unregister(_adapter *adapter) netdev = adapter->pnetdev; - if ((adapter->DriverState != DRIVER_DISAPPEAR) && netdev) { - struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); - u8 rtnl_lock_needed = rtw_rtnl_lock_needed(dvobj); - - if (rtnl_lock_needed) - unregister_netdev(netdev); - else - unregister_netdevice(netdev); - } #if defined(CONFIG_IOCTL_CFG80211) rtw_cfg80211_ndev_res_unregister(adapter); #endif + if ((adapter->DriverState != DRIVER_DISAPPEAR) && netdev) { + struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); + u8 rtnl_lock_needed = rtw_rtnl_lock_needed(dvobj); + + if (rtnl_lock_needed) + unregister_netdev(netdev); + else + unregister_netdevice(netdev); + } + + #if defined(CONFIG_IOCTL_CFG80211) && !defined(RTW_SINGLE_WIPHY) #ifdef CONFIG_RFKILL_POLL rtw_cfg80211_deinit_rfkill(adapter_to_wiphy(adapter)); From 4848f29d19e0c3543e8d5ba82706e8a1a6b5b04e Mon Sep 17 00:00:00 2001 From: kimocoder Date: Sat, 16 Feb 2019 02:22:54 +0100 Subject: [PATCH 4/5] Protect rtw_cfg80211_unlink_bss() against pnetwork of NULL --- os_dep/linux/ioctl_cfg80211.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index c3c5d91..76a3f26 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -2525,9 +2525,13 @@ void rtw_cfg80211_unlink_bss(_adapter *padapter, struct wlan_network *pnetwork) struct wireless_dev *pwdev = padapter->rtw_wdev; struct wiphy *wiphy = pwdev->wiphy; struct cfg80211_bss *bss = NULL; - WLAN_BSSID_EX select_network = pnetwork->network; + WLAN_BSSID_EX select_network; - bss = cfg80211_get_bss(wiphy, NULL/*notify_channel*/, + if (!pnetwork) + return; + select_network = pnetwork->network; + + bss = cfg80211_get_bss(wiphy, NULL /*notify_channel*/, select_network.MacAddress, select_network.Ssid.Ssid, select_network.Ssid.SsidLength, #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0) From a3ed1ef28a413ab81f4344163042eecf1a5b9c11 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Sat, 16 Feb 2019 02:29:58 +0100 Subject: [PATCH 5/5] Added some error checking feature --- core/rtw_sta_mgt.c | 2 ++ os_dep/linux/ioctl_cfg80211.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/core/rtw_sta_mgt.c b/core/rtw_sta_mgt.c index 17c0257..bd4ee19 100644 --- a/core/rtw_sta_mgt.c +++ b/core/rtw_sta_mgt.c @@ -519,6 +519,8 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, const u8 *hwaddr) } else { psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue), struct sta_info, list); + if (!psta) + goto exit; rtw_list_delete(&(psta->list)); /* _exit_critical_bh(&(pfree_sta_queue->lock), &irqL); */ diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 76a3f26..1a1c213 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -2542,10 +2542,18 @@ void rtw_cfg80211_unlink_bss(_adapter *padapter, struct wlan_network *pnetwork) select_network.InfrastructureMode == Ndis802_11Infrastructure?WLAN_CAPABILITY_ESS:WLAN_CAPABILITY_IBSS); #endif + if (!wiphy) { + pr_info("rtl8723bu: rtw_cfg80211_unlink_bss: wiphy is NULL\n"); + return; + } + + if (bss) { cfg80211_unlink_bss(wiphy, bss); RTW_INFO("%s(): cfg80211_unlink %s!!\n", __func__, select_network.Ssid.Ssid); #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) + if (!padapter->rtw_wdev->wiphy) + return; cfg80211_put_bss(padapter->rtw_wdev->wiphy, bss); #else cfg80211_put_bss(bss);