From patchwork Wed Feb 17 00:39:20 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: 79813 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 o1H0dSCA026447 for ; Wed, 17 Feb 2010 00:39:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933789Ab0BQAjZ (ORCPT ); Tue, 16 Feb 2010 19:39:25 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:46983 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933749Ab0BQAjY convert rfc822-to-8bit (ORCPT ); Tue, 16 Feb 2010 19:39:24 -0500 Received: from dlep35.itg.ti.com ([157.170.170.118]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id o1H0dMFl004601 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 16 Feb 2010 18:39:22 -0600 Received: from dlep26.itg.ti.com (localhost [127.0.0.1]) by dlep35.itg.ti.com (8.13.7/8.13.7) with ESMTP id o1H0dL3E003369; Tue, 16 Feb 2010 18:39:21 -0600 (CST) Received: from dsbe71.ent.ti.com (localhost [127.0.0.1]) by dlep26.itg.ti.com (8.13.8/8.13.8) with ESMTP id o1H0dL0Z013349; Tue, 16 Feb 2010 18:39:21 -0600 (CST) Received: from dlee06.ent.ti.com ([157.170.170.11]) by dsbe71.ent.ti.com ([156.117.232.23]) with mapi; Tue, 16 Feb 2010 18:39:21 -0600 From: "Guzman Lugo, Fernando" To: linux-omap CC: Hiroshi Doyu , Ameya Palande , Felipe Contreras , "Ramirez Luna, Omar" Date: Tue, 16 Feb 2010 18:39:20 -0600 Subject: [PATCH 1/2] DSPBRIDGE: cleanup patch for DRV_RemoveAllSTRMResElements function Thread-Topic: [PATCH 1/2] DSPBRIDGE: cleanup patch for DRV_RemoveAllSTRMResElements function Thread-Index: AcqvaaTPYpr2QvyLS8mYleXlXUtFeg== Message-ID: <496565EC904933469F292DDA3F1663E602CA2B9605@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]); Wed, 17 Feb 2010 00:39:28 +0000 (UTC) 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; }