void dma_cleanup (void) { int i; unregister_chrdev (DMA_MAJOR, "dma-core"); //pliu: 2007021201 #ifdef TWEAK_DMA_BUFFER_RING_SIZE if ( g_desc_list_backup ) kfree(g_desc_list_backup); for (i = 0; i < MAX_DMA_CHANNEL_NUM; i++){ if (dma_chan[i].opt){ kfree(dma_chan[i].opt); dma_chan[i].opt = (void *) NULL; } } #else // free_page (KSEG0ADDR ((unsigned long) g_desc_list)); if ( g_desc_list_backup ) kfree(g_desc_list_backup); #endif remove_proc_entry ("channel_weight", g_danube_dma_dir); remove_proc_entry ("dma_list", g_danube_dma_dir); remove_proc_entry ("dma_register", g_danube_dma_dir); remove_proc_entry ("danube_dma", NULL); /*release the resources */ for (i = 0; i < MAX_DMA_CHANNEL_NUM; i++) free_irq (dma_chan[i].irq, (void *) &dma_interrupt); proc_file_delete(); }
static void __exit ifx_rcu_exit(void) { ifx_rcu_handler_t *p_cur, *p_free; int i; proc_file_delete(); #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32) if ( unregister_chrdev(IFX_RCU_MAJOR, "ifx_rcu") ) { err("Can not register RCU device (major %d)!", IFX_RCU_MAJOR); return; } #else unregister_chrdev(IFX_RCU_MAJOR, "ifx_rcu"); #endif for ( i = 0; i < NUM_ENTITY(g_rcu_domains); i++ ) { for ( p_free = p_cur = g_rcu_domains[i].handlers; p_cur != NULL; p_free = p_cur) { p_cur = p_cur->next; kfree(p_free); } } }