/* * ======== WCD_Exit ======== */ void WCD_Exit(void) { DBC_Require(WCD_cRefs > 0); WCD_cRefs--; GT_1trace(WCD_debugMask, GT_5CLASS, "Entered WCD_Exit, ref count: 0x%x\n", WCD_cRefs); if (WCD_cRefs == 0) { /* Release all WCD modules initialized in WCD_Init(). */ COD_Exit(); DEV_Exit(); CHNL_Exit(); MSG_Exit(); IO_Exit(); STRM_Exit(); NTFY_Exit(); DISP_Exit(); NODE_Exit(); PROC_Exit(); MGR_Exit(); RMM_exit(); DRV_Exit(); SERVICES_Exit(); } DBC_Ensure(WCD_cRefs >= 0); }
static int __devexit omap34xx_bridge_remove(struct platform_device *pdev) { dev_t devno; bool ret; DSP_STATUS dsp_status = DSP_SOK; HANDLE hDrvObject = NULL; dsp_status = CFG_GetObject((u32 *)&hDrvObject, REG_DRV_OBJECT); if (DSP_FAILED(dsp_status)) goto func_cont; #ifdef CONFIG_BRIDGE_DVFS if (clk_notifier_unregister(clk_handle, &iva_clk_notifier)) pr_err("%s: clk_notifier_unregister failed for iva2_ck\n", __func__); #endif /* #ifdef CONFIG_BRIDGE_DVFS */ if (driverContext) { /* Put the DSP in reset state */ ret = DSP_Deinit(driverContext); driverContext = 0; DBC_Assert(ret == true); } #ifdef CONFIG_BRIDGE_DVFS clk_put(clk_handle); clk_handle = NULL; #endif func_cont: #ifdef CONFIG_PM /* The suspend wait queue should not have anything waiting on it since remove won't be called while the file is open */ DBC_Assert(!waitqueue_active(&bridge_suspend_data.suspend_wq)); #endif MEM_ExtPhysPoolRelease(); SERVICES_Exit(); GT_exit(); /* Remove driver sysfs entries */ bridge_destroy_sysfs(); devno = MKDEV(driver_major, 0); cdev_del(&bridge_cdev); unregister_chrdev_region(devno, 1); if (bridge_class) { /* remove the device from sysfs */ device_destroy(bridge_class, MKDEV(driver_major, 0)); class_destroy(bridge_class); } return 0; }
/* * ======== WCD_Init ======== * Purpose: * Module initialization is done by SERVICES Init. */ bool WCD_Init(void) { bool fInit = true; bool fDRV, fDEV, fCOD, fSERVICES, fCHNL, fMSG, fIO; bool fMGR, fPROC, fNODE, fDISP, fNTFY, fSTRM, fRMM; #ifdef DEBUG /* runtime check of Device IOCtl array. */ u32 i; int cmdtable = ARRAY_SIZE(WCD_cmdTable); for (i = 1; i < cmdtable; i++) DBC_Assert(WCD_cmdTable[i - 1].dwIndex == i); #endif if (WCD_cRefs == 0) { /* initialize all SERVICES modules */ fSERVICES = SERVICES_Init(); /* initialize debugging module */ DBC_Assert(!WCD_debugMask.flags); GT_create(&WCD_debugMask, "CD"); /* CD for class driver */ /* initialize class driver and other modules */ fDRV = DRV_Init(); fMGR = MGR_Init(); fPROC = PROC_Init(); fNODE = NODE_Init(); fDISP = DISP_Init(); fNTFY = NTFY_Init(); fSTRM = STRM_Init(); fRMM = RMM_init(); fCHNL = CHNL_Init(); fMSG = MSG_Init(); fIO = IO_Init(); fDEV = DEV_Init(); fCOD = COD_Init(); fInit = fSERVICES && fDRV && fDEV && fCHNL && fCOD && fMSG && fIO; fInit = fInit && fMGR && fPROC && fRMM; if (!fInit) { if (fSERVICES) SERVICES_Exit(); if (fDRV) DRV_Exit(); if (fMGR) MGR_Exit(); if (fSTRM) STRM_Exit(); if (fPROC) PROC_Exit(); if (fNODE) NODE_Exit(); if (fDISP) DISP_Exit(); if (fNTFY) NTFY_Exit(); if (fCHNL) CHNL_Exit(); if (fMSG) MSG_Exit(); if (fIO) IO_Exit(); if (fDEV) DEV_Exit(); if (fCOD) COD_Exit(); if (fRMM) RMM_exit(); } } if (fInit) WCD_cRefs++; GT_1trace(WCD_debugMask, GT_5CLASS, "Entered WCD_Init, ref count: 0x%x\n", WCD_cRefs); return fInit; }