From: Fernando Guzman Lugo <[email protected]>
Date: Wed, 28 Jan 2009 19:29:25 -0600
Subject: [PATCH] DSPBRIDGE: Fixed race condition with DBLL target list

Fixed race condition with DBLL target list

Signed-off-by: Fernando Guzman Lugo <[email protected]>
---
 drivers/dsp/bridge/rmgr/node.c |   24 +++++++++++-------------
 1 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/node.c b/drivers/dsp/bridge/rmgr/node.c
index 31d8de9..3242325 100644
--- a/drivers/dsp/bridge/rmgr/node.c
+++ b/drivers/dsp/bridge/rmgr/node.c
@@ -234,7 +234,6 @@ struct NODE_MGR {
        struct GB_TMap *zChnlMap;       /* Zero-Copy Channel alloc bit map */
        struct NTFY_OBJECT *hNtfy;      /* Manages registered notifications */
        struct SYNC_CSOBJECT *hSync;    /* For critical sections */
-       struct SYNC_CSOBJECT *hAllocSync; /* For NODE_Alloc critical sections */
        u32 ulFxnAddrs[NUMRMSFXNS];     /* RMS function addresses */
        struct MSG_MGR *hMsg;
 
@@ -485,7 +484,7 @@ func_cont:
        }
        pNode->hNodeMgr = hNodeMgr;
        /* This critical section protects GetNodeProps */
-       status = SYNC_EnterCS(hNodeMgr->hAllocSync);
+       status = SYNC_EnterCS(hNodeMgr->hSync);
        if (procId != DSP_UNIT)
                goto func_cont3;
 
@@ -565,7 +564,7 @@ func_cont:
        }
 
 func_cont3:
-       (void)SYNC_LeaveCS(hNodeMgr->hAllocSync);
+       (void)SYNC_LeaveCS(hNodeMgr->hSync);
 func_cont1:
        if (pAttrIn != NULL) {
                /* Overrides of NBD properties */
@@ -1586,13 +1585,6 @@ DSP_STATUS NODE_CreateMgr(OUT struct NODE_MGR 
**phNodeMgr,
                status = SYNC_InitializeCS(&pNodeMgr->hSync);
                if (DSP_FAILED(status))
                        status = DSP_EMEMORY;
-
-               if (DSP_SUCCEEDED(status)) {
-                       status = SYNC_InitializeCS(&pNodeMgr->hAllocSync);
-                       if (DSP_FAILED(status))
-                               status = DSP_EMEMORY;
-
-               }
        }
        if (DSP_SUCCEEDED(status)) {
                pNodeMgr->chnlMap = GB_create(pNodeMgr->ulNumChnls);
@@ -2982,9 +2974,6 @@ static void DeleteNodeMgr(struct NODE_MGR *hNodeMgr)
                if (hNodeMgr->hSync)
                        SYNC_DeleteCS(hNodeMgr->hSync);
 
-               if (hNodeMgr->hSync)
-                       SYNC_DeleteCS(hNodeMgr->hAllocSync);
-
                if (hNodeMgr->hStrmMgr)
                        STRM_Delete(hNodeMgr->hStrmMgr);
 
@@ -3342,6 +3331,12 @@ DSP_STATUS NODE_GetUUIDProps(DSP_HPROCESSOR hProcessor,
                        status = DSP_EFAIL;
        }
 
+       /*  Enter the critical section.  This is needed because
+       * DCD_GetObjectDef will ultimately end up calling DBLL_open/close,
+       * which needs to be protected in order to not corrupt the zlib manager
+       * (COD). */
+       status = SYNC_EnterCS(hNodeMgr->hSync);
+
        if (DSP_SUCCEEDED(status)) {
                dcdNodeProps.pstrCreatePhaseFxn = NULL;
                dcdNodeProps.pstrExecutePhaseFxn = NULL;
@@ -3366,6 +3361,9 @@ DSP_STATUS NODE_GetUUIDProps(DSP_HPROCESSOR hProcessor,
                        if (dcdNodeProps.pstrIAlgName)
                                MEM_Free(dcdNodeProps.pstrIAlgName);
                }
+               /*  Leave the critical section, we're done.  */
+               (void)SYNC_LeaveCS(hNodeMgr->hSync);
+
        }
 
        return status;
-- 
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to