[WCNCR00164412] misc: Fix compile error when kernel not support wext priv and wakelock
[Description]
Fix compile error when kernel not support wext priv and wakelock
Change-Id: I4de06f76e8db7200deb35af63adc7ce79148cb11
Signed-off-by: Allan Wang <Allan.Wang@mediatek.com>
CR-Id: WCNCR00164412
Feature: misc
(cherry picked from commit 608ffd7b10bb821812dadf02d1ecdce810f06e0f)
diff --git a/include/config.h b/include/config.h
index e244943..e51b637 100644
--- a/include/config.h
+++ b/include/config.h
@@ -191,10 +191,16 @@
#define CFG_SUPPORT_RX_AMSDU 1
/* Enable Android wake_lock operations */
+#ifdef CONFIG_HAS_WAKELOCK
#ifndef CFG_ENABLE_WAKE_LOCK
#define CFG_ENABLE_WAKE_LOCK 1
#endif
+#else
+#undef CFG_ENABLE_WAKE_LOCK
+#define CFG_ENABLE_WAKE_LOCK 0
+#endif
+
/*------------------------------------------------------------------------------
* Flags of Buffer mode SUPPORT
*------------------------------------------------------------------------------
diff --git a/include/nic/adapter.h b/include/nic/adapter.h
index 246d364..73381fe 100644
--- a/include/nic/adapter.h
+++ b/include/nic/adapter.h
@@ -851,7 +851,9 @@
typedef struct {
LINK_T rLinkHead;
OS_SYSTIME rNextExpiredSysTime;
+#if defined(CONFIG_ANDROID) && (CFG_ENABLE_WAKE_LOCK)
KAL_WAKE_LOCK_T rWakeLock;
+#endif
BOOLEAN fgWakeLocked;
} ROOT_TIMER, *P_ROOT_TIMER;
diff --git a/os/linux/gl_wext.c b/os/linux/gl_wext.c
index f09ffba..2afad9c 100644
--- a/os/linux/gl_wext.c
+++ b/os/linux/gl_wext.c
@@ -217,11 +217,15 @@
const struct iw_handler_def wext_handler_def = {
.num_standard = 0,
+#if defined(CONFIG_WEXT_PRIV) || LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 32)
.num_private = (__u16) sizeof(rIwPrivHandler) / sizeof(iw_handler),
.num_private_args = (__u16) sizeof(rIwPrivTable) / sizeof(struct iw_priv_args),
+#endif /* CONFIG_WEXT_PRIV || LINUX_VERSION_CODE <= 2.6.32 */
.standard = (iw_handler *) NULL,
+#if defined(CONFIG_WEXT_PRIV) || LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 32)
.private = rIwPrivHandler,
.private_args = rIwPrivTable,
+#endif /* CONFIG_WEXT_PRIV || LINUX_VERSION_CODE <= 2.6.32 */
.get_wireless_stats = wext_get_wireless_stats,
};
diff --git a/os/linux/include/gl_os.h b/os/linux/include/gl_os.h
index e1f81a8..0c57452 100644
--- a/os/linux/include/gl_os.h
+++ b/os/linux/include/gl_os.h
@@ -120,7 +120,7 @@
#include <linux/jiffies.h> /* jiffies */
#include <linux/delay.h> /* udelay and mdelay macro */
-#ifdef CONFIG_ANDROID
+#ifdef CONFIG_HAS_WAKELOCK
#include <linux/wakelock.h>
#endif
@@ -594,8 +594,10 @@
UINT_8 aucDADipv6[16];
#endif /* CFG_SUPPORT_PASSPOINT */
+#if defined(CONFIG_ANDROID) && (CFG_ENABLE_WAKE_LOCK)
KAL_WAKE_LOCK_T rIntrWakeLock;
KAL_WAKE_LOCK_T rTimeoutWakeLock;
+#endif
#if CFG_MET_PACKET_TRACE_SUPPORT
BOOLEAN fgMetProfilingEn;