Skip to contentSkip to conversation

DSPBRIDGE: Get rid of services/LST_* (step 1)

PATCH New Andy Shevchenko 1 participant 1 message Sep 1, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 DSPBRIDGE: Get rid of services/LST_* (step 1)

From: Andy Shevchenko <[email protected]>

- Remove LST_Init() and LST_Exit() calls because they are doing nothing except tracing, Thus, remove tracing as well.

- Remove DBC_* calls. It's internal kernel business whether to have those assertions.

- Switch to list_head structure instead of LST_ELEM. Remove redudant code that uses head->self pointer.

- Use native list methods where it's possible in the list.c.

---
 arch/arm/plat-omap/include/dspbridge/list.h |   43 +----------
 drivers/dsp/bridge/services/list.c          |  108 +-------------------------
 drivers/dsp/bridge/services/mem.c           |    2 -
 drivers/dsp/bridge/services/services.c      |    9 +--
 4 files changed, 10 insertions(+), 152 deletions(-)
arch/arm/plat-omap/include/dspbridge/list.h +3 -40
index 2e3f995..f9bbd13 100644
@@ -24,11 +24,9 @@
  *  Public Functions:
  *      LST_Create
  *      LST_Delete
- *      LST_Exit
  *      LST_First
  *      LST_GetHead
  *      LST_InitElem
- *      LST_Init
  *      LST_InsertBefore
  *      LST_IsEmpty
  *      LST_Next
@@ -51,14 +49,10 @@
 #define LIST_
 
 #include <dspbridge/host_os.h>
+#include <linux/list.h>
 
-#define LST_IsEmpty(l)      (((l)->head.next == &(l)->head))
-
-	struct LST_ELEM {
-		struct LST_ELEM *next;
-		struct LST_ELEM *prev;
-		struct LST_ELEM *self;
-	} ;
+#define LST_ELEM            list_head
+#define LST_IsEmpty(l)      list_empty(&(l)->head)
 
 	struct LST_LIST {
 		struct LST_ELEM head;
@@ -111,20 +105,6 @@
 	extern void LST_Delete(IN struct LST_LIST *pList);
 
 /*
- *  ======== LST_Exit ========
- *  Purpose:
- *      Discontinue usage of module; free resources when reference count
- *      reaches 0.
- *  Parameters:
- *  Returns:
- *  Requires:
- *      LST initialized.
- *  Ensures:
- *      Resources used by module are freed when cRef reaches zero.
- */
-	extern void LST_Exit(void);
-
-/*
  *  ======== LST_First ========
  *  Purpose:
  *      Returns a pointer to the first element of the list, or NULL if the list
@@ -160,7 +140,6 @@
  *      Pointer to element that was at the head of the list (success)
  *      NULL          No elements in list
  *  Requires:
- *      - head.self must be correctly set to &head.
  *      - LST initialized.
  *      - pList != NULL.
  *  Ensures:
@@ -172,19 +151,6 @@
 	extern struct LST_ELEM *LST_GetHead(IN struct LST_LIST *pList);
 
 /*
- *  ======== LST_Init ========
- *  Purpose:
- *      Initializes private state of LST module.
- *  Parameters:
- *  Returns:
- *      TRUE if initialized; FALSE otherwise.
- *  Requires:
- *  Ensures:
- *      LST initialized.
- */
-	extern bool LST_Init(void);
-
-/*
  *  ======== LST_InitElem ========
  *  Purpose:
  *      Initializes a list element to default (cleared) values
@@ -262,15 +228,12 @@
  *      Void
  *  Requires:
  *      *pElem and *pList must both exist.
- *      pElem->self = pElem before pElem is passed to this function.
  *      LST initialized.
  *  Ensures:
  *  Notes:
  *      Because the tail is always "just before" the head of the list (the
  *      tail's "next" pointer points at the head of the list, and the head's
  *      "prev" pointer points at the tail of the list), the list is circular.
- *  Warning: if pElem->self is not set beforehand, LST_GetHead() will
- *      return an erroneous pointer when it is called for this element.
  */
 	extern void LST_PutTail(IN struct LST_LIST *pList,
 				IN struct LST_ELEM *pListElem);
drivers/dsp/bridge/services/list.c +5 -103

199 lines not on this page · raw message

drivers/dsp/bridge/services/mem.c +0 -2
index 22f382b..cc16e5d 100644
@@ -125,7 +125,6 @@ static inline void MLST_PutTail(struct LST_LIST *pList, struct LST_ELEM *pElem)
 	pElem->next = &pList->head;
 	pList->head.prev = pElem;
 	pElem->prev->next = pElem;
-	pElem->self = pElem;
 }
 
 static inline void MLST_RemoveElem(struct LST_LIST *pList,
@@ -612,7 +611,6 @@ bool MEM_Init(void)
 #ifdef MEM_CHECK
 		mMan.lst.head.next = &mMan.lst.head;
 		mMan.lst.head.prev = &mMan.lst.head;
-		mMan.lst.head.self = NULL;
 		spin_lock_init(&mMan.lock);
 #endif
 
drivers/dsp/bridge/services/services.c +2 -7
index 346007e..316774e 100644
@@ -87,7 +87,6 @@ void SERVICES_Exit(void)
 		SYNC_Exit();
 		CLK_Exit();
 		REG_Exit();
-		LST_Exit();
 		KFILE_Exit();
 		DPC_Exit();
 		DBG_Exit();
@@ -109,7 +108,7 @@ void SERVICES_Exit(void)
 bool SERVICES_Init(void)
 {
 	bool fInit = true;
-       bool fCFG, fCSL, fDBG, fDPC, fKFILE, fLST, fMEM;
+       bool fCFG, fCSL, fDBG, fDPC, fKFILE, fMEM;
        bool fREG, fSYNC, fCLK, fUTIL, fNTFY;
 
 	DBC_Require(cRefs >= 0);
@@ -130,7 +129,6 @@ bool SERVICES_Init(void)
 		fDBG = DBG_Init();
 		fDPC = DPC_Init();
 		fKFILE = KFILE_Init();
-		fLST = LST_Init();
 		/* fREG = REG_Init(); */
 		fSYNC = SYNC_Init();
 		fCLK  = CLK_Init();
@@ -138,7 +136,7 @@ bool SERVICES_Init(void)
 		fNTFY = NTFY_Init();
 
                fInit = fCFG && fCSL && fDBG && fDPC && fKFILE &&
-                       fLST && fMEM && fREG && fSYNC && fCLK && fUTIL;
+                       fMEM && fREG && fSYNC && fCLK && fUTIL;
 
 		if (!fInit) {
 			if (fNTFY)
@@ -156,9 +154,6 @@ bool SERVICES_Init(void)
 			if (fREG)
 				REG_Exit();
 
-			if (fLST)
-				LST_Exit();
-
 			if (fKFILE)
 				KFILE_Exit();
 
Signature · 1 line
1.5.6.5