Browse Source

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
Manjeet Singh 8 years ago
parent
commit
1a376cea13
3 changed files with 30 additions and 27 deletions
  1. 14 11
      core/cds/inc/cds_sched.h
  2. 12 12
      core/cds/src/cds_sched.c
  3. 4 4
      core/hdd/src/wlan_hdd_power.c

+ 14 - 11
core/cds/inc/cds_sched.h

@@ -50,17 +50,20 @@
 #include "qdf_mc_timer.h"
 #include "cds_config.h"
 
-#define TX_POST_EVENT_MASK               0x001
-#define TX_SUSPEND_EVENT_MASK            0x002
-#define RX_POST_EVENT_MASK               0x001
-#define RX_SUSPEND_EVENT_MASK            0x002
-#define TX_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
 
 #ifdef QCA_CONFIG_SMP
 /*

+ 12 - 12
core/cds/src/cds_sched.c

@@ -669,7 +669,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);
 }
 
@@ -788,22 +788,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);
@@ -817,9 +817,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
@@ -862,8 +862,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;

+ 4 - 4
core/hdd/src/wlan_hdd_power.c

@@ -1832,14 +1832,14 @@ next_adapter:
 
 	/* Suspend control path scheduler */
 	scheduler_register_hdd_suspend_callback(hdd_suspend_cb);
-	scheduler_set_event_mask(MC_SUSPEND_EVENT_MASK);
+	scheduler_set_event_mask(MC_SUSPEND_EVENT);
 	scheduler_wake_up_controller_thread();
 
 	/* Wait for suspend confirmation from scheduler */
 	rc = wait_for_completion_timeout(&pHddCtx->mc_sus_event_var,
 		msecs_to_jiffies(WLAN_WAIT_TIME_MCTHREAD_SUSPEND));
 	if (!rc) {
-		scheduler_clear_event_mask(MC_SUSPEND_EVENT_MASK);
+		scheduler_clear_event_mask(MC_SUSPEND_EVENT);
 		hdd_err("Failed to stop mc thread");
 		goto resume_tx;
 	}
@@ -1847,14 +1847,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;