summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomson Kang <thomson.kang@broadcom.corp-partner.google.com>2020-08-21 19:33:46 +0900
committerAhmed ElArabawy <arabawy@google.com>2020-09-02 16:13:00 -0700
commitcaae73e322a6511f3997a9fc2815bea443412dc6 (patch)
tree1efd8159075287b4ec8cdb27ee056d8468864ea0
parent2277032b379e01f8b55e98c481909d8ad566c6ae (diff)
downloadbcm43752-caae73e322a6511f3997a9fc2815bea443412dc6.tar.gz
Remove inlude/linuxwakelock.h dependency from dhd source
This commit makes the include of linuxwakelock.h dependent on CONFIG_HAS_WAKELOCK. This change is required to be able to build with Kernel 5.4 Bug: 163302778 Test: dhd builds successfully with kernel 5.4 Change-Id: I8df76bcc731db4b4250cf3e904a62571a3e44a5a Signed-off-by: Ahmed ElArabawy <arabawy@google.com>
-rwxr-xr-xdhd.h17
-rwxr-xr-xdhd_linux.c125
-rw-r--r--dhd_linux_priv.h38
-rwxr-xr-xdhd_pcie.c2
4 files changed, 97 insertions, 85 deletions
diff --git a/dhd.h b/dhd.h
index 4d96fdd..363d7c7 100755
--- a/dhd.h
+++ b/dhd.h
@@ -45,9 +45,6 @@
#include <linux/proc_fs.h>
#include <asm/uaccess.h>
#include <asm/unaligned.h>
-#if defined(CONFIG_HAS_WAKELOCK)
-#include <linux/wakelock.h>
-#endif /* defined CONFIG_HAS_WAKELOCK */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
#include <linux/sched/types.h>
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) */
@@ -1757,43 +1754,43 @@ inline static void MUTEX_UNLOCK_SOFTAP_SET(dhd_pub_t * dhdp)
} while (0)
#define DHD_OS_WAKE_LOCK_RX_TIMEOUT_ENABLE(pub, val) \
do { \
- printf("call wake_lock_rx_timeout_enable[%d]: %s %d\n", \
+ printf("call dhd_wake_lock_rx_timeout_enable[%d]: %s %d\n", \
val, __FUNCTION__, __LINE__); \
dhd_os_wake_lock_rx_timeout_enable(pub, val); \
} while (0)
#define DHD_OS_WAKE_LOCK_CTRL_TIMEOUT_ENABLE(pub, val) \
do { \
- printf("call wake_lock_ctrl_timeout_enable[%d]: %s %d\n", \
+ printf("call dhd_wake_lock_ctrl_timeout_enable[%d]: %s %d\n", \
val, __FUNCTION__, __LINE__); \
dhd_os_wake_lock_ctrl_timeout_enable(pub, val); \
} while (0)
#define DHD_OS_WAKE_LOCK_CTRL_TIMEOUT_CANCEL(pub) \
do { \
- printf("call wake_lock_ctrl_timeout_cancel: %s %d\n", \
+ printf("call dhd_wake_lock_ctrl_timeout_cancel: %s %d\n", \
__FUNCTION__, __LINE__); \
dhd_os_wake_lock_ctrl_timeout_cancel(pub); \
} while (0)
#define DHD_OS_WAKE_LOCK_WAIVE(pub) \
do { \
- printf("call wake_lock_waive: %s %d\n", \
+ printf("call dhd_wake_lock_waive: %s %d\n", \
__FUNCTION__, __LINE__); \
dhd_os_wake_lock_waive(pub); \
} while (0)
#define DHD_OS_WAKE_LOCK_RESTORE(pub) \
do { \
- printf("call wake_lock_restore: %s %d\n", \
+ printf("call dhd_wake_lock_restore: %s %d\n", \
__FUNCTION__, __LINE__); \
dhd_os_wake_lock_restore(pub); \
} while (0)
#define DHD_OS_WAKE_LOCK_INIT(dhd) \
do { \
- printf("call wake_lock_init: %s %d\n", \
+ printf("call dhd_wake_lock_init: %s %d\n", \
__FUNCTION__, __LINE__); \
dhd_os_wake_lock_init(dhd); \
} while (0)
#define DHD_OS_WAKE_LOCK_DESTROY(dhd) \
do { \
- printf("call wake_lock_destroy: %s %d\n", \
+ printf("call dhd_wake_lock_destroy: %s %d\n", \
__FUNCTION__, __LINE__); \
dhd_os_wake_lock_destroy(dhd); \
} while (0)
diff --git a/dhd_linux.c b/dhd_linux.c
index 337f6e3..63765a2 100755
--- a/dhd_linux.c
+++ b/dhd_linux.c
@@ -94,9 +94,6 @@
#include <dhd_dbg.h>
#include <dhd_dbg_ring.h>
#include <dhd_debug.h>
-#ifdef CONFIG_HAS_WAKELOCK
-#include <linux/wakelock.h>
-#endif
#if defined(WL_CFG80211)
#include <wl_cfg80211.h>
#ifdef WL_BAM
@@ -9117,7 +9114,7 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
dhd->wakelock_counter = 0;
/* wakelocks prevent a system from going into a low power state */
#ifdef CONFIG_HAS_WAKELOCK
- wake_lock_init(&dhd->wl_wdwake, WAKE_LOCK_SUSPEND, "wlan_wd_wake");
+ dhd_wake_lock_init(&dhd->wl_wdwake, WAKE_LOCK_SUSPEND, "wlan_wd_wake");
#endif /* CONFIG_HAS_WAKELOCK */
mutex_init(&dhd->dhd_net_if_mutex);
@@ -13958,7 +13955,7 @@ void dhd_detach(dhd_pub_t *dhdp)
#endif
#ifdef CONFIG_HAS_WAKELOCK
dhd->wakelock_wd_counter = 0;
- wake_lock_destroy(&dhd->wl_wdwake);
+ dhd_wake_lock_destroy(&dhd->wl_wdwake);
#endif /* CONFIG_HAS_WAKELOCK */
if (dhd->dhd_state & DHD_ATTACH_STATE_WAKELOCKS_INIT) {
DHD_TRACE(("wd wakelock count:%d\n", dhd->wakelock_wd_counter));
@@ -17293,10 +17290,10 @@ int dhd_os_wake_lock_timeout(dhd_pub_t *pub)
dhd->wakelock_rx_timeout_enable : dhd->wakelock_ctrl_timeout_enable;
#ifdef CONFIG_HAS_WAKELOCK
if (dhd->wakelock_rx_timeout_enable)
- wake_lock_timeout(&dhd->wl_rxwake,
+ dhd_wake_lock_timeout(&dhd->wl_rxwake,
msecs_to_jiffies(dhd->wakelock_rx_timeout_enable));
if (dhd->wakelock_ctrl_timeout_enable)
- wake_lock_timeout(&dhd->wl_ctrlwake,
+ dhd_wake_lock_timeout(&dhd->wl_ctrlwake,
msecs_to_jiffies(dhd->wakelock_ctrl_timeout_enable));
#endif
dhd->wakelock_rx_timeout_enable = 0;
@@ -17353,8 +17350,8 @@ int dhd_os_wake_lock_ctrl_timeout_cancel(dhd_pub_t *pub)
DHD_WAKE_SPIN_LOCK(&dhd->wakelock_spinlock, flags);
dhd->wakelock_ctrl_timeout_enable = 0;
#ifdef CONFIG_HAS_WAKELOCK
- if (wake_lock_active(&dhd->wl_ctrlwake))
- wake_unlock(&dhd->wl_ctrlwake);
+ if (dhd_wake_lock_active(&dhd->wl_ctrlwake))
+ dhd_wake_unlock(&dhd->wl_ctrlwake);
#endif
DHD_WAKE_SPIN_UNLOCK(&dhd->wakelock_spinlock, flags);
}
@@ -17591,7 +17588,7 @@ int dhd_os_wake_lock(dhd_pub_t *pub)
DHD_WAKE_SPIN_LOCK(&dhd->wakelock_spinlock, flags);
if (dhd->wakelock_counter == 0 && !dhd->waive_wakelock) {
#ifdef CONFIG_HAS_WAKELOCK
- wake_lock(&dhd->wl_wifi);
+ dhd_wake_lock(&dhd->wl_wifi);
#elif defined(BCMSDIO)
dhd_bus_dev_pm_stay_awake(pub);
#endif
@@ -17615,7 +17612,7 @@ void dhd_event_wake_lock(dhd_pub_t *pub)
if (dhd) {
#ifdef CONFIG_HAS_WAKELOCK
- wake_lock(&dhd->wl_evtwake);
+ dhd_wake_lock(&dhd->wl_evtwake);
#elif defined(BCMSDIO)
dhd_bus_dev_pm_stay_awake(pub);
#endif
@@ -17629,7 +17626,7 @@ dhd_pm_wake_lock_timeout(dhd_pub_t *pub, int val)
dhd_info_t *dhd = (dhd_info_t *)(pub->info);
if (dhd) {
- wake_lock_timeout(&dhd->wl_pmwake, msecs_to_jiffies(val));
+ dhd_wake_lock_timeout(&dhd->wl_pmwake, msecs_to_jiffies(val));
}
#endif /* CONFIG_HAS_WAKE_LOCK */
}
@@ -17641,7 +17638,7 @@ dhd_txfl_wake_lock_timeout(dhd_pub_t *pub, int val)
dhd_info_t *dhd = (dhd_info_t *)(pub->info);
if (dhd) {
- wake_lock_timeout(&dhd->wl_txflwake, msecs_to_jiffies(val));
+ dhd_wake_lock_timeout(&dhd->wl_txflwake, msecs_to_jiffies(val));
}
#endif /* CONFIG_HAS_WAKE_LOCK */
}
@@ -17653,7 +17650,7 @@ dhd_nan_wake_lock_timeout(dhd_pub_t *pub, int val)
dhd_info_t *dhd = (dhd_info_t *)(pub->info);
if (dhd) {
- wake_lock_timeout(&dhd->wl_nanwake, msecs_to_jiffies(val));
+ dhd_wake_lock_timeout(&dhd->wl_nanwake, msecs_to_jiffies(val));
}
#endif /* CONFIG_HAS_WAKE_LOCK */
}
@@ -17687,7 +17684,7 @@ int dhd_os_wake_unlock(dhd_pub_t *pub)
#endif /* DHD_TRACE_WAKE_LOCK */
if (dhd->wakelock_counter == 0 && !dhd->waive_wakelock) {
#ifdef CONFIG_HAS_WAKELOCK
- wake_unlock(&dhd->wl_wifi);
+ dhd_wake_unlock(&dhd->wl_wifi);
#elif defined(BCMSDIO)
dhd_bus_dev_pm_relax(pub);
#endif
@@ -17705,7 +17702,7 @@ void dhd_event_wake_unlock(dhd_pub_t *pub)
if (dhd) {
#ifdef CONFIG_HAS_WAKELOCK
- wake_unlock(&dhd->wl_evtwake);
+ dhd_wake_unlock(&dhd->wl_evtwake);
#elif defined(BCMSDIO)
dhd_bus_dev_pm_relax(pub);
#endif
@@ -17719,8 +17716,8 @@ void dhd_pm_wake_unlock(dhd_pub_t *pub)
if (dhd) {
/* if wl_pmwake is active, unlock it */
- if (wake_lock_active(&dhd->wl_pmwake)) {
- wake_unlock(&dhd->wl_pmwake);
+ if (dhd_wake_lock_active(&dhd->wl_pmwake)) {
+ dhd_wake_unlock(&dhd->wl_pmwake);
}
}
#endif /* CONFIG_HAS_WAKELOCK */
@@ -17733,8 +17730,8 @@ void dhd_txfl_wake_unlock(dhd_pub_t *pub)
if (dhd) {
/* if wl_txflwake is active, unlock it */
- if (wake_lock_active(&dhd->wl_txflwake)) {
- wake_unlock(&dhd->wl_txflwake);
+ if (dhd_wake_lock_active(&dhd->wl_txflwake)) {
+ dhd_wake_unlock(&dhd->wl_txflwake);
}
}
#endif /* CONFIG_HAS_WAKELOCK */
@@ -17747,8 +17744,8 @@ void dhd_nan_wake_unlock(dhd_pub_t *pub)
if (dhd) {
/* if wl_nanwake is active, unlock it */
- if (wake_lock_active(&dhd->wl_nanwake)) {
- wake_unlock(&dhd->wl_nanwake);
+ if (dhd_wake_lock_active(&dhd->wl_nanwake)) {
+ dhd_wake_unlock(&dhd->wl_nanwake);
}
}
#endif /* CONFIG_HAS_WAKELOCK */
@@ -17766,8 +17763,8 @@ int dhd_os_check_wakelock(dhd_pub_t *pub)
#ifdef CONFIG_HAS_WAKELOCK
/* Indicate to the SD Host to avoid going to suspend if internal locks are up */
- if (dhd && (wake_lock_active(&dhd->wl_wifi) ||
- (wake_lock_active(&dhd->wl_wdwake))))
+ if (dhd && (dhd_wake_lock_active(&dhd->wl_wifi) ||
+ (dhd_wake_lock_active(&dhd->wl_wdwake))))
return 1;
#elif defined(BCMSDIO)
if (dhd && (dhd->wakelock_counter > 0) && dhd_bus_dev_pm_enabled(pub))
@@ -17802,20 +17799,20 @@ dhd_os_check_wakelock_all(dhd_pub_t *pub)
#ifdef CONFIG_HAS_WAKELOCK
c = dhd->wakelock_counter;
- l1 = wake_lock_active(&dhd->wl_wifi);
- l2 = wake_lock_active(&dhd->wl_wdwake);
- l3 = wake_lock_active(&dhd->wl_rxwake);
- l4 = wake_lock_active(&dhd->wl_ctrlwake);
- l7 = wake_lock_active(&dhd->wl_evtwake);
+ l1 = dhd_wake_lock_active(&dhd->wl_wifi);
+ l2 = dhd_wake_lock_active(&dhd->wl_wdwake);
+ l3 = dhd_wake_lock_active(&dhd->wl_rxwake);
+ l4 = dhd_wake_lock_active(&dhd->wl_ctrlwake);
+ l7 = dhd_wake_lock_active(&dhd->wl_evtwake);
#ifdef BCMPCIE_OOB_HOST_WAKE
- l5 = wake_lock_active(&dhd->wl_intrwake);
+ l5 = dhd_wake_lock_active(&dhd->wl_intrwake);
#endif /* BCMPCIE_OOB_HOST_WAKE */
#ifdef DHD_USE_SCAN_WAKELOCK
- l6 = wake_lock_active(&dhd->wl_scanwake);
+ l6 = dhd_wake_lock_active(&dhd->wl_scanwake);
#endif /* DHD_USE_SCAN_WAKELOCK */
- l8 = wake_lock_active(&dhd->wl_pmwake);
- l9 = wake_lock_active(&dhd->wl_txflwake);
- l10 = wake_lock_active(&dhd->wl_nanwake);
+ l8 = dhd_wake_lock_active(&dhd->wl_pmwake);
+ l9 = dhd_wake_lock_active(&dhd->wl_txflwake);
+ l10 = dhd_wake_lock_active(&dhd->wl_nanwake);
lock_active = (l1 || l2 || l3 || l4 || l5 || l6 || l7 || l8 || l9 || l10);
/* Indicate to the Host to avoid going to suspend if internal locks are up */
@@ -17854,7 +17851,7 @@ int dhd_os_wd_wake_lock(dhd_pub_t *pub)
if (dhd->wakelock_wd_counter == 0 && !dhd->waive_wakelock) {
#ifdef CONFIG_HAS_WAKELOCK
/* if wakelock_wd_counter was never used : lock it at once */
- wake_lock(&dhd->wl_wdwake);
+ dhd_wake_lock(&dhd->wl_wdwake);
#endif
}
dhd->wakelock_wd_counter++;
@@ -17876,7 +17873,7 @@ int dhd_os_wd_wake_unlock(dhd_pub_t *pub)
dhd->wakelock_wd_counter = 0;
if (!dhd->waive_wakelock) {
#ifdef CONFIG_HAS_WAKELOCK
- wake_unlock(&dhd->wl_wdwake);
+ dhd_wake_unlock(&dhd->wl_wdwake);
#endif
}
}
@@ -17893,7 +17890,7 @@ dhd_os_oob_irq_wake_lock_timeout(dhd_pub_t *pub, int val)
dhd_info_t *dhd = (dhd_info_t *)(pub->info);
if (dhd) {
- wake_lock_timeout(&dhd->wl_intrwake, msecs_to_jiffies(val));
+ dhd_wake_lock_timeout(&dhd->wl_intrwake, msecs_to_jiffies(val));
}
#endif /* CONFIG_HAS_WAKELOCK */
}
@@ -17906,8 +17903,8 @@ dhd_os_oob_irq_wake_unlock(dhd_pub_t *pub)
if (dhd) {
/* if wl_intrwake is active, unlock it */
- if (wake_lock_active(&dhd->wl_intrwake)) {
- wake_unlock(&dhd->wl_intrwake);
+ if (dhd_wake_lock_active(&dhd->wl_intrwake)) {
+ dhd_wake_unlock(&dhd->wl_intrwake);
}
}
#endif /* CONFIG_HAS_WAKELOCK */
@@ -17922,7 +17919,7 @@ dhd_os_scan_wake_lock_timeout(dhd_pub_t *pub, int val)
dhd_info_t *dhd = (dhd_info_t *)(pub->info);
if (dhd) {
- wake_lock_timeout(&dhd->wl_scanwake, msecs_to_jiffies(val));
+ dhd_wake_lock_timeout(&dhd->wl_scanwake, msecs_to_jiffies(val));
}
#endif /* CONFIG_HAS_WAKELOCK */
}
@@ -17935,8 +17932,8 @@ dhd_os_scan_wake_unlock(dhd_pub_t *pub)
if (dhd) {
/* if wl_scanwake is active, unlock it */
- if (wake_lock_active(&dhd->wl_scanwake)) {
- wake_unlock(&dhd->wl_scanwake);
+ if (dhd_wake_lock_active(&dhd->wl_scanwake)) {
+ dhd_wake_unlock(&dhd->wl_scanwake);
}
}
#endif /* CONFIG_HAS_WAKELOCK */
@@ -17991,8 +17988,8 @@ int dhd_os_wake_lock_restore(dhd_pub_t *pub)
dhd->waive_wakelock = FALSE;
/* if somebody else acquires wakelock between dhd_wakelock_waive/dhd_wakelock_restore,
- * we need to make it up by calling wake_lock or pm_stay_awake. or if somebody releases
- * the lock in between, do the same by calling wake_unlock or pm_relax
+ * we need to make it up by calling dhd_wake_lock or pm_stay_awake. or if somebody releases
+ * the lock in between, do the same by calling dhd_wake_unlock or pm_relax
*/
#ifdef DHD_TRACE_WAKE_LOCK
if (atomic_read(&trace_wklock_onoff)) {
@@ -18002,13 +17999,13 @@ int dhd_os_wake_lock_restore(dhd_pub_t *pub)
if (dhd->wakelock_before_waive == 0 && dhd->wakelock_counter > 0) {
#ifdef CONFIG_HAS_WAKELOCK
- wake_lock(&dhd->wl_wifi);
+ dhd_wake_lock(&dhd->wl_wifi);
#elif defined(BCMSDIO)
dhd_bus_dev_pm_stay_awake(&dhd->pub);
#endif
} else if (dhd->wakelock_before_waive > 0 && dhd->wakelock_counter == 0) {
#ifdef CONFIG_HAS_WAKELOCK
- wake_unlock(&dhd->wl_wifi);
+ dhd_wake_unlock(&dhd->wl_wifi);
#elif defined(BCMSDIO)
dhd_bus_dev_pm_relax(&dhd->pub);
#endif
@@ -18028,19 +18025,19 @@ void dhd_os_wake_lock_init(struct dhd_info *dhd)
dhd->wakelock_ctrl_timeout_enable = 0;
/* wakelocks prevent a system from going into a low power state */
#ifdef CONFIG_HAS_WAKELOCK
- wake_lock_init(&dhd->wl_wifi, WAKE_LOCK_SUSPEND, "wlan_wake");
- wake_lock_init(&dhd->wl_rxwake, WAKE_LOCK_SUSPEND, "wlan_rx_wake");
- wake_lock_init(&dhd->wl_ctrlwake, WAKE_LOCK_SUSPEND, "wlan_ctrl_wake");
- wake_lock_init(&dhd->wl_evtwake, WAKE_LOCK_SUSPEND, "wlan_evt_wake");
- wake_lock_init(&dhd->wl_pmwake, WAKE_LOCK_SUSPEND, "wlan_pm_wake");
- wake_lock_init(&dhd->wl_txflwake, WAKE_LOCK_SUSPEND, "wlan_txfl_wake");
+ dhd_wake_lock_init(&dhd->wl_wifi, WAKE_LOCK_SUSPEND, "wlan_wake");
+ dhd_wake_lock_init(&dhd->wl_rxwake, WAKE_LOCK_SUSPEND, "wlan_rx_wake");
+ dhd_wake_lock_init(&dhd->wl_ctrlwake, WAKE_LOCK_SUSPEND, "wlan_ctrl_wake");
+ dhd_wake_lock_init(&dhd->wl_evtwake, WAKE_LOCK_SUSPEND, "wlan_evt_wake");
+ dhd_wake_lock_init(&dhd->wl_pmwake, WAKE_LOCK_SUSPEND, "wlan_pm_wake");
+ dhd_wake_lock_init(&dhd->wl_txflwake, WAKE_LOCK_SUSPEND, "wlan_txfl_wake");
#ifdef BCMPCIE_OOB_HOST_WAKE
- wake_lock_init(&dhd->wl_intrwake, WAKE_LOCK_SUSPEND, "wlan_oob_irq_wake");
+ dhd_wake_lock_init(&dhd->wl_intrwake, WAKE_LOCK_SUSPEND, "wlan_oob_irq_wake");
#endif /* BCMPCIE_OOB_HOST_WAKE */
#ifdef DHD_USE_SCAN_WAKELOCK
- wake_lock_init(&dhd->wl_scanwake, WAKE_LOCK_SUSPEND, "wlan_scan_wake");
+ dhd_wake_lock_init(&dhd->wl_scanwake, WAKE_LOCK_SUSPEND, "wlan_scan_wake");
#endif /* DHD_USE_SCAN_WAKELOCK */
- wake_lock_init(&dhd->wl_nanwake, WAKE_LOCK_SUSPEND, "wlan_nan_wake");
+ dhd_wake_lock_init(&dhd->wl_nanwake, WAKE_LOCK_SUSPEND, "wlan_nan_wake");
#endif /* CONFIG_HAS_WAKELOCK */
#ifdef DHD_TRACE_WAKE_LOCK
dhd_wk_lock_trace_init(dhd);
@@ -18054,19 +18051,19 @@ void dhd_os_wake_lock_destroy(struct dhd_info *dhd)
dhd->wakelock_counter = 0;
dhd->wakelock_rx_timeout_enable = 0;
dhd->wakelock_ctrl_timeout_enable = 0;
- wake_lock_destroy(&dhd->wl_wifi);
- wake_lock_destroy(&dhd->wl_rxwake);
- wake_lock_destroy(&dhd->wl_ctrlwake);
- wake_lock_destroy(&dhd->wl_evtwake);
- wake_lock_destroy(&dhd->wl_pmwake);
- wake_lock_destroy(&dhd->wl_txflwake);
+ dhd_wake_lock_destroy(&dhd->wl_wifi);
+ dhd_wake_lock_destroy(&dhd->wl_rxwake);
+ dhd_wake_lock_destroy(&dhd->wl_ctrlwake);
+ dhd_wake_lock_destroy(&dhd->wl_evtwake);
+ dhd_wake_lock_destroy(&dhd->wl_pmwake);
+ dhd_wake_lock_destroy(&dhd->wl_txflwake);
#ifdef BCMPCIE_OOB_HOST_WAKE
- wake_lock_destroy(&dhd->wl_intrwake);
+ dhd_wake_lock_destroy(&dhd->wl_intrwake);
#endif /* BCMPCIE_OOB_HOST_WAKE */
#ifdef DHD_USE_SCAN_WAKELOCK
- wake_lock_destroy(&dhd->wl_scanwake);
+ dhd_wake_lock_destroy(&dhd->wl_scanwake);
#endif /* DHD_USE_SCAN_WAKELOCK */
- wake_lock_destroy(&dhd->wl_nanwake);
+ dhd_wake_lock_destroy(&dhd->wl_nanwake);
#ifdef DHD_TRACE_WAKE_LOCK
dhd_wk_lock_trace_deinit(dhd);
#endif /* DHD_TRACE_WAKE_LOCK */
diff --git a/dhd_linux_priv.h b/dhd_linux_priv.h
index 620a7eb..b0ebd9f 100644
--- a/dhd_linux_priv.h
+++ b/dhd_linux_priv.h
@@ -37,6 +37,9 @@
#ifdef CONFIG_COMPAT
#include <linux/compat.h>
#endif /* CONFIG COMPAT */
+#ifdef CONFIG_HAS_WAKELOCK
+#include <linux/pm_wakeup.h>
+#endif /* CONFIG_HAS_WAKELOCK */
#include <dngl_stats.h>
#include <dhd.h>
#include <dhd_dbg.h>
@@ -102,20 +105,20 @@ typedef struct dhd_info {
/* Wakelocks */
#if defined(CONFIG_HAS_WAKELOCK)
- struct wake_lock wl_wifi; /* Wifi wakelock */
- struct wake_lock wl_rxwake; /* Wifi rx wakelock */
- struct wake_lock wl_ctrlwake; /* Wifi ctrl wakelock */
- struct wake_lock wl_wdwake; /* Wifi wd wakelock */
- struct wake_lock wl_evtwake; /* Wifi event wakelock */
- struct wake_lock wl_pmwake; /* Wifi pm handler wakelock */
- struct wake_lock wl_txflwake; /* Wifi tx flow wakelock */
+ struct wakeup_source wl_wifi; /* Wifi wakelock */
+ struct wakeup_source wl_rxwake; /* Wifi rx wakelock */
+ struct wakeup_source wl_ctrlwake; /* Wifi ctrl wakelock */
+ struct wakeup_source wl_wdwake; /* Wifi wd wakelock */
+ struct wakeup_source wl_evtwake; /* Wifi event wakelock */
+ struct wakeup_source wl_pmwake; /* Wifi pm handler wakelock */
+ struct wakeup_source wl_txflwake; /* Wifi tx flow wakelock */
#ifdef BCMPCIE_OOB_HOST_WAKE
- struct wake_lock wl_intrwake; /* Host wakeup wakelock */
+ struct wakeup_source wl_intrwake; /* Host wakeup wakelock */
#endif /* BCMPCIE_OOB_HOST_WAKE */
#ifdef DHD_USE_SCAN_WAKELOCK
- struct wake_lock wl_scanwake; /* Wifi scan wakelock */
+ struct wakeup_source wl_scanwake; /* Wifi scan wakelock */
#endif /* DHD_USE_SCAN_WAKELOCK */
- struct wake_lock wl_nanwake; /* NAN wakelock */
+ struct wakeup_source wl_nanwake; /* NAN wakelock */
#endif /* CONFIG_HAS_WAKELOCK */
/* net_device interface lock, prevent race conditions among net_dev interface
@@ -433,4 +436,19 @@ void dhd_irq_set_affinity(dhd_pub_t *dhdp, const struct cpumask *cpumask);
extern uint sssr_enab;
extern uint fis_enab;
#endif /* DHD_SSSR_DUMP */
+
+#ifdef CONFIG_HAS_WAKELOCK
+enum {
+ WAKE_LOCK_SUSPEND, /* Prevent suspend */
+ WAKE_LOCK_TYPE_COUNT
+};
+#define dhd_wake_lock_init(wakeup_source, type, name) wakeup_source_add(wakeup_source)
+#define dhd_wake_lock_destroy(wakeup_source) wakeup_source_remove(wakeup_source)
+#define dhd_wake_lock(wakeup_source) __pm_stay_awake(wakeup_source)
+#define dhd_wake_unlock(wakeup_source) __pm_relax(wakeup_source)
+#define dhd_wake_lock_active(wakeup_source) ((wakeup_source)->active)
+#define dhd_wake_lock_timeout(wakeup_source, timeout) \
+ __pm_wakeup_event(wakeup_source, jiffies_to_msecs(timeout))
+#endif /* CONFIG_HAS_WAKELOCK */
+
#endif /* __DHD_LINUX_PRIV_H__ */
diff --git a/dhd_pcie.c b/dhd_pcie.c
index cb10f59..4c39f46 100755
--- a/dhd_pcie.c
+++ b/dhd_pcie.c
@@ -90,7 +90,7 @@
#define EXTENDED_PCIE_DEBUG_DUMP 1 /* Enable Extended pcie registers dump */
#define MEMBLOCK 2048 /* Block size used for downloading of dongle image */
-#define MAX_WKLK_IDLE_CHECK 3 /* times wake_lock checked before deciding not to suspend */
+#define MAX_WKLK_IDLE_CHECK 3 /* times dhd_wake_lock checked before deciding not to suspend */
#define DHD_MAX_ITEMS_HPP_TXCPL_RING 512
#define DHD_MAX_ITEMS_HPP_RXCPL_RING 512