public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] DSPBRIDGE: Reclaim all pending buffer on resource cleanup
@ 2010-02-17  0:40 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:40 UTC (permalink / raw)
  To: linux-omap
  Cc: Ramirez Luna, Omar, Hiroshi Doyu, Ameya Palande, Felipe Contreras

>From 6ed51fea16df51e88a25bda2b9908f0a43b86303 Mon Sep 17 00:00:00 2001
From: Fernando Guzman Lugo <x0095840@ti.com>
Date: Tue, 16 Feb 2010 18:32:02 -0600
Subject: [PATCH] DSPBRIDGE: Reclaim all pending buffer on resource cleanup

Before in case of pending buffer while we try to close
a stream, it was doing only one reclaim, in the case there
were more pending buffer the second STRM_Close would also
fail, now all the pending buffers are reclaim.

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

diff --git a/drivers/dsp/bridge/rmgr/drv.c b/drivers/dsp/bridge/rmgr/drv.c
index 505f2b0..5a394da 100644
--- a/drivers/dsp/bridge/rmgr/drv.c
+++ b/drivers/dsp/bridge/rmgr/drv.c
@@ -461,6 +461,8 @@ DSP_STATUS DRV_RemoveAllSTRMResElements(HANDLE hPCtxt)
 	DSP_STATUS status = DSP_SOK;
 	struct STRM_RES_OBJECT *strm_res = NULL;
 	struct STRM_RES_OBJECT *strm_tmp = NULL;
+	struct STRM_INFO strm_info;
+	struct DSP_STREAMINFO user;
 	u8 **apBuffer = NULL;
 	u8 *pBufPtr;
 	u32 ulBytes;
@@ -474,17 +476,19 @@ DSP_STATUS DRV_RemoveAllSTRMResElements(HANDLE hPCtxt)
 		if (strm_res->uNumBufs) {
 			apBuffer = MEM_Alloc((strm_res->uNumBufs *
 					    sizeof(u8 *)), MEM_NONPAGED);
-			status = STRM_FreeBuffer(strm_res->hStream, apBuffer,
-						strm_res->uNumBufs, pCtxt);
-			kfree(apBuffer);
+			if (apBuffer) {
+				status = STRM_FreeBuffer(strm_res->hStream,
+					apBuffer, strm_res->uNumBufs, pCtxt);
+				kfree(apBuffer);
+			}
 		}
+		strm_info.pUser = &user;
+		user.uNumberBufsInStream = 0;
+		STRM_GetInfo(strm_res->hStream, &strm_info, sizeof(strm_info));
+		while (user.uNumberBufsInStream--)
+			STRM_Reclaim(strm_res->hStream, &pBufPtr, &ulBytes,
+					     (u32 *)&ulBufSize, &dwArg);
 		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 status;
 }
-- 
1.6.0.4


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

* Re: [PATCH 2/2] DSPBRIDGE: Reclaim all pending buffer on resource cleanup
  2010-02-17  0:40 [PATCH 2/2] DSPBRIDGE: Reclaim all pending buffer on resource cleanup 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:40 PM, Guzman Lugo, Fernando wrote:
>  From 6ed51fea16df51e88a25bda2b9908f0a43b86303 Mon Sep 17 00:00:00 2001
> From: Fernando Guzman Lugo<x0095840@ti.com>
> Date: Tue, 16 Feb 2010 18:32:02 -0600
> Subject: [PATCH] DSPBRIDGE: Reclaim all pending buffer on resource cleanup
>
> Before in case of pending buffer while we try to close
> a stream, it was doing only one reclaim, in the case there
> were more pending buffer the second STRM_Close would also
> fail, now all the pending buffers are reclaim.
>
> Signed-off-by: Fernando Guzman Lugo<x0095840@ti.com>
> ---
>   drivers/dsp/bridge/rmgr/drv.c |   22 +++++++++++++---------
>   1 files changed, 13 insertions(+), 9 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:40 [PATCH 2/2] DSPBRIDGE: Reclaim all pending buffer on resource cleanup Guzman Lugo, Fernando
2010-02-23 16:23 ` Omar Ramirez Luna

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox