Hi,

        Acked-by: Fernando Guzman Lugo <[email protected]>

-----Original Message-----
From: Ameya Palande [mailto:[email protected]] 
Sent: Monday, August 10, 2009 8:22 PM
To: [email protected]
Cc: [email protected]; Ramirez Luna, Omar; Guzman Lugo, Fernando; Moogi, 
Suyog; [email protected]; Ramos Falcon, Ernesto
Subject: [PATCH 05/13] DSPBRIDGE: Use pr_ctxt in PROC_Attach

Signed-off-by: Ameya Palande <[email protected]>
---
 arch/arm/plat-omap/include/dspbridge/proc.h |    3 +-
 drivers/dsp/bridge/pmgr/wcd.c               |    2 +-
 drivers/dsp/bridge/rmgr/proc.c              |   51 +++++---------------------
 3 files changed, 13 insertions(+), 43 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/proc.h 
b/arch/arm/plat-omap/include/dspbridge/proc.h
index 832b518..1737761 100644
--- a/arch/arm/plat-omap/include/dspbridge/proc.h
+++ b/arch/arm/plat-omap/include/dspbridge/proc.h
@@ -95,7 +95,8 @@
        extern DSP_STATUS PROC_Attach(u32 uProcessor,
                                      OPTIONAL CONST struct DSP_PROCESSORATTRIN
                                      *pAttrIn,
-                                     OUT DSP_HPROCESSOR *phProcessor);
+                                     OUT DSP_HPROCESSOR *phProcessor,
+                                     struct PROCESS_CONTEXT *pr_ctxt);
 
 /*
  *  ======== PROC_AutoStart =========
diff --git a/drivers/dsp/bridge/pmgr/wcd.c b/drivers/dsp/bridge/pmgr/wcd.c
index a574278..ddb2aea 100644
--- a/drivers/dsp/bridge/pmgr/wcd.c
+++ b/drivers/dsp/bridge/pmgr/wcd.c
@@ -681,7 +681,7 @@ u32 PROCWRAP_Attach(union Trapped_Args *args, void *pr_ctxt)
 
        }
        status = PROC_Attach(args->ARGS_PROC_ATTACH.uProcessor, pAttrIn,
-                           &processor);
+                           &processor, pr_ctxt);
        cp_to_usr(args->ARGS_PROC_ATTACH.phProcessor, &processor, status, 1);
 func_end:
        return status;
diff --git a/drivers/dsp/bridge/rmgr/proc.c b/drivers/dsp/bridge/rmgr/proc.c
index 4ab4a88..c475436 100644
--- a/drivers/dsp/bridge/rmgr/proc.c
+++ b/drivers/dsp/bridge/rmgr/proc.c
@@ -237,7 +237,7 @@ func_end:
  */
 DSP_STATUS
 PROC_Attach(u32 uProcessor, OPTIONAL CONST struct DSP_PROCESSORATTRIN *pAttrIn,
-       OUT DSP_HPROCESSOR *phProcessor)
+       OUT DSP_HPROCESSOR *phProcessor, struct PROCESS_CONTEXT *pr_ctxt)
 {
        DSP_STATUS status = DSP_SOK;
        struct DEV_OBJECT *hDevObject;
@@ -246,19 +246,19 @@ PROC_Attach(u32 uProcessor, OPTIONAL CONST struct 
DSP_PROCESSORATTRIN *pAttrIn,
        struct DRV_OBJECT *hDrvObject = NULL;
        u32 devType;
 
-#ifndef RES_CLEANUP_DISABLE
-       HANDLE       hDRVObject;
-       u32                  hProcess;
-       DSP_STATUS res_status = DSP_SOK;
-       struct PROCESS_CONTEXT   *pPctxt = NULL;
-#endif
-
        DBC_Require(cRefs > 0);
        DBC_Require(phProcessor != NULL);
 
        GT_3trace(PROC_DebugMask, GT_ENTER, "Entered PROC_Attach, args:\n\t"
                 "uProcessor:  0x%x\n\tpAttrIn:  0x%x\n\tphProcessor:"
                 "0x%x\n", uProcessor, pAttrIn, phProcessor);
+
+       if (pr_ctxt->hProcessor) {
+               pr_err("DSP: PROC_Attach() on same file handle is "
+                               "not supported!\n");
+               goto func_end;
+       }
+
        /* Get the Driver and Manager Object Handles */
        status = CFG_GetObject((u32 *)&hDrvObject, REG_DRV_OBJECT);
        if (DSP_SUCCEEDED(status)) {
@@ -380,41 +380,10 @@ PROC_Attach(u32 uProcessor, OPTIONAL CONST struct 
DSP_PROCESSORATTRIN *pAttrIn,
                         "storage for notification \n");
                MEM_FreeObject(pProcObject);
        }
-func_end:
 #ifndef RES_CLEANUP_DISABLE
-       if (DSP_FAILED(status))
-               goto func_cont;
-
-       /* Return TGID instead of process handle */
-       hProcess = current->tgid;
-
-       res_status = CFG_GetObject((u32 *)&hDRVObject, REG_DRV_OBJECT);
-       if (DSP_FAILED(res_status))
-               goto func_cont;
-
-       DRV_GetProcContext(hProcess, (struct DRV_OBJECT *)hDRVObject,
-                        &pPctxt, NULL, 0);
-       if (pPctxt == NULL) {
-               DRV_InsertProcContext((struct DRV_OBJECT *)hDRVObject, &pPctxt);
-               if (pPctxt != NULL) {
-                       DRV_ProcUpdatestate(pPctxt, PROC_RES_ALLOCATED);
-                       DRV_ProcSetPID(pPctxt, hProcess);
-               }
-       }
-func_cont:
-       /* Return TGID instead of process handle */
-       hProcess = current->tgid;
-
-       res_status = CFG_GetObject((u32 *)&hDRVObject, REG_DRV_OBJECT);
-       if (DSP_SUCCEEDED(res_status)) {
-                       DRV_GetProcContext(hProcess,
-                                (struct DRV_OBJECT *)hDRVObject, &pPctxt,
-                                NULL, 0);
-               if (pPctxt != NULL)
-                       pPctxt->hProcessor = (DSP_HPROCESSOR)*phProcessor;
-
-       }
+       pr_ctxt->hProcessor = pProcObject;
 #endif
+func_end:
        DBC_Ensure((status == DSP_EFAIL && *phProcessor == NULL) ||
                  (DSP_SUCCEEDED(status) &&
                  MEM_IsValidHandle(pProcObject, PROC_SIGNATURE)) ||
-- 
1.6.2.4


--
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