From patchwork Mon Feb 8 22:20:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guzman Lugo, Fernando" X-Patchwork-Id: 77864 X-Patchwork-Delegate: omar.ramirez@ti.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o18MKb02015441 for ; Mon, 8 Feb 2010 22:20:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751352Ab0BHWUh (ORCPT ); Mon, 8 Feb 2010 17:20:37 -0500 Received: from comal.ext.ti.com ([198.47.26.152]:53130 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750946Ab0BHWUg convert rfc822-to-8bit (ORCPT ); Mon, 8 Feb 2010 17:20:36 -0500 Received: from dlep36.itg.ti.com ([157.170.170.91]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id o18MKVBw008685 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 8 Feb 2010 16:20:32 -0600 Received: from dlep26.itg.ti.com (localhost [127.0.0.1]) by dlep36.itg.ti.com (8.13.8/8.13.8) with ESMTP id o18MKV5O004023; Mon, 8 Feb 2010 16:20:31 -0600 (CST) Received: from dlee75.ent.ti.com (localhost [127.0.0.1]) by dlep26.itg.ti.com (8.13.8/8.13.8) with ESMTP id o18MKV0U002918; Mon, 8 Feb 2010 16:20:31 -0600 (CST) Received: from dlee06.ent.ti.com ([157.170.170.11]) by dlee75.ent.ti.com ([157.170.170.72]) with mapi; Mon, 8 Feb 2010 16:20:31 -0600 From: "Guzman Lugo, Fernando" To: linux-omap CC: Hiroshi Doyu , Ameya Palande , Felipe Contreras Date: Mon, 8 Feb 2010 16:20:32 -0600 Subject: DSPBRIDGE: Reclaim all pending buffer on resource cleanup Thread-Topic: DSPBRIDGE: Reclaim all pending buffer on resource cleanup Thread-Index: AcqpDO1fNF24o3QySQmjqTAYn42ylw== Message-ID: <496565EC904933469F292DDA3F1663E602AA6587BF@dlee06.ent.ti.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 08 Feb 2010 22:20:38 +0000 (UTC) diff --git a/drivers/dsp/bridge/rmgr/drv.c b/drivers/dsp/bridge/rmgr/drv.c index edd8e97..660f375 100644 --- a/drivers/dsp/bridge/rmgr/drv.c +++ b/drivers/dsp/bridge/rmgr/drv.c @@ -458,40 +458,35 @@ static DSP_STATUS DRV_ProcFreeSTRMRes(HANDLE hPCtxt) { struct PROCESS_CONTEXT *pCtxt = (struct PROCESS_CONTEXT *)hPCtxt; DSP_STATUS status = DSP_SOK; - DSP_STATUS status1 = DSP_SOK; u8 **apBuffer = NULL; - struct STRM_RES_OBJECT *pSTRMList = NULL; struct STRM_RES_OBJECT *pSTRMRes = NULL; + struct STRM_INFO strm_info; + struct DSP_STREAMINFO user; 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 * - sizeof(u8 *)), MEM_NONPAGED); + pSTRMRes = pCtxt->pSTRMList; + while (pSTRMRes) { + if (pSTRMRes->uNumBufs) { + apBuffer = MEM_Alloc(pSTRMRes->uNumBufs * + sizeof(u8 *), MEM_NONPAGED); + if (!apBuffer) + return DSP_EMEMORY; status = STRM_FreeBuffer(pSTRMRes->hStream, apBuffer, pSTRMRes->uNumBufs, pCtxt); MEM_Free(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); + strm_info.pUser = &user; + user.uNumberBufsInStream = 0; + STRM_GetInfo(pSTRMRes->hStream, &strm_info, sizeof(strm_info)); + while (strm_info.pUser->uNumberBufsInStream--) + STRM_Reclaim(pSTRMRes->hStream, &pBufPtr, &ulBytes, + (u32 *)&ulBufSize, &dwArg); - } - } } - return status1; + return status; } /* Release all Stream resources and its context