All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] DSPBRIDGE: cleanup patch for DRV_RemoveAllSTRMResElements function
@ 2010-02-17  0:39 Guzman Lugo, Fernando
  2010-02-23 16:23 ` Omar Ramirez Luna
  0 siblings, 1 reply; 2+ messages in thread
From: Guzman Lugo, Fernando @ 2010-02-17  0:39 UTC (permalink / raw)
  To: linux-omap
  Cc: Hiroshi Doyu, Ameya Palande, Felipe Contreras, Ramirez Luna, Omar

>From 718174a6ed1b54ce0120080a953d7f0a5ebb8d6d Mon Sep 17 00:00:00 2001
From: Fernando Guzman Lugo <x0095840@ti.com>
Date: Tue, 16 Feb 2010 18:14:26 -0600
Subject: [PATCH] DSPBRIDGE: cleanup patch for DRV_RemoveAllSTRMResElements function

This patches clenaups the function DRV_RemoveAllSTRMResElements and
DRV_ProcFreeSTRMRes and it turns them into one function.

Signed-off-by: Fernando Guzman Lugo <x0095840@ti.com>
---
 drivers/dsp/bridge/rmgr/drv.c |   66 ++++++++++++----------------------------
 1 files changed, 20 insertions(+), 46 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/drv.c b/drivers/dsp/bridge/rmgr/drv.c
index 36bab9f..505f2b0 100644
--- a/drivers/dsp/bridge/rmgr/drv.c
+++ b/drivers/dsp/bridge/rmgr/drv.c
@@ -77,7 +77,6 @@ static DSP_STATUS RequestBridgeResourcesDSP(u32 dwContext, s32 fRequest);
 /* GPP PROCESS CLEANUP CODE */
 
 static DSP_STATUS DRV_ProcFreeNodeRes(HANDLE hPCtxt);
-static DSP_STATUS  DRV_ProcFreeSTRMRes(HANDLE hPCtxt);
 extern enum NODE_STATE NODE_GetState(HANDLE hNode);
 
 /* Allocate and add a node resource element
@@ -453,65 +452,40 @@ DSP_STATUS 	DRV_ProcRemoveSTRMResElement(HANDLE hSTRMRes, HANDLE hPCtxt)
 	return DSP_SOK;
 }
 
-/* Actual Stream De-Allocation */
-static DSP_STATUS  DRV_ProcFreeSTRMRes(HANDLE hPCtxt)
+/* Release all Stream resources and its context
+* This is called from .bridge_release.
+*/
+DSP_STATUS DRV_RemoveAllSTRMResElements(HANDLE hPCtxt)
 {
 	struct PROCESS_CONTEXT *pCtxt = (struct PROCESS_CONTEXT *)hPCtxt;
 	DSP_STATUS status = DSP_SOK;
-	DSP_STATUS status1 = DSP_SOK;
+	struct STRM_RES_OBJECT *strm_res = NULL;
+	struct STRM_RES_OBJECT *strm_tmp = NULL;
 	u8 **apBuffer = NULL;
-	struct STRM_RES_OBJECT *pSTRMList = NULL;
-	struct STRM_RES_OBJECT *pSTRMRes = NULL;
 	u8 *pBufPtr;
 	u32 ulBytes;
 	u32 dwArg;
 	s32 ulBufSize;
 
-	pSTRMList = pCtxt->pSTRMList;
-	while (pSTRMList != NULL) {
-		pSTRMRes = pSTRMList;
-		pSTRMList = pSTRMList->next;
-		if (pSTRMRes->uNumBufs != 0) {
-			apBuffer = MEM_Alloc((pSTRMRes->uNumBufs *
+	strm_tmp = pCtxt->pSTRMList;
+	while (strm_tmp) {
+		strm_res = strm_tmp;
+		strm_tmp = strm_tmp->next;
+		if (strm_res->uNumBufs) {
+			apBuffer = MEM_Alloc((strm_res->uNumBufs *
 					    sizeof(u8 *)), MEM_NONPAGED);
-			status = STRM_FreeBuffer(pSTRMRes->hStream, apBuffer,
-						pSTRMRes->uNumBufs, pCtxt);
+			status = STRM_FreeBuffer(strm_res->hStream, apBuffer,
+						strm_res->uNumBufs, pCtxt);
 			kfree(apBuffer);
 		}
-		status = STRM_Close(pSTRMRes->hStream, pCtxt);
-		if (DSP_FAILED(status)) {
-			if (status == DSP_EPENDING) {
-				status = STRM_Reclaim(pSTRMRes->hStream,
-						     &pBufPtr, &ulBytes,
-						     (u32 *)&ulBufSize, &dwArg);
-				if (DSP_SUCCEEDED(status))
-					status = STRM_Close(pSTRMRes->hStream,
-							pCtxt);
-
-			}
+		status = STRM_Close(strm_res->hStream, pCtxt);
+		if (status == DSP_EPENDING) {
+			status = STRM_Reclaim(strm_res->hStream,
+				&pBufPtr, &ulBytes, (u32 *)&ulBufSize, &dwArg);
+			if (DSP_SUCCEEDED(status))
+				status = STRM_Close(strm_res->hStream, pCtxt);
 		}
 	}
-	return status1;
-}
-
-/* Release all Stream resources and its context
-* This is called from .bridge_release.
-*/
-DSP_STATUS	DRV_RemoveAllSTRMResElements(HANDLE hPCtxt)
-{
-	struct PROCESS_CONTEXT *pCtxt = (struct PROCESS_CONTEXT *)hPCtxt;
-	DSP_STATUS status = DSP_SOK;
-	struct STRM_RES_OBJECT *pTempSTRMRes2 = NULL;
-	struct STRM_RES_OBJECT *pTempSTRMRes = NULL;
-
-	DRV_ProcFreeSTRMRes(pCtxt);
-	pTempSTRMRes = pCtxt->pSTRMList;
-	while (pTempSTRMRes != NULL) {
-		pTempSTRMRes2 = pTempSTRMRes;
-		pTempSTRMRes = pTempSTRMRes->next;
-		kfree(pTempSTRMRes2);
-	}
-	pCtxt->pSTRMList = NULL;
 	return status;
 }
 
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2] DSPBRIDGE: cleanup patch for DRV_RemoveAllSTRMResElements function
  2010-02-17  0:39 [PATCH 1/2] DSPBRIDGE: cleanup patch for DRV_RemoveAllSTRMResElements function Guzman Lugo, Fernando
@ 2010-02-23 16:23 ` Omar Ramirez Luna
  0 siblings, 0 replies; 2+ messages in thread
From: Omar Ramirez Luna @ 2010-02-23 16:23 UTC (permalink / raw)
  To: Guzman Lugo, Fernando
  Cc: linux-omap, Hiroshi Doyu, Ameya Palande, Felipe Contreras

On 2/16/2010 6:39 PM, Guzman Lugo, Fernando wrote:
>  From 718174a6ed1b54ce0120080a953d7f0a5ebb8d6d Mon Sep 17 00:00:00 2001
> From: Fernando Guzman Lugo<x0095840@ti.com>
> Date: Tue, 16 Feb 2010 18:14:26 -0600
> Subject: [PATCH] DSPBRIDGE: cleanup patch for DRV_RemoveAllSTRMResElements function
>
> This patches clenaups the function DRV_RemoveAllSTRMResElements and
> DRV_ProcFreeSTRMRes and it turns them into one function.
>
> Signed-off-by: Fernando Guzman Lugo<x0095840@ti.com>
> ---
>   drivers/dsp/bridge/rmgr/drv.c |   66 ++++++++++++----------------------------
>   1 files changed, 20 insertions(+), 46 deletions(-)
>

Acked-by: Omar Ramirez Luna <omar.ramirez@ti.com>

Pushed to dspbridge

- omar


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-02-23 16:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-17  0:39 [PATCH 1/2] DSPBRIDGE: cleanup patch for DRV_RemoveAllSTRMResElements function Guzman Lugo, Fernando
2010-02-23 16:23 ` Omar Ramirez Luna

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.