Parcourir la source

qcacld-3.0: Fix kernel checkpatch warnings in csr_link_list.c

Fix kernel checkpatch warnings in csr_link_list.c

Change-Id: I05ae3798dae5cbe3bc602aa3e99762303c1e12f3
CRs-Fixed: 2025503
Nishank Aggarwal il y a 8 ans
Parent
commit
d3485ed710
1 fichiers modifiés avec 58 ajouts et 84 suppressions
  1. 58 84
      core/sme/src/csr/csr_link_list.c

+ 58 - 84
core/sme/src/csr/csr_link_list.c

@@ -25,13 +25,11 @@
  * to the Linux Foundation.
  */
 
-/** ------------------------------------------------------------------------- *
-    ------------------------------------------------------------------------- *
-    \file csr_link_list.c
-
-    Implementation for the Common link list interfaces.
-   ========================================================================== */
-
+/*
+ * DOC: csr_link_list.c
+ *
+ * Implementation for the Common link list interfaces.
+ */
 #include "csr_link_list.h"
 #include "qdf_lock.h"
 #include "qdf_mem.h"
@@ -106,6 +104,7 @@ static inline void csr_list_insert_head(tListElem *pHead, tListElem *pEntry)
 static void csr_list_insert_entry(tListElem *pEntry, tListElem *pNewEntry)
 {
 	tListElem *pLast;
+
 	if (!pEntry) {
 		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
 			  "%s: Error!! pEntry is Null", __func__);
@@ -129,9 +128,8 @@ uint32_t csr_ll_count(tDblLinkList *pList)
 		return c;
 	}
 
-	if (pList && (LIST_FLAG_OPEN == pList->Flag)) {
+	if (pList && (LIST_FLAG_OPEN == pList->Flag))
 		c = pList->Count;
-	}
 
 	return c;
 }
@@ -145,9 +143,8 @@ void csr_ll_lock(tDblLinkList *pList)
 		return;
 	}
 
-	if (LIST_FLAG_OPEN == pList->Flag) {
+	if (LIST_FLAG_OPEN == pList->Flag)
 		qdf_mutex_acquire(&pList->Lock);
-	}
 }
 
 void csr_ll_unlock(tDblLinkList *pList)
@@ -159,9 +156,8 @@ void csr_ll_unlock(tDblLinkList *pList)
 		return;
 	}
 
-	if (LIST_FLAG_OPEN == pList->Flag) {
+	if (LIST_FLAG_OPEN == pList->Flag)
 		qdf_mutex_release(&pList->Lock);
-	}
 }
 
 bool csr_ll_is_list_empty(tDblLinkList *pList, bool fInterlocked)
@@ -175,15 +171,13 @@ bool csr_ll_is_list_empty(tDblLinkList *pList, bool fInterlocked)
 	}
 
 	if (LIST_FLAG_OPEN == pList->Flag) {
-		if (fInterlocked) {
+		if (fInterlocked)
 			csr_ll_lock(pList);
-		}
 
 		fEmpty = csrIsListEmpty(&pList->ListHead);
 
-		if (fInterlocked) {
+		if (fInterlocked)
 			csr_ll_unlock(pList);
-		}
 	}
 	return fEmpty;
 }
@@ -202,8 +196,9 @@ bool csr_ll_find_entry(tDblLinkList *pList, tListElem *pEntryToFind)
 	if (LIST_FLAG_OPEN == pList->Flag) {
 		pEntry = csr_ll_peek_head(pList, LL_ACCESS_NOLOCK);
 
-		/* Have to make sure we don't loop back to the head of the list, which will */
-		/* happen if the entry is NOT on the list... */
+		/* Have to make sure we don't loop back to the head of the list,
+		 * which will happen if the entry is NOT on the list.
+		 */
 
 		while (pEntry && (pEntry != &pList->ListHead)) {
 			if (pEntry == pEntryToFind) {
@@ -237,9 +232,8 @@ QDF_STATUS csr_ll_open(tHddHandle hHdd, tDblLinkList *pList)
 			csr_list_init(&pList->ListHead);
 			pList->Flag = LIST_FLAG_OPEN;
 			pList->hHdd = hHdd;
-		} else {
+		} else
 			status = QDF_STATUS_E_FAILURE;
-		}
 	}
 	return status;
 }
@@ -270,14 +264,13 @@ void csr_ll_insert_tail(tDblLinkList *pList, tListElem *pEntry,
 	}
 
 	if (LIST_FLAG_OPEN == pList->Flag) {
-		if (fInterlocked) {
+		if (fInterlocked)
 			csr_ll_lock(pList);
-		}
+
 		csr_list_insert_tail(&pList->ListHead, pEntry);
 		pList->Count++;
-		if (fInterlocked) {
+		if (fInterlocked)
 			csr_ll_unlock(pList);
-		}
 	}
 }
 
@@ -292,19 +285,18 @@ void csr_ll_insert_head(tDblLinkList *pList, tListElem *pEntry,
 	}
 
 	if (LIST_FLAG_OPEN == pList->Flag) {
-		if (fInterlocked) {
+		if (fInterlocked)
 			csr_ll_lock(pList);
-		}
+
 		csr_list_insert_head(&pList->ListHead, pEntry);
 		pList->Count++;
-		if (fInterlocked) {
+		if (fInterlocked)
 			csr_ll_unlock(pList);
-		}
-		if (pList->cmdTimeoutTimer && pList->cmdTimeoutDuration) {
+
+		if (pList->cmdTimeoutTimer && pList->cmdTimeoutDuration)
 			/* timer to detect pending command in activelist */
 			qdf_mc_timer_start(pList->cmdTimeoutTimer,
 					   pList->cmdTimeoutDuration);
-		}
 	}
 }
 
@@ -318,14 +310,13 @@ void csr_ll_insert_entry(tDblLinkList *pList, tListElem *pEntry,
 	}
 
 	if (LIST_FLAG_OPEN == pList->Flag) {
-		if (fInterlocked) {
+		if (fInterlocked)
 			csr_ll_lock(pList);
-		}
+
 		csr_list_insert_entry(pEntry, pNewEntry);
 		pList->Count++;
-		if (fInterlocked) {
+		if (fInterlocked)
 			csr_ll_unlock(pList);
-		}
 	}
 }
 
@@ -340,18 +331,15 @@ tListElem *csr_ll_remove_tail(tDblLinkList *pList, bool fInterlocked)
 	}
 
 	if (LIST_FLAG_OPEN == pList->Flag) {
-		if (fInterlocked) {
+		if (fInterlocked)
 			csr_ll_lock(pList);
-		}
 
 		if (!csrIsListEmpty(&pList->ListHead)) {
-
 			pEntry = csr_list_remove_tail(&pList->ListHead);
 			pList->Count--;
 		}
-		if (fInterlocked) {
+		if (fInterlocked)
 			csr_ll_unlock(pList);
-		}
 	}
 
 	return pEntry;
@@ -368,16 +356,14 @@ tListElem *csr_ll_peek_tail(tDblLinkList *pList, bool fInterlocked)
 	}
 
 	if (LIST_FLAG_OPEN == pList->Flag) {
-		if (fInterlocked) {
+		if (fInterlocked)
 			csr_ll_lock(pList);
-		}
 
-		if (!csrIsListEmpty(&pList->ListHead)) {
+		if (!csrIsListEmpty(&pList->ListHead))
 			pEntry = pList->ListHead.last;
-		}
-		if (fInterlocked) {
+
+		if (fInterlocked)
 			csr_ll_unlock(pList);
-		}
 	}
 
 	return pEntry;
@@ -394,18 +380,16 @@ tListElem *csr_ll_remove_head(tDblLinkList *pList, bool fInterlocked)
 	}
 
 	if (LIST_FLAG_OPEN == pList->Flag) {
-		if (fInterlocked) {
+		if (fInterlocked)
 			csr_ll_lock(pList);
-		}
 
 		if (!csrIsListEmpty(&pList->ListHead)) {
 			pEntry = csr_list_remove_head(&pList->ListHead);
 			pList->Count--;
 		}
 
-		if (fInterlocked) {
+		if (fInterlocked)
 			csr_ll_unlock(pList);
-		}
 	}
 
 	return pEntry;
@@ -422,16 +406,14 @@ tListElem *csr_ll_peek_head(tDblLinkList *pList, bool fInterlocked)
 	}
 
 	if (LIST_FLAG_OPEN == pList->Flag) {
-		if (fInterlocked) {
+		if (fInterlocked)
 			csr_ll_lock(pList);
-		}
 
-		if (!csrIsListEmpty(&pList->ListHead)) {
+		if (!csrIsListEmpty(&pList->ListHead))
 			pEntry = pList->ListHead.next;
-		}
-		if (fInterlocked) {
+
+		if (fInterlocked)
 			csr_ll_unlock(pList);
-		}
 	}
 
 	return pEntry;
@@ -448,16 +430,15 @@ void csr_ll_purge(tDblLinkList *pList, bool fInterlocked)
 	}
 
 	if (LIST_FLAG_OPEN == pList->Flag) {
-		if (fInterlocked) {
+		if (fInterlocked)
 			csr_ll_lock(pList);
-		}
-		while ((pEntry = csr_ll_remove_head(pList, LL_ACCESS_NOLOCK))) {
-			/* just remove everything from the list until */
-			/* nothing left on the list. */
-		}
-		if (fInterlocked) {
+
+		/* Remove everything from the list */
+		while ((pEntry = csr_ll_remove_head(pList, LL_ACCESS_NOLOCK)))
+			;
+
+		if (fInterlocked)
 			csr_ll_unlock(pList);
-		}
 	}
 }
 
@@ -474,14 +455,14 @@ bool csr_ll_remove_entry(tDblLinkList *pList, tListElem *pEntryToRemove,
 	}
 
 	if (LIST_FLAG_OPEN == pList->Flag) {
-		if (fInterlocked) {
+		if (fInterlocked)
 			csr_ll_lock(pList);
-		}
 
 		pEntry = csr_ll_peek_head(pList, LL_ACCESS_NOLOCK);
 
-		/* Have to make sure we don't loop back to the head of the list, which will */
-		/* happen if the entry is NOT on the list... */
+		/* Have to make sure we don't loop back to the head of the
+		 * list, which will happen if the entry is NOT on the list.
+		 */
 		while (pEntry && (pEntry != &pList->ListHead)) {
 			if (pEntry == pEntryToRemove) {
 				csr_list_remove_entry(pEntry);
@@ -493,12 +474,11 @@ bool csr_ll_remove_entry(tDblLinkList *pList, tListElem *pEntryToRemove,
 
 			pEntry = pEntry->next;
 		}
-		if (fInterlocked) {
+		if (fInterlocked)
 			csr_ll_unlock(pList);
-		}
-		if (pList->cmdTimeoutTimer) {
+
+		if (pList->cmdTimeoutTimer)
 			qdf_mc_timer_stop(pList->cmdTimeoutTimer);
-		}
 	}
 
 	return fFound;
@@ -516,22 +496,19 @@ tListElem *csr_ll_next(tDblLinkList *pList, tListElem *pEntry,
 	}
 
 	if (LIST_FLAG_OPEN == pList->Flag) {
-		if (fInterlocked) {
+		if (fInterlocked)
 			csr_ll_lock(pList);
-		}
 
 		if (!csrIsListEmpty(&pList->ListHead)
 		    && csr_ll_find_entry(pList, pEntry)) {
 			pNextEntry = pEntry->next;
 			/* Make sure we don't walk past the head */
-			if (pNextEntry == &pList->ListHead) {
+			if (pNextEntry == &pList->ListHead)
 				pNextEntry = NULL;
-			}
 		}
 
-		if (fInterlocked) {
+		if (fInterlocked)
 			csr_ll_unlock(pList);
-		}
 	}
 
 	return pNextEntry;
@@ -549,22 +526,19 @@ tListElem *csr_ll_previous(tDblLinkList *pList, tListElem *pEntry,
 	}
 
 	if (LIST_FLAG_OPEN == pList->Flag) {
-		if (fInterlocked) {
+		if (fInterlocked)
 			csr_ll_lock(pList);
-		}
 
 		if (!csrIsListEmpty(&pList->ListHead)
 		    && csr_ll_find_entry(pList, pEntry)) {
 			pNextEntry = pEntry->last;
 			/* Make sure we don't walk past the head */
-			if (pNextEntry == &pList->ListHead) {
+			if (pNextEntry == &pList->ListHead)
 				pNextEntry = NULL;
-			}
 		}
 
-		if (fInterlocked) {
+		if (fInterlocked)
 			csr_ll_unlock(pList);
-		}
 	}
 
 	return pNextEntry;