From 6254e7a4d70f06a2cd707427423bdeff96a5552b Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Mon, 3 Dec 2007 12:16:57 -0500 Subject: [PATCH] --- yaml --- r: 83335 b: refs/heads/master c: 6182a0943af2235756836ed7e021fa22b93ec68b h: refs/heads/master i: 83333: 6235ac7b1cc4eca809d1f2297d4d70d3ddcf0f23 83331: f76c5042a397547288a952677a3e727ecca109bd 83327: e1a0a8d7d62a69bc7e18c9a05881f9058cfdd33d v: v3 --- [refs] | 2 +- trunk/mm/dmapool.c | 40 ++++++++++++++++++++++++++++++---------- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/[refs] b/[refs] index ff761d1b31a4..113925bb8882 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 399154be2dcb6a58dbde9682162c38113cf3e40b +refs/heads/master: 6182a0943af2235756836ed7e021fa22b93ec68b diff --git a/trunk/mm/dmapool.c b/trunk/mm/dmapool.c index 744d541df866..e2ea4543abb4 100644 --- a/trunk/mm/dmapool.c +++ b/trunk/mm/dmapool.c @@ -1,19 +1,39 @@ +/* + * DMA Pool allocator + * + * Copyright 2001 David Brownell + * Copyright 2007 Intel Corporation + * Author: Matthew Wilcox + * + * This software may be redistributed and/or modified under the terms of + * the GNU General Public License ("GPL") version 2 as published by the + * Free Software Foundation. + * + * This allocator returns small blocks of a given size which are DMA-able by + * the given device. It uses the dma_alloc_coherent page allocator to get + * new pages, then splits them up into blocks of the required size. + * Many older drivers still have their own code to do this. + * + * The current design of this allocator is fairly simple. The pool is + * represented by the 'struct dma_pool' which keeps a doubly-linked list of + * allocated pages. Each page in the page_list is split into blocks of at + * least 'size' bytes. + */ #include -#include -#include /* Needed for i386 to build */ #include #include -#include +#include +#include #include +#include #include #include - -/* - * Pool allocator ... wraps the dma_alloc_coherent page allocator, so - * small blocks are easily used by drivers for bus mastering controllers. - * This should probably be sharing the guts of the slab allocator. - */ +#include +#include +#include +#include +#include struct dma_pool { /* the pool */ struct list_head page_list; @@ -265,7 +285,7 @@ EXPORT_SYMBOL(dma_pool_destroy); * * This returns the kernel virtual address of a currently unused block, * and reports its dma address through the handle. - * If such a memory block can't be allocated, null is returned. + * If such a memory block can't be allocated, %NULL is returned. */ void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags, dma_addr_t *handle)