hc
2023-11-06 e3e12f52b214121840b44c91de5b3e5af5d3eb84
kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux.c
....@@ -65,6 +65,11 @@
6565 #include <asm/uaccess.h>
6666 #include <asm/unaligned.h>
6767 #include <dhd_linux_priv.h>
68
+#ifdef BCMPCIE
69
+#if defined(CUSTOMER_HW_ROCKCHIP) && defined(CUSTOMER_HW_ROCKCHIP_RK3588)
70
+#include <rk_dhd_pcie_linux.h>
71
+#endif /* CUSTOMER_HW_ROCKCHIP && CUSTOMER_HW_ROCKCHIP_RK3588 */
72
+#endif /* BCMPCIE */
6873
6974 #include <epivers.h>
7075 #include <bcmutils.h>
....@@ -1142,9 +1147,16 @@
11421147 dhd_pub_t *dhd = &dhdinfo->pub;
11431148 struct dhd_conf *conf = dhd->conf;
11441149 int suspend_mode = conf->suspend_mode;
1150
+#if defined(BCMDBUS) && defined(WL_EXT_WOWL)
1151
+ int wowl_dngldown = 0;
1152
+#endif
11451153
11461154 BCM_REFERENCE(dhdinfo);
11471155 BCM_REFERENCE(suspend);
1156
+
1157
+#if defined(BCMDBUS) && defined(WL_EXT_WOWL)
1158
+ wowl_dngldown = dhd_conf_wowl_dngldown(dhd);
1159
+#endif
11481160
11491161 switch (action) {
11501162 case PM_HIBERNATION_PREPARE:
....@@ -1189,7 +1201,16 @@
11891201 dhd_suspend_resume_helper(dhdinfo, suspend, 0);
11901202 #ifdef BCMDBUS
11911203 } else {
1192
- printf("%s: skip resume since bus suspeneded\n", __FUNCTION__);
1204
+#if defined(BCMDBUS) && defined(WL_EXT_WOWL)
1205
+ if (wowl_dngldown) {
1206
+ printf("%s: reset power\n", __FUNCTION__);
1207
+ dhd_wifi_platform_set_power(dhd, FALSE);
1208
+ dhd_wifi_platform_set_power(dhd, TRUE);
1209
+ } else
1210
+#endif
1211
+ {
1212
+ printf("%s: skip resume since bus suspeneded\n", __FUNCTION__);
1213
+ }
11931214 }
11941215 #endif
11951216 }
....@@ -3545,6 +3566,9 @@
35453566 return;
35463567 }
35473568
3569
+#ifdef DHD_NOTIFY_MAC_CHANGED
3570
+ rtnl_lock();
3571
+#endif /* DHD_NOTIFY_MAC_CHANGED */
35483572 dhd_net_if_lock_local(dhd);
35493573 DHD_OS_WAKE_LOCK(&dhd->pub);
35503574
....@@ -3559,22 +3583,17 @@
35593583
35603584 ifp->set_macaddress = FALSE;
35613585
3562
-#ifdef DHD_NOTIFY_MAC_CHANGED
3563
- rtnl_lock();
3564
-#endif /* DHD_NOTIFY_MAC_CHANGED */
3565
-
35663586 if (_dhd_set_mac_address(dhd, ifp->idx, ifp->mac_addr, TRUE) == 0)
35673587 DHD_INFO(("%s: MACID is overwritten\n", __FUNCTION__));
35683588 else
35693589 DHD_ERROR(("%s: _dhd_set_mac_address() failed\n", __FUNCTION__));
35703590
3571
-#ifdef DHD_NOTIFY_MAC_CHANGED
3572
- rtnl_unlock();
3573
-#endif /* DHD_NOTIFY_MAC_CHANGED */
3574
-
35753591 done:
35763592 DHD_OS_WAKE_UNLOCK(&dhd->pub);
35773593 dhd_net_if_unlock_local(dhd);
3594
+#ifdef DHD_NOTIFY_MAC_CHANGED
3595
+ rtnl_unlock();
3596
+#endif /* DHD_NOTIFY_MAC_CHANGED */
35783597 }
35793598
35803599 static void
....@@ -4413,24 +4432,13 @@
44134432 #endif
44144433 /* Make sure there's enough room for any header */
44154434 #if !defined(BCM_ROUTER_DHD)
4416
- if (skb_headroom(skb) < dhd->pub.hdrlen + htsfdlystat_sz) {
4417
- struct sk_buff *skb2;
4418
-
4419
- DHD_INFO(("%s: insufficient headroom\n",
4420
- dhd_ifname(&dhd->pub, ifidx)));
4421
- dhd->pub.tx_realloc++;
4422
-
4435
+ if (skb_cow(skb, (dhd->pub.hdrlen + htsfdlystat_sz))) {
4436
+ DHD_ERROR(("%s: skb_cow failed\n",
4437
+ dhd_ifname(&dhd->pub, ifidx)));
44234438 bcm_object_trace_opr(skb, BCM_OBJDBG_REMOVE, __FUNCTION__, __LINE__);
4424
- skb2 = skb_realloc_headroom(skb, dhd->pub.hdrlen + htsfdlystat_sz);
4425
-
4426
- dev_kfree_skb(skb);
4427
- if ((skb = skb2) == NULL) {
4428
- DHD_ERROR(("%s: skb_realloc_headroom failed\n",
4429
- dhd_ifname(&dhd->pub, ifidx)));
4430
- ret = -ENOMEM;
4431
- goto done;
4432
- }
4433
- bcm_object_trace_opr(skb, BCM_OBJDBG_ADD_PKT, __FUNCTION__, __LINE__);
4439
+ dev_kfree_skb_any(skb);
4440
+ ret = -ENOMEM;
4441
+ goto done;
44344442 }
44354443 #endif /* !BCM_ROUTER_DHD */
44364444
....@@ -8705,16 +8713,6 @@
87058713 }
87068714 #endif /* DHD_PCIE_NATIVE_RUNTIMEPM */
87078715
8708
-#ifdef CONFIG_HAS_WAKELOCK
8709
-#define dhd_wake_lock_unlock_destroy(wlock) \
8710
-{ \
8711
- if (dhd_wake_lock_active(wlock)) { \
8712
- dhd_wake_unlock(wlock); \
8713
- } \
8714
- dhd_wake_lock_destroy(wlock); \
8715
-}
8716
-#endif /* CONFIG_HAS_WAKELOCK */
8717
-
87188716 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) && defined(DHD_TCP_LIMIT_OUTPUT)
87198717 #define DHD_TCP_LIMIT_OUTPUT_BYTES (4 * 1024 * 1024)
87208718 #ifndef TCP_DEFAULT_LIMIT_OUTPUT
....@@ -8784,7 +8782,7 @@
87848782
87858783 #if defined(WL_STATIC_IF) && defined(WL_CFG80211)
87868784 /* If static if is operational, don't reset the chip */
8787
- if (wl_cfg80211_static_if_active(cfg)) {
8785
+ if ((!dhd->pub.hang_was_sent) && wl_cfg80211_static_if_active(cfg)) {
87888786 WL_MSG(net->name, "static if operational. skip chip reset.\n");
87898787 skip_reset = true;
87908788 wl_cfg80211_sta_ifdown(net);
....@@ -8792,7 +8790,7 @@
87928790 }
87938791 #endif /* WL_STATIC_IF && WL_CFG80211 */
87948792 #ifdef DHD_NOTIFY_MAC_CHANGED
8795
- if (dhd->pub.skip_dhd_stop) {
8793
+ if (!dhd->pub.hang_was_sent && dhd->pub.skip_dhd_stop) {
87968794 WL_MSG(net->name, "skip chip reset.\n");
87978795 skip_reset = true;
87988796 #if defined(WL_CFG80211)
....@@ -10448,8 +10446,13 @@
1044810446 #endif /* DHDTCPACK_SUPPRESS && BCMPCIE */
1044910447 if (need_rtnl_lock)
1045010448 unregister_netdev(ifp->net);
10451
- else
10449
+ else {
10450
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)) && defined(WL_CFG80211)
10451
+ cfg80211_unregister_netdevice(ifp->net);
10452
+#else
1045210453 unregister_netdevice(ifp->net);
10454
+#endif
10455
+ }
1045310456 #if defined(WLDWDS) && defined(WL_EXT_IAPSTA)
1045410457 if (ifp->dwds) {
1045510458 wl_ext_iapsta_dettach_dwds_netdev(ifp->net, ifidx, ifp->bssidx);
....@@ -11649,9 +11652,7 @@
1164911652 dhd->wakelock_counter = 0;
1165011653 /* wakelocks prevent a system from going into a low power state */
1165111654 #ifdef CONFIG_HAS_WAKELOCK
11652
- // terence 20161023: can not destroy wl_wifi when wlan down, it will happen null pointer in dhd_ioctl_entry
11653
- dhd_wake_lock_init(&dhd->wl_wifi, WAKE_LOCK_SUSPEND, "wlan_wake");
11654
- dhd_wake_lock_init(&dhd->wl_wdwake, WAKE_LOCK_SUSPEND, "wlan_wd_wake");
11655
+ dhd_wake_lock_init(dhd->wl_wdwake, dhd_bus_to_dev(bus), "wlan_wd_wake");
1165511656 #endif /* CONFIG_HAS_WAKELOCK */
1165611657
1165711658 #if defined(OEM_ANDROID)
....@@ -11757,11 +11758,7 @@
1175711758 dhd_os_start_logging(&dhd->pub, BT_LOG_RING_NAME, 3, 0, 0, 0);
1175811759 #endif /* !OEM_ANDROID && BTLOG */
1175911760 #ifdef DBG_PKT_MON
11760
- dhd->pub.dbg->pkt_mon_lock = osl_mutex_lock_init(dhd->pub.osh);
11761
- if (!dhd->pub.dbg->pkt_mon_lock) {
11762
- DHD_ERROR(("%s: pkt_mon_lock init failed !\n", __FUNCTION__));
11763
- goto fail;
11764
- }
11761
+ dhd->pub.dbg->pkt_mon_lock = osl_spin_lock_init(dhd->pub.osh);
1176511762 #ifdef DBG_PKT_MON_INIT_DEFAULT
1176611763 dhd_os_dbg_attach_pkt_monitor(&dhd->pub);
1176711764 #endif /* DBG_PKT_MON_INIT_DEFAULT */
....@@ -12790,6 +12787,13 @@
1279012787 /* Enable L1SS of RC and EP */
1279112788 dhd_bus_l1ss_enable_rc_ep(dhdp->bus, TRUE);
1279212789 #endif /* BT_OVER_PCIE */
12790
+
12791
+#ifdef BCMPCIE
12792
+#if defined(CUSTOMER_HW_ROCKCHIP) && defined(CUSTOMER_HW_ROCKCHIP_RK3588)
12793
+ if (IS_ENABLED(CONFIG_PCIEASPM_ROCKCHIP_WIFI_EXTENSION))
12794
+ rk_dhd_bus_l1ss_enable_rc_ep(dhdp->bus, TRUE);
12795
+#endif /* CUSTOMER_HW_ROCKCHIP && BCMPCIE */
12796
+#endif /* BCMPCIE */
1279312797
1279412798 #if defined(CONFIG_ARCH_EXYNOS) && defined(BCMPCIE)
1279512799 #if !defined(CONFIG_SOC_EXYNOS8890) && !defined(SUPPORT_EXYNOS7420)
....@@ -17455,7 +17459,7 @@
1745517459 if (dhdp->dbg) {
1745617460 #ifdef DBG_PKT_MON
1745717461 dhd_os_dbg_detach_pkt_monitor(dhdp);
17458
- osl_mutex_lock_deinit(dhd->pub.osh, dhd->pub.dbg->pkt_mon_lock);
17462
+ osl_spin_lock_deinit(dhd->pub.osh, dhd->pub.dbg->pkt_mon_lock);
1745917463 #endif /* DBG_PKT_MON */
1746017464 }
1746117465 #endif /* DEBUGABILITY */
....@@ -17541,9 +17545,7 @@
1754117545 DHD_TRACE(("wd wakelock count:%d\n", dhd->wakelock_wd_counter));
1754217546 #ifdef CONFIG_HAS_WAKELOCK
1754317547 dhd->wakelock_wd_counter = 0;
17544
- dhd_wake_lock_unlock_destroy(&dhd->wl_wdwake);
17545
- // terence 20161023: can not destroy wl_wifi when wlan down, it will happen null pointer in dhd_ioctl_entry
17546
- dhd_wake_lock_unlock_destroy(&dhd->wl_wifi);
17548
+ dhd_wake_lock_destroy(dhd->wl_wdwake);
1754717549 #endif /* CONFIG_HAS_WAKELOCK */
1754817550 if (dhd->dhd_state & DHD_ATTACH_STATE_WAKELOCKS_INIT) {
1754917551 DHD_OS_WAKE_LOCK_DESTROY(dhd);
....@@ -18423,7 +18425,7 @@
1842318425 /* convert to BCME_NOTFOUND error for error handling */
1842418426 ret = BCME_NOTFOUND;
1842518427 } else
18426
- DHD_ERROR(("%s: %s (%zu bytes) open success\n", __FUNCTION__, file_path, (*fw)->size));
18428
+ DHD_ERROR(("%s: %s (%zu bytes) open success\n", __FUNCTION__, file_path, (*fw)->size));
1842718429
1842818430 return ret;
1842918431 }
....@@ -21151,11 +21153,15 @@
2115121153 ret = dhd->wakelock_rx_timeout_enable > dhd->wakelock_ctrl_timeout_enable ?
2115221154 dhd->wakelock_rx_timeout_enable : dhd->wakelock_ctrl_timeout_enable;
2115321155 #ifdef CONFIG_HAS_WAKELOCK
21156
+#ifdef DHD_DEBUG_WAKE_LOCK
21157
+ printf("%s: rx_timeout=%dms, ctrl_timeout=%dms\n", __FUNCTION__,
21158
+ dhd->wakelock_rx_timeout_enable, dhd->wakelock_ctrl_timeout_enable);
21159
+#endif
2115421160 if (dhd->wakelock_rx_timeout_enable)
21155
- dhd_wake_lock_timeout(&dhd->wl_rxwake,
21161
+ dhd_wake_lock_timeout(dhd->wl_rxwake,
2115621162 msecs_to_jiffies(dhd->wakelock_rx_timeout_enable));
2115721163 if (dhd->wakelock_ctrl_timeout_enable)
21158
- dhd_wake_lock_timeout(&dhd->wl_ctrlwake,
21164
+ dhd_wake_lock_timeout(dhd->wl_ctrlwake,
2115921165 msecs_to_jiffies(dhd->wakelock_ctrl_timeout_enable));
2116021166 #endif
2116121167 dhd->wakelock_rx_timeout_enable = 0;
....@@ -21212,8 +21218,8 @@
2121221218 DHD_WAKE_SPIN_LOCK(&dhd->wakelock_spinlock, flags);
2121321219 dhd->wakelock_ctrl_timeout_enable = 0;
2121421220 #ifdef CONFIG_HAS_WAKELOCK
21215
- if (dhd_wake_lock_active(&dhd->wl_ctrlwake))
21216
- dhd_wake_unlock(&dhd->wl_ctrlwake);
21221
+ if (dhd_wake_lock_active(dhd->wl_ctrlwake))
21222
+ dhd_wake_unlock(dhd->wl_ctrlwake);
2121721223 #endif
2121821224 DHD_WAKE_SPIN_UNLOCK(&dhd->wakelock_spinlock, flags);
2121921225 }
....@@ -21447,7 +21453,7 @@
2144721453 DHD_WAKE_SPIN_LOCK(&dhd->wakelock_spinlock, flags);
2144821454 if (dhd->wakelock_counter == 0 && !dhd->waive_wakelock) {
2144921455 #ifdef CONFIG_HAS_WAKELOCK
21450
- dhd_wake_lock(&dhd->wl_wifi);
21456
+ dhd_wake_lock(dhd->wl_wifi);
2145121457 #elif defined(BCMSDIO)
2145221458 dhd_bus_dev_pm_stay_awake(pub);
2145321459 #endif
....@@ -21471,7 +21477,7 @@
2147121477
2147221478 if (dhd) {
2147321479 #ifdef CONFIG_HAS_WAKELOCK
21474
- dhd_wake_lock(&dhd->wl_evtwake);
21480
+ dhd_wake_lock(dhd->wl_evtwake);
2147521481 #elif defined(BCMSDIO)
2147621482 dhd_bus_dev_pm_stay_awake(pub);
2147721483 #endif
....@@ -21485,7 +21491,7 @@
2148521491 dhd_info_t *dhd = (dhd_info_t *)(pub->info);
2148621492
2148721493 if (dhd) {
21488
- dhd_wake_lock_timeout(&dhd->wl_pmwake, msecs_to_jiffies(val));
21494
+ dhd_wake_lock_timeout(dhd->wl_pmwake, msecs_to_jiffies(val));
2148921495 }
2149021496 #endif /* CONFIG_HAS_WAKE_LOCK */
2149121497 }
....@@ -21497,7 +21503,7 @@
2149721503 dhd_info_t *dhd = (dhd_info_t *)(pub->info);
2149821504
2149921505 if (dhd) {
21500
- dhd_wake_lock_timeout(&dhd->wl_txflwake, msecs_to_jiffies(val));
21506
+ dhd_wake_lock_timeout(dhd->wl_txflwake, msecs_to_jiffies(val));
2150121507 }
2150221508 #endif /* CONFIG_HAS_WAKE_LOCK */
2150321509 }
....@@ -21509,7 +21515,7 @@
2150921515 dhd_info_t *dhd = (dhd_info_t *)(pub->info);
2151021516
2151121517 if (dhd) {
21512
- dhd_wake_lock_timeout(&dhd->wl_nanwake, msecs_to_jiffies(val));
21518
+ dhd_wake_lock_timeout(dhd->wl_nanwake, msecs_to_jiffies(val));
2151321519 }
2151421520 #endif /* CONFIG_HAS_WAKE_LOCK */
2151521521 }
....@@ -21543,7 +21549,7 @@
2154321549 #endif /* DHD_TRACE_WAKE_LOCK */
2154421550 if (dhd->wakelock_counter == 0 && !dhd->waive_wakelock) {
2154521551 #ifdef CONFIG_HAS_WAKELOCK
21546
- dhd_wake_unlock(&dhd->wl_wifi);
21552
+ dhd_wake_unlock(dhd->wl_wifi);
2154721553 #elif defined(BCMSDIO)
2154821554 dhd_bus_dev_pm_relax(pub);
2154921555 #endif
....@@ -21561,7 +21567,7 @@
2156121567
2156221568 if (dhd) {
2156321569 #ifdef CONFIG_HAS_WAKELOCK
21564
- dhd_wake_unlock(&dhd->wl_evtwake);
21570
+ dhd_wake_unlock(dhd->wl_evtwake);
2156521571 #elif defined(BCMSDIO)
2156621572 dhd_bus_dev_pm_relax(pub);
2156721573 #endif
....@@ -21575,8 +21581,8 @@
2157521581
2157621582 if (dhd) {
2157721583 /* if wl_pmwake is active, unlock it */
21578
- if (dhd_wake_lock_active(&dhd->wl_pmwake)) {
21579
- dhd_wake_unlock(&dhd->wl_pmwake);
21584
+ if (dhd_wake_lock_active(dhd->wl_pmwake)) {
21585
+ dhd_wake_unlock(dhd->wl_pmwake);
2158021586 }
2158121587 }
2158221588 #endif /* CONFIG_HAS_WAKELOCK */
....@@ -21589,8 +21595,8 @@
2158921595
2159021596 if (dhd) {
2159121597 /* if wl_txflwake is active, unlock it */
21592
- if (dhd_wake_lock_active(&dhd->wl_txflwake)) {
21593
- dhd_wake_unlock(&dhd->wl_txflwake);
21598
+ if (dhd_wake_lock_active(dhd->wl_txflwake)) {
21599
+ dhd_wake_unlock(dhd->wl_txflwake);
2159421600 }
2159521601 }
2159621602 #endif /* CONFIG_HAS_WAKELOCK */
....@@ -21603,8 +21609,8 @@
2160321609
2160421610 if (dhd) {
2160521611 /* if wl_nanwake is active, unlock it */
21606
- if (dhd_wake_lock_active(&dhd->wl_nanwake)) {
21607
- dhd_wake_unlock(&dhd->wl_nanwake);
21612
+ if (dhd_wake_lock_active(dhd->wl_nanwake)) {
21613
+ dhd_wake_unlock(dhd->wl_nanwake);
2160821614 }
2160921615 }
2161021616 #endif /* CONFIG_HAS_WAKELOCK */
....@@ -21629,8 +21635,8 @@
2162921635
2163021636 #ifdef CONFIG_HAS_WAKELOCK
2163121637 c = dhd->wakelock_counter;
21632
- l1 = dhd_wake_lock_active(&dhd->wl_wifi);
21633
- l2 = dhd_wake_lock_active(&dhd->wl_wdwake);
21638
+ l1 = dhd_wake_lock_active(dhd->wl_wifi);
21639
+ l2 = dhd_wake_lock_active(dhd->wl_wdwake);
2163421640 lock_active = (l1 || l2);
2163521641 /* Indicate to the SD Host to avoid going to suspend if internal locks are up */
2163621642 if (lock_active) {
....@@ -21673,20 +21679,20 @@
2167321679
2167421680 #ifdef CONFIG_HAS_WAKELOCK
2167521681 c = dhd->wakelock_counter;
21676
- l1 = dhd_wake_lock_active(&dhd->wl_wifi);
21677
- l2 = dhd_wake_lock_active(&dhd->wl_wdwake);
21678
- l3 = dhd_wake_lock_active(&dhd->wl_rxwake);
21679
- l4 = dhd_wake_lock_active(&dhd->wl_ctrlwake);
21680
- l7 = dhd_wake_lock_active(&dhd->wl_evtwake);
21682
+ l1 = dhd_wake_lock_active(dhd->wl_wifi);
21683
+ l2 = dhd_wake_lock_active(dhd->wl_wdwake);
21684
+ l3 = dhd_wake_lock_active(dhd->wl_rxwake);
21685
+ l4 = dhd_wake_lock_active(dhd->wl_ctrlwake);
21686
+ l7 = dhd_wake_lock_active(dhd->wl_evtwake);
2168121687 #ifdef BCMPCIE_OOB_HOST_WAKE
21682
- l5 = dhd_wake_lock_active(&dhd->wl_intrwake);
21688
+ l5 = dhd_wake_lock_active(dhd->wl_intrwake);
2168321689 #endif /* BCMPCIE_OOB_HOST_WAKE */
2168421690 #ifdef DHD_USE_SCAN_WAKELOCK
21685
- l6 = dhd_wake_lock_active(&dhd->wl_scanwake);
21691
+ l6 = dhd_wake_lock_active(dhd->wl_scanwake);
2168621692 #endif /* DHD_USE_SCAN_WAKELOCK */
21687
- l8 = dhd_wake_lock_active(&dhd->wl_pmwake);
21688
- l9 = dhd_wake_lock_active(&dhd->wl_txflwake);
21689
- l10 = dhd_wake_lock_active(&dhd->wl_nanwake);
21693
+ l8 = dhd_wake_lock_active(dhd->wl_pmwake);
21694
+ l9 = dhd_wake_lock_active(dhd->wl_txflwake);
21695
+ l10 = dhd_wake_lock_active(dhd->wl_nanwake);
2169021696 lock_active = (l1 || l2 || l3 || l4 || l5 || l6 || l7 || l8 || l9 || l10);
2169121697
2169221698 /* Indicate to the Host to avoid going to suspend if internal locks are up */
....@@ -21726,7 +21732,7 @@
2172621732 if (dhd->wakelock_wd_counter == 0 && !dhd->waive_wakelock) {
2172721733 #ifdef CONFIG_HAS_WAKELOCK
2172821734 /* if wakelock_wd_counter was never used : lock it at once */
21729
- dhd_wake_lock(&dhd->wl_wdwake);
21735
+ dhd_wake_lock(dhd->wl_wdwake);
2173021736 #endif
2173121737 }
2173221738 dhd->wakelock_wd_counter++;
....@@ -21748,7 +21754,7 @@
2174821754 dhd->wakelock_wd_counter = 0;
2174921755 if (!dhd->waive_wakelock) {
2175021756 #ifdef CONFIG_HAS_WAKELOCK
21751
- dhd_wake_unlock(&dhd->wl_wdwake);
21757
+ dhd_wake_unlock(dhd->wl_wdwake);
2175221758 #endif
2175321759 }
2175421760 }
....@@ -21765,7 +21771,7 @@
2176521771 dhd_info_t *dhd = (dhd_info_t *)(pub->info);
2176621772
2176721773 if (dhd) {
21768
- dhd_wake_lock_timeout(&dhd->wl_intrwake, msecs_to_jiffies(val));
21774
+ dhd_wake_lock_timeout(dhd->wl_intrwake, msecs_to_jiffies(val));
2176921775 }
2177021776 #endif /* CONFIG_HAS_WAKELOCK */
2177121777 }
....@@ -21778,8 +21784,8 @@
2177821784
2177921785 if (dhd) {
2178021786 /* if wl_intrwake is active, unlock it */
21781
- if (dhd_wake_lock_active(&dhd->wl_intrwake)) {
21782
- dhd_wake_unlock(&dhd->wl_intrwake);
21787
+ if (dhd_wake_lock_active(dhd->wl_intrwake)) {
21788
+ dhd_wake_unlock(dhd->wl_intrwake);
2178321789 }
2178421790 }
2178521791 #endif /* CONFIG_HAS_WAKELOCK */
....@@ -21794,7 +21800,7 @@
2179421800 dhd_info_t *dhd = (dhd_info_t *)(pub->info);
2179521801
2179621802 if (dhd) {
21797
- dhd_wake_lock_timeout(&dhd->wl_scanwake, msecs_to_jiffies(val));
21803
+ dhd_wake_lock_timeout(dhd->wl_scanwake, msecs_to_jiffies(val));
2179821804 }
2179921805 #endif /* CONFIG_HAS_WAKELOCK */
2180021806 }
....@@ -21807,8 +21813,8 @@
2180721813
2180821814 if (dhd) {
2180921815 /* if wl_scanwake is active, unlock it */
21810
- if (dhd_wake_lock_active(&dhd->wl_scanwake)) {
21811
- dhd_wake_unlock(&dhd->wl_scanwake);
21816
+ if (dhd_wake_lock_active(dhd->wl_scanwake)) {
21817
+ dhd_wake_unlock(dhd->wl_scanwake);
2181221818 }
2181321819 }
2181421820 #endif /* CONFIG_HAS_WAKELOCK */
....@@ -21874,13 +21880,13 @@
2187421880
2187521881 if (dhd->wakelock_before_waive == 0 && dhd->wakelock_counter > 0) {
2187621882 #ifdef CONFIG_HAS_WAKELOCK
21877
- dhd_wake_lock(&dhd->wl_wifi);
21883
+ dhd_wake_lock(dhd->wl_wifi);
2187821884 #elif defined(BCMSDIO)
2187921885 dhd_bus_dev_pm_stay_awake(&dhd->pub);
2188021886 #endif
2188121887 } else if (dhd->wakelock_before_waive > 0 && dhd->wakelock_counter == 0) {
2188221888 #ifdef CONFIG_HAS_WAKELOCK
21883
- dhd_wake_unlock(&dhd->wl_wifi);
21889
+ dhd_wake_unlock(dhd->wl_wifi);
2188421890 #elif defined(BCMSDIO)
2188521891 dhd_bus_dev_pm_relax(&dhd->pub);
2188621892 #endif
....@@ -21900,19 +21906,19 @@
2190021906 dhd->wakelock_ctrl_timeout_enable = 0;
2190121907 /* wakelocks prevent a system from going into a low power state */
2190221908 #ifdef CONFIG_HAS_WAKELOCK
21903
- // terence 20161023: can not destroy wl_wifi when wlan down, it will happen null pointer in dhd_ioctl_entry
21904
- dhd_wake_lock_init(&dhd->wl_rxwake, WAKE_LOCK_SUSPEND, "wlan_rx_wake");
21905
- dhd_wake_lock_init(&dhd->wl_ctrlwake, WAKE_LOCK_SUSPEND, "wlan_ctrl_wake");
21906
- dhd_wake_lock_init(&dhd->wl_evtwake, WAKE_LOCK_SUSPEND, "wlan_evt_wake");
21907
- dhd_wake_lock_init(&dhd->wl_pmwake, WAKE_LOCK_SUSPEND, "wlan_pm_wake");
21908
- dhd_wake_lock_init(&dhd->wl_txflwake, WAKE_LOCK_SUSPEND, "wlan_txfl_wake");
21909
+ dhd_wake_lock_init(dhd->wl_wifi, dhd_bus_to_dev(dhd->pub.bus), "wlan_wake");
21910
+ dhd_wake_lock_init(dhd->wl_rxwake, dhd_bus_to_dev(dhd->pub.bus), "wlan_rx_wake");
21911
+ dhd_wake_lock_init(dhd->wl_ctrlwake, dhd_bus_to_dev(dhd->pub.bus), "wlan_ctrl_wake");
21912
+ dhd_wake_lock_init(dhd->wl_evtwake, dhd_bus_to_dev(dhd->pub.bus), "wlan_evt_wake");
21913
+ dhd_wake_lock_init(dhd->wl_pmwake, dhd_bus_to_dev(dhd->pub.bus), "wlan_pm_wake");
21914
+ dhd_wake_lock_init(dhd->wl_txflwake, dhd_bus_to_dev(dhd->pub.bus), "wlan_txfl_wake");
2190921915 #ifdef BCMPCIE_OOB_HOST_WAKE
21910
- dhd_wake_lock_init(&dhd->wl_intrwake, WAKE_LOCK_SUSPEND, "wlan_oob_irq_wake");
21916
+ dhd_wake_lock_init(dhd->wl_intrwake, dhd_bus_to_dev(dhd->pub.bus), "wlan_oob_irq_wake");
2191121917 #endif /* BCMPCIE_OOB_HOST_WAKE */
2191221918 #ifdef DHD_USE_SCAN_WAKELOCK
21913
- dhd_wake_lock_init(&dhd->wl_scanwake, WAKE_LOCK_SUSPEND, "wlan_scan_wake");
21919
+ dhd_wake_lock_init(dhd->wl_scanwake, dhd_bus_to_dev(dhd->pub.bus), "wlan_scan_wake");
2191421920 #endif /* DHD_USE_SCAN_WAKELOCK */
21915
- dhd_wake_lock_init(&dhd->wl_nanwake, WAKE_LOCK_SUSPEND, "wlan_nan_wake");
21921
+ dhd_wake_lock_init(dhd->wl_nanwake, dhd_bus_to_dev(dhd->pub.bus), "wlan_nan_wake");
2191621922 #endif /* CONFIG_HAS_WAKELOCK */
2191721923 #ifdef DHD_TRACE_WAKE_LOCK
2191821924 dhd_wk_lock_trace_init(dhd);
....@@ -21926,19 +21932,19 @@
2192621932 dhd->wakelock_counter = 0;
2192721933 dhd->wakelock_rx_timeout_enable = 0;
2192821934 dhd->wakelock_ctrl_timeout_enable = 0;
21929
- // terence 20161023: can not destroy wl_wifi when wlan down, it will happen null pointer in dhd_ioctl_entry
21930
- dhd_wake_lock_unlock_destroy(&dhd->wl_rxwake);
21931
- dhd_wake_lock_unlock_destroy(&dhd->wl_ctrlwake);
21932
- dhd_wake_lock_unlock_destroy(&dhd->wl_evtwake);
21933
- dhd_wake_lock_unlock_destroy(&dhd->wl_pmwake);
21934
- dhd_wake_lock_unlock_destroy(&dhd->wl_txflwake);
21935
+ dhd_wake_lock_destroy(dhd->wl_wifi);
21936
+ dhd_wake_lock_destroy(dhd->wl_rxwake);
21937
+ dhd_wake_lock_destroy(dhd->wl_ctrlwake);
21938
+ dhd_wake_lock_destroy(dhd->wl_evtwake);
21939
+ dhd_wake_lock_destroy(dhd->wl_pmwake);
21940
+ dhd_wake_lock_destroy(dhd->wl_txflwake);
2193521941 #ifdef BCMPCIE_OOB_HOST_WAKE
21936
- dhd_wake_lock_unlock_destroy(&dhd->wl_intrwake);
21942
+ dhd_wake_lock_destroy(dhd->wl_intrwake);
2193721943 #endif /* BCMPCIE_OOB_HOST_WAKE */
2193821944 #ifdef DHD_USE_SCAN_WAKELOCK
21939
- dhd_wake_lock_unlock_destroy(&dhd->wl_scanwake);
21945
+ dhd_wake_lock_destroy(dhd->wl_scanwake);
2194021946 #endif /* DHD_USE_SCAN_WAKELOCK */
21941
- dhd_wake_lock_unlock_destroy(&dhd->wl_nanwake);
21947
+ dhd_wake_lock_destroy(dhd->wl_nanwake);
2194221948 #ifdef DHD_TRACE_WAKE_LOCK
2194321949 dhd_wk_lock_trace_deinit(dhd);
2194421950 #endif /* DHD_TRACE_WAKE_LOCK */
....@@ -27166,15 +27172,7 @@
2716627172 dhd_get_random_bytes(uint8 *buf, uint len)
2716727173 {
2716827174 #ifdef BCMPCIE
27169
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))
27170
- int rndlen = get_random_bytes_arch(buf, len);
27171
- if (rndlen != len) {
27172
- bzero(buf, len);
27173
- get_random_bytes(buf, len);
27174
- }
27175
-#else
27176
- get_random_bytes_arch(buf, len);
27177
-#endif
27175
+ get_random_bytes(buf, len);
2717827176 #endif /* BCMPCIE */
2717927177 return BCME_OK;
2718027178 }