From: Omar Ramirez Luna <[EMAIL PROTECTED]>
Date: Thu, 27 Nov 2008 02:40:50 -0600
Subject: [PATCH] DSPBRIDGE: Freeing allocated resources on rmmod
This patch implements the cleanup of allocated resources
whenever the module is removed from the kernel.
Signed-off-by: Omar Ramirez Luna <[EMAIL PROTECTED]>
---
drivers/dsp/bridge/rmgr/drv_interface.c | 40 +++++++++++++++++++++++++++++++
1 files changed, 40 insertions(+), 0 deletions(-)
mode change 100644 => 100755 drivers/dsp/bridge/rmgr/drv_interface.c
diff --git a/drivers/dsp/bridge/rmgr/drv_interface.c
b/drivers/dsp/bridge/rmgr/drv_interface.c
old mode 100644
new mode 100755
index 7e81f6f..b7a999f
--- a/drivers/dsp/bridge/rmgr/drv_interface.c
+++ b/drivers/dsp/bridge/rmgr/drv_interface.c
@@ -496,8 +496,48 @@ static void __exit bridge_exit(void)
{
dev_t devno;
bool ret;
+ DSP_STATUS dsp_status = DSP_SOK;
+ HANDLE hDrvObject = NULL;
+ struct PROCESS_CONTEXT *pTmp = NULL;
+ struct PROCESS_CONTEXT *pCtxtclosed = NULL;
+ struct PROCESS_CONTEXT *pCtxttraverse = NULL;
+
GT_0trace(driverTrace, GT_ENTER, "-> driver_exit\n");
+ dsp_status = CFG_GetObject((u32 *)&hDrvObject, REG_DRV_OBJECT);
+ DRV_GetProcCtxtList(&pCtxtclosed, (struct DRV_OBJECT *)hDrvObject);
+ while (pCtxtclosed != NULL) {
+ DRV_RemoveAllResources(pCtxtclosed);
+ if (pCtxtclosed->hProcessor != NULL) {
+ DRV_GetProcCtxtList(&pCtxttraverse,
+ (struct DRV_OBJECT *)hDrvObject);
+ if (pCtxttraverse->next == NULL) {
+ PROC_Detach(pCtxtclosed->hProcessor);
+ goto func_cont;
+ }
+ if ((pCtxtclosed->pid == pCtxttraverse->pid) &&
+ (pCtxttraverse->next != NULL)) {
+ pCtxttraverse = pCtxttraverse->next;
+ }
+ while ((pCtxttraverse != NULL) &&
+ (pCtxtclosed->hProcessor
+ != pCtxttraverse->hProcessor)) {
+ pCtxttraverse = pCtxttraverse->next;
+ if ((pCtxttraverse != NULL) &&
+ (pCtxtclosed->pid == pCtxttraverse->pid)) {
+ pCtxttraverse = pCtxttraverse->next;
+ }
+ }
+ if (pCtxttraverse == NULL)
+ PROC_Detach(pCtxtclosed->hProcessor);
+ }
+func_cont:
+ pTmp = pCtxtclosed->next;
+ DRV_RemoveProcContext((struct DRV_OBJECT *)hDrvObject,
+ pCtxtclosed, (void *)pCtxtclosed->pid);
+ pCtxtclosed = pTmp;
+ }
+
/* unregister the clock notifier */
#ifdef CONFIG_BRIDGE_DVFS
if (!clk_notifier_unregister(clk_handle, &iva_clk_notifier)) {
--
1.6.0
--
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