Explorar el Código

qcacld-3.0: Deinterleave the RSSI and SNR callbacks

Currently the RSSI and SNR callback functions are interleaved with
respect to the calling functions. The order in which the functions
currently appear in wlan_hdd_wext.c is:
	hdd_get_rssi_cb()
	hdd_get_snr_cb()
	wlan_hdd_get_rssi()
	wlan_hdd_get_snr()

Since each callback function is tightly coupled with its calling
function, it makes sense for the callback function to be contiguous
with the calling function in the code. Therefore change to order to:
	hdd_get_rssi_cb()
	wlan_hdd_get_rssi()
	hdd_get_snr_cb()
	wlan_hdd_get_snr()

Change-Id: I19078175049fc1a38716387df57f4e643dbbbd62
CRs-Fixed: 1116166
Jeff Johnson hace 8 años
padre
commit
8eaff30809
Se han modificado 1 ficheros con 54 adiciones y 54 borrados
  1. 54 54
      core/hdd/src/wlan_hdd_wext.c

+ 54 - 54
core/hdd/src/wlan_hdd_wext.c

@@ -1761,60 +1761,6 @@ static void hdd_get_rssi_cb(int8_t rssi, uint32_t staId, void *pContext)
 	spin_unlock(&hdd_context_lock);
 }
 
-/**
- * hdd_get_snr_cb() - "Get SNR" callback function
- * @snr: Current SNR of the station
- * @staId: ID of the station
- * @pContext: opaque context originally passed to SME.  HDD always passes
- *	a &struct statsContext
- *
- * Return: None
- */
-static void hdd_get_snr_cb(int8_t snr, uint32_t staId, void *pContext)
-{
-	struct statsContext *pStatsContext;
-	hdd_adapter_t *pAdapter;
-
-	if (NULL == pContext) {
-		hdd_err("Bad param");
-		return;
-	}
-
-	pStatsContext = pContext;
-	pAdapter = pStatsContext->pAdapter;
-
-	/* there is a race condition that exists between this callback
-	 * function and the caller since the caller could time out
-	 * either before or while this code is executing.  we use a
-	 * spinlock to serialize these actions
-	 */
-	spin_lock(&hdd_context_lock);
-
-	if ((NULL == pAdapter) || (SNR_CONTEXT_MAGIC != pStatsContext->magic)) {
-		/* the caller presumably timed out so there is nothing
-		 * we can do
-		 */
-		spin_unlock(&hdd_context_lock);
-		hdd_warn("Invalid context, pAdapter [%p] magic [%08x]",
-			 pAdapter, pStatsContext->magic);
-		return;
-	}
-
-	/* context is valid so caller is still waiting */
-
-	/* paranoia: invalidate the magic */
-	pStatsContext->magic = 0;
-
-	/* copy over the snr */
-	pAdapter->snr = snr;
-
-	/* notify the caller */
-	complete(&pStatsContext->completion);
-
-	/* serialization is complete */
-	spin_unlock(&hdd_context_lock);
-}
-
 /**
  * wlan_hdd_get_rssi() - Get the current RSSI
  * @pAdapter: adapter upon which the measurement is requested
@@ -1902,6 +1848,60 @@ QDF_STATUS wlan_hdd_get_rssi(hdd_adapter_t *pAdapter, int8_t *rssi_value)
 	return QDF_STATUS_SUCCESS;
 }
 
+/**
+ * hdd_get_snr_cb() - "Get SNR" callback function
+ * @snr: Current SNR of the station
+ * @staId: ID of the station
+ * @pContext: opaque context originally passed to SME.  HDD always passes
+ *	a &struct statsContext
+ *
+ * Return: None
+ */
+static void hdd_get_snr_cb(int8_t snr, uint32_t staId, void *pContext)
+{
+	struct statsContext *pStatsContext;
+	hdd_adapter_t *pAdapter;
+
+	if (NULL == pContext) {
+		hdd_err("Bad param");
+		return;
+	}
+
+	pStatsContext = pContext;
+	pAdapter = pStatsContext->pAdapter;
+
+	/* there is a race condition that exists between this callback
+	 * function and the caller since the caller could time out
+	 * either before or while this code is executing.  we use a
+	 * spinlock to serialize these actions
+	 */
+	spin_lock(&hdd_context_lock);
+
+	if ((NULL == pAdapter) || (SNR_CONTEXT_MAGIC != pStatsContext->magic)) {
+		/* the caller presumably timed out so there is nothing
+		 * we can do
+		 */
+		spin_unlock(&hdd_context_lock);
+		hdd_warn("Invalid context, pAdapter [%p] magic [%08x]",
+			 pAdapter, pStatsContext->magic);
+		return;
+	}
+
+	/* context is valid so caller is still waiting */
+
+	/* paranoia: invalidate the magic */
+	pStatsContext->magic = 0;
+
+	/* copy over the snr */
+	pAdapter->snr = snr;
+
+	/* notify the caller */
+	complete(&pStatsContext->completion);
+
+	/* serialization is complete */
+	spin_unlock(&hdd_context_lock);
+}
+
 /**
  * wlan_hdd_get_snr() - Get the current SNR
  * @pAdapter: adapter upon which the measurement is requested