Commit 6182a094 authored by Matthew Wilcox's avatar Matthew Wilcox

dmapool: Tidy up includes and add comments

We were missing a copyright statement and license, so add GPLv2, David
Brownell's copyright and my copyright.

The asm/io.h include was superfluous, but we were missing a few other
necessary includes.
Signed-off-by: default avatarMatthew Wilcox <willy@linux.intel.com>
parent 399154be
/*
* DMA Pool allocator
*
* Copyright 2001 David Brownell
* Copyright 2007 Intel Corporation
* Author: Matthew Wilcox <willy@linux.intel.com>
*
* 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 <linux/device.h> #include <linux/device.h>
#include <linux/mm.h>
#include <asm/io.h> /* Needed for i386 to build */
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/dmapool.h> #include <linux/dmapool.h>
#include <linux/slab.h> #include <linux/kernel.h>
#include <linux/list.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/mutex.h>
#include <linux/poison.h> #include <linux/poison.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/slab.h>
/* #include <linux/spinlock.h>
* Pool allocator ... wraps the dma_alloc_coherent page allocator, so #include <linux/string.h>
* small blocks are easily used by drivers for bus mastering controllers. #include <linux/types.h>
* This should probably be sharing the guts of the slab allocator. #include <linux/wait.h>
*/
struct dma_pool { /* the pool */ struct dma_pool { /* the pool */
struct list_head page_list; struct list_head page_list;
...@@ -265,7 +285,7 @@ EXPORT_SYMBOL(dma_pool_destroy); ...@@ -265,7 +285,7 @@ EXPORT_SYMBOL(dma_pool_destroy);
* *
* This returns the kernel virtual address of a currently unused block, * This returns the kernel virtual address of a currently unused block,
* and reports its dma address through the handle. * 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, void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags,
dma_addr_t *handle) dma_addr_t *handle)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment