summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaidiReddy Yenuga <c_saidir@qti.qualcomm.com>2016-10-06 19:31:10 +0530
committerqcabuildsw <qcabuildsw@localhost>2016-12-05 05:59:45 -0800
commit8457c60df9eb244f59fefe874a01dd6a15f4a700 (patch)
tree50d5181fec547ea34e3af2d385f31a72427939e0
parent0f10a78528a39fcf92439298cb194e899b878ae3 (diff)
qcacld-3.0: Pass proper values to bit manipulation methods to avoid panic
qcacld-2.0 to qcacld-3.0 propagation Observed kernel panic due to improper arguments passed to kernel bit manipulation functions (like set_bit, clear_bit etc.) i.e these functions expects bit positions as its first argument but bit mask values are being passed. To fix these issues ensure below points: - Pass bit position as a first argument to bit manipulation functions. - Re-define MACROs which gives false impression of bit mask values with their naming convention. Change-Id: Ief8cd83b05f01a0926f91c0e9fb461ddd498e05e CRs-Fixed: 981050
-rw-r--r--core/cds/inc/cds_sched.h28
-rw-r--r--core/cds/src/cds_api.c2
-rw-r--r--core/cds/src/cds_sched.c48
-rw-r--r--core/hdd/src/wlan_hdd_power.c8
4 files changed, 43 insertions, 43 deletions
diff --git a/core/cds/inc/cds_sched.h b/core/cds/inc/cds_sched.h
index 0fcb95f2db23..c2ce9c1956e8 100644
--- a/core/cds/inc/cds_sched.h
+++ b/core/cds/inc/cds_sched.h
@@ -51,20 +51,20 @@
#include "qdf_mc_timer.h"
#include "cds_config.h"
-#define TX_POST_EVENT_MASK 0x001
-#define TX_SUSPEND_EVENT_MASK 0x002
-#define MC_POST_EVENT_MASK 0x001
-#define MC_SUSPEND_EVENT_MASK 0x002
-#define RX_POST_EVENT_MASK 0x001
-#define RX_SUSPEND_EVENT_MASK 0x002
-#define TX_SHUTDOWN_EVENT_MASK 0x010
-#define MC_SHUTDOWN_EVENT_MASK 0x010
-#define RX_SHUTDOWN_EVENT_MASK 0x010
-#define WD_POST_EVENT_MASK 0x001
-#define WD_SHUTDOWN_EVENT_MASK 0x002
-#define WD_CHIP_RESET_EVENT_MASK 0x004
-#define WD_WLAN_SHUTDOWN_EVENT_MASK 0x008
-#define WD_WLAN_REINIT_EVENT_MASK 0x010
+#define TX_POST_EVENT 0x001
+#define TX_SUSPEND_EVENT 0x002
+#define MC_POST_EVENT 0x001
+#define MC_SUSPEND_EVENT 0x002
+#define RX_POST_EVENT 0x001
+#define RX_SUSPEND_EVENT 0x002
+#define TX_SHUTDOWN_EVENT 0x010
+#define MC_SHUTDOWN_EVENT 0x010
+#define RX_SHUTDOWN_EVENT 0x010
+#define WD_POST_EVENT 0x001
+#define WD_SHUTDOWN_EVENT 0x002
+#define WD_CHIP_RESET_EVENT 0x004
+#define WD_WLAN_SHUTDOWN_EVENT 0x008
+#define WD_WLAN_REINIT_EVENT 0x010
/*
* Maximum number of messages in the system
diff --git a/core/cds/src/cds_api.c b/core/cds/src/cds_api.c
index 997621f0b5db..80617af3528c 100644
--- a/core/cds/src/cds_api.c
+++ b/core/cds/src/cds_api.c
@@ -1479,7 +1479,7 @@ QDF_STATUS cds_mq_post_message_by_priority(CDS_MQ_ID msgQueueId,
else
cds_mq_put(pTargetMq, pMsgWrapper);
- set_bit(MC_POST_EVENT_MASK, &gp_cds_context->qdf_sched.mcEventFlag);
+ set_bit(MC_POST_EVENT, &gp_cds_context->qdf_sched.mcEventFlag);
wake_up_interruptible(&gp_cds_context->qdf_sched.mcWaitQueue);
return QDF_STATUS_SUCCESS;
diff --git a/core/cds/src/cds_sched.c b/core/cds/src/cds_sched.c
index d352a06e71ea..01ddbbd6bede 100644
--- a/core/cds/src/cds_sched.c
+++ b/core/cds/src/cds_sched.c
@@ -577,8 +577,8 @@ QDF_STATUS cds_sched_open(void *p_cds_context,
#ifdef QCA_CONFIG_SMP
OL_RX_THREAD_START_FAILURE:
/* Try and force the Main thread controller to exit */
- set_bit(MC_SHUTDOWN_EVENT_MASK, &pSchedContext->mcEventFlag);
- set_bit(MC_POST_EVENT_MASK, &pSchedContext->mcEventFlag);
+ set_bit(MC_SHUTDOWN_EVENT, &pSchedContext->mcEventFlag);
+ set_bit(MC_POST_EVENT, &pSchedContext->mcEventFlag);
wake_up_interruptible(&pSchedContext->mcWaitQueue);
/* Wait for MC to exit */
wait_for_completion_interruptible(&pSchedContext->McShutdown);
@@ -650,9 +650,9 @@ static int cds_mc_thread(void *Arg)
/* This implements the execution model algorithm */
retWaitStatus =
wait_event_interruptible(pSchedContext->mcWaitQueue,
- test_bit(MC_POST_EVENT_MASK,
+ test_bit(MC_POST_EVENT,
&pSchedContext->mcEventFlag)
- || test_bit(MC_SUSPEND_EVENT_MASK,
+ || test_bit(MC_SUSPEND_EVENT,
&pSchedContext->mcEventFlag));
if (retWaitStatus == -ERESTARTSYS) {
@@ -661,12 +661,12 @@ static int cds_mc_thread(void *Arg)
__func__);
QDF_BUG(0);
}
- clear_bit(MC_POST_EVENT_MASK, &pSchedContext->mcEventFlag);
+ clear_bit(MC_POST_EVENT, &pSchedContext->mcEventFlag);
while (1) {
/* Check if MC needs to shutdown */
if (test_bit
- (MC_SHUTDOWN_EVENT_MASK,
+ (MC_SHUTDOWN_EVENT,
&pSchedContext->mcEventFlag)) {
QDF_TRACE(QDF_MODULE_ID_QDF,
QDF_TRACE_LEVEL_INFO,
@@ -675,9 +675,9 @@ static int cds_mc_thread(void *Arg)
shutdown = true;
/* Check for any Suspend Indication */
if (test_bit
- (MC_SUSPEND_EVENT_MASK,
+ (MC_SUSPEND_EVENT,
&pSchedContext->mcEventFlag)) {
- clear_bit(MC_SUSPEND_EVENT_MASK,
+ clear_bit(MC_SUSPEND_EVENT,
&pSchedContext->mcEventFlag);
/* Unblock anyone waiting on suspend */
@@ -822,9 +822,9 @@ static int cds_mc_thread(void *Arg)
}
/* Check for any Suspend Indication */
if (test_bit
- (MC_SUSPEND_EVENT_MASK,
+ (MC_SUSPEND_EVENT,
&pSchedContext->mcEventFlag)) {
- clear_bit(MC_SUSPEND_EVENT_MASK,
+ clear_bit(MC_SUSPEND_EVENT,
&pSchedContext->mcEventFlag);
spin_lock(&pSchedContext->McThreadLock);
INIT_COMPLETION(pSchedContext->ResumeMcEvent);
@@ -974,7 +974,7 @@ cds_indicate_rxpkt(p_cds_sched_context pSchedContext,
spin_lock_bh(&pSchedContext->ol_rx_queue_lock);
list_add_tail(&pkt->list, &pSchedContext->ol_rx_thread_queue);
spin_unlock_bh(&pSchedContext->ol_rx_queue_lock);
- set_bit(RX_POST_EVENT_MASK, &pSchedContext->ol_rx_event_flag);
+ set_bit(RX_POST_EVENT, &pSchedContext->ol_rx_event_flag);
wake_up_interruptible(&pSchedContext->ol_rx_wait_queue);
}
@@ -1093,22 +1093,22 @@ static int cds_ol_rx_thread(void *arg)
while (!shutdown) {
status =
wait_event_interruptible(pSchedContext->ol_rx_wait_queue,
- test_bit(RX_POST_EVENT_MASK,
+ test_bit(RX_POST_EVENT,
&pSchedContext->ol_rx_event_flag)
- || test_bit(RX_SUSPEND_EVENT_MASK,
+ || test_bit(RX_SUSPEND_EVENT,
&pSchedContext->ol_rx_event_flag));
if (status == -ERESTARTSYS)
break;
- clear_bit(RX_POST_EVENT_MASK, &pSchedContext->ol_rx_event_flag);
+ clear_bit(RX_POST_EVENT, &pSchedContext->ol_rx_event_flag);
while (true) {
- if (test_bit(RX_SHUTDOWN_EVENT_MASK,
+ if (test_bit(RX_SHUTDOWN_EVENT,
&pSchedContext->ol_rx_event_flag)) {
- clear_bit(RX_SHUTDOWN_EVENT_MASK,
+ clear_bit(RX_SHUTDOWN_EVENT,
&pSchedContext->ol_rx_event_flag);
- if (test_bit(RX_SUSPEND_EVENT_MASK,
+ if (test_bit(RX_SUSPEND_EVENT,
&pSchedContext->ol_rx_event_flag)) {
- clear_bit(RX_SUSPEND_EVENT_MASK,
+ clear_bit(RX_SUSPEND_EVENT,
&pSchedContext->ol_rx_event_flag);
complete
(&pSchedContext->ol_suspend_rx_event);
@@ -1122,9 +1122,9 @@ static int cds_ol_rx_thread(void *arg)
}
cds_rx_from_queue(pSchedContext);
- if (test_bit(RX_SUSPEND_EVENT_MASK,
+ if (test_bit(RX_SUSPEND_EVENT,
&pSchedContext->ol_rx_event_flag)) {
- clear_bit(RX_SUSPEND_EVENT_MASK,
+ clear_bit(RX_SUSPEND_EVENT,
&pSchedContext->ol_rx_event_flag);
spin_lock(&pSchedContext->ol_rx_thread_lock);
INIT_COMPLETION
@@ -1166,8 +1166,8 @@ QDF_STATUS cds_sched_close(void *p_cds_context)
return QDF_STATUS_E_FAILURE;
}
/* shut down MC Thread */
- set_bit(MC_SHUTDOWN_EVENT_MASK, &gp_cds_sched_context->mcEventFlag);
- set_bit(MC_POST_EVENT_MASK, &gp_cds_sched_context->mcEventFlag);
+ set_bit(MC_SHUTDOWN_EVENT, &gp_cds_sched_context->mcEventFlag);
+ set_bit(MC_POST_EVENT, &gp_cds_sched_context->mcEventFlag);
wake_up_interruptible(&gp_cds_sched_context->mcWaitQueue);
/* Wait for MC to exit */
wait_for_completion(&gp_cds_sched_context->McShutdown);
@@ -1181,8 +1181,8 @@ QDF_STATUS cds_sched_close(void *p_cds_context)
#ifdef QCA_CONFIG_SMP
/* Shut down Tlshim Rx thread */
- set_bit(RX_SHUTDOWN_EVENT_MASK, &gp_cds_sched_context->ol_rx_event_flag);
- set_bit(RX_POST_EVENT_MASK, &gp_cds_sched_context->ol_rx_event_flag);
+ set_bit(RX_SHUTDOWN_EVENT, &gp_cds_sched_context->ol_rx_event_flag);
+ set_bit(RX_POST_EVENT, &gp_cds_sched_context->ol_rx_event_flag);
wake_up_interruptible(&gp_cds_sched_context->ol_rx_wait_queue);
wait_for_completion(&gp_cds_sched_context->ol_rx_shutdown);
gp_cds_sched_context->ol_rx_thread = NULL;
diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c
index 8249b069083e..10136f01b4d7 100644
--- a/core/hdd/src/wlan_hdd_power.c
+++ b/core/hdd/src/wlan_hdd_power.c
@@ -1999,14 +1999,14 @@ next_adapter:
}
/* Suspend MC thread */
- set_bit(MC_SUSPEND_EVENT_MASK, &cds_sched_context->mcEventFlag);
+ set_bit(MC_SUSPEND_EVENT, &cds_sched_context->mcEventFlag);
wake_up_interruptible(&cds_sched_context->mcWaitQueue);
/* Wait for suspend confirmation from MC thread */
rc = wait_for_completion_timeout(&pHddCtx->mc_sus_event_var,
msecs_to_jiffies(WLAN_WAIT_TIME_MCTHREAD_SUSPEND));
if (!rc) {
- clear_bit(MC_SUSPEND_EVENT_MASK,
+ clear_bit(MC_SUSPEND_EVENT,
&cds_sched_context->mcEventFlag);
hdd_err("Failed to stop mc thread");
goto resume_tx;
@@ -2016,14 +2016,14 @@ next_adapter:
#ifdef QCA_CONFIG_SMP
/* Suspend tlshim rx thread */
- set_bit(RX_SUSPEND_EVENT_MASK, &cds_sched_context->ol_rx_event_flag);
+ set_bit(RX_SUSPEND_EVENT, &cds_sched_context->ol_rx_event_flag);
wake_up_interruptible(&cds_sched_context->ol_rx_wait_queue);
rc = wait_for_completion_timeout(&cds_sched_context->
ol_suspend_rx_event,
msecs_to_jiffies
(RX_TLSHIM_SUSPEND_TIMEOUT));
if (!rc) {
- clear_bit(RX_SUSPEND_EVENT_MASK,
+ clear_bit(RX_SUSPEND_EVENT,
&cds_sched_context->ol_rx_event_flag);
hdd_err("Failed to stop tl_shim rx thread");
goto resume_all;