[OMAPZOOM] [PATCH 2/6] DSPBRIDGE: Freeing allocated resources on rmmod

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Omar Ramirez Luna <x00omar@xxxxxx>
Date: Wed, 28 Jan 2009 19:00:22 -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 <x00omar@xxxxxx>
---
 drivers/dsp/bridge/rmgr/drv_interface.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/drv_interface.c b/drivers/dsp/bridge/rmgr/drv_interface.c
index 126f5de..a756997 100644
--- a/drivers/dsp/bridge/rmgr/drv_interface.c
+++ b/drivers/dsp/bridge/rmgr/drv_interface.c
@@ -534,8 +534,28 @@ static void __exit bridge_exit(void)
 {
 	dev_t devno;
 	bool ret;
+	DSP_STATUS dsp_status = DSP_SOK;
+	HANDLE hDrvObject = NULL;
+	struct PROCESS_CONTEXT    *pCtxtclosed = NULL;
+
 	GT_0trace(driverTrace, GT_ENTER, "-> driver_exit\n");
 
+
+	dsp_status = CFG_GetObject((u32 *)&hDrvObject, REG_DRV_OBJECT);
+	if (DSP_FAILED(dsp_status))
+		goto func_cont;
+
+	DRV_GetProcCtxtList(&pCtxtclosed, (struct DRV_OBJECT *)hDrvObject);
+	while (pCtxtclosed != NULL) {
+		GT_1trace(driverTrace, GT_5CLASS, "***Cleanup of "
+			 "process***%d\n", pCtxtclosed->pid);
+		DRV_RemoveAllResources(pCtxtclosed);
+		PROC_Detach(pCtxtclosed->hProcessor);
+		DRV_RemoveProcContext((struct DRV_OBJECT *)hDrvObject,
+				     pCtxtclosed, (void *)pCtxtclosed->pid);
+		pCtxtclosed = pCtxtclosed->next;;
+	}
+func_cont:
 #ifndef CONFIG_DISABLE_BRIDGE_PM
 #ifndef CONFIG_DISABLE_BRIDGE_DVFS
 	/* remove the constraints */
-- 
1.5.4.3

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

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux