From: Takashi Iwai Subject: RFC - Clean up of ALSA kernel codes Date: Thu, 06 Oct 2005 14:29:46 +0200 Message-ID: Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org Hi, currently I'm working on clean up of ALSA kernel side codes. There have been complaints from kernel developers about the ALSA's own-styles, and I'm trying to reduce them. My plan is like below: 1. Clean up of kmalloc/vmalloc wrappers 1a. Removal of vmalloc wrapper The vmalloc wrapper breaks the alignment of page size, which has many side effects. So let's remove this. 1b. Move kmalloc wrapper to alsa-driver tree Remove kmalloc wrapper from alsa-kernel tree, but put it to alsa-driver tree, so that we can still check the memory leak with own build. *_nocheck() should be removed from alsa-kernel. Since most of kfree_nocheck() is bound with release_resource(), I'll introduce release_and_free_resource() funciton to simplify. 2. Removal of snd_runtime_check() snd_runtime_check() worsens the flow visibility. It should be either a check-only like snd_assert(), or a simple if condition with snd_BUG(). 3. Removal of snd_timestamp_* Use normal functions like getnstimeofday(). 4. Removal of the main memory allocators Introduce alloc_buffer() and free_buffer() callbacks, and let each driver to allocate buffers using dma_alloc_coherent(), etc. This will reduce snd_alloc_*() allocators in memalloc.c. 5. Reprogram SG-buffer handlers Use dma_map_sg() for sg-buffers, so that the non-consistent allocator can be used, e.g. vmalloc_32(). For devices with DMA mask less than 32bit (e.g. trident, emu10k1), a new function may be required to allocate pages in the given DMA mask. 6. Use dma_mmap_coherent() on all architectures Once after dma_mmap_coherent() is implemented on all architectures, we can get rid of nopage stuff. It's more straightforward. (This requires the handling of reserved pages, so wait until the remove-page-reserve patch is accepted.) I already have done up to 3 on my local tree, and ready to commit. 4, 5 and 6 are work in progress. As additional items: 7. Removal of xxx_t styles (use struct xxx, instead) 8. Clean up proc fs handlers They are in lower priorities, so will do if I have enough time left. If you have any objections, comments or suggestions, please let me know. I'd like to start committing from tomorrow or next week. Takashi ------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl