X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fbase%2Fdmapool.c;h=7647abfe189081dcec38eace34025899dd531a99;hb=93b3238ef8b04f1383b2aa7704487fb3c0e44193;hp=cd467c9f33b35e760e20759284bf35d0839e94f2;hpb=5a84d159061d914c8dd4aa372ac6e9529c2be453;p=linux-2.6-omap-h63xx.git diff --git a/drivers/base/dmapool.c b/drivers/base/dmapool.c index cd467c9f33b..7647abfe189 100644 --- a/drivers/base/dmapool.c +++ b/drivers/base/dmapool.c @@ -8,6 +8,7 @@ #include #include #include +#include /* * Pool allocator ... wraps the dma_alloc_coherent page allocator, so @@ -37,7 +38,7 @@ struct dma_page { /* cacheable header for 'allocation' bytes */ #define POOL_TIMEOUT_JIFFIES ((100 /* msec */ * HZ) / 1000) -static DECLARE_MUTEX (pools_lock); +static DEFINE_MUTEX (pools_lock); static ssize_t show_pools (struct device *dev, struct device_attribute *attr, char *buf) @@ -55,7 +56,7 @@ show_pools (struct device *dev, struct device_attribute *attr, char *buf) size -= temp; next += temp; - down (&pools_lock); + mutex_lock(&pools_lock); list_for_each_entry(pool, &dev->dma_pools, pools) { unsigned pages = 0; unsigned blocks = 0; @@ -73,7 +74,7 @@ show_pools (struct device *dev, struct device_attribute *attr, char *buf) size -= temp; next += temp; } - up (&pools_lock); + mutex_unlock(&pools_lock); return PAGE_SIZE - size; } @@ -126,7 +127,7 @@ dma_pool_create (const char *name, struct device *dev, } else if (allocation < size) return NULL; - if (!(retval = kmalloc (sizeof *retval, GFP_KERNEL))) + if (!(retval = kmalloc_node (sizeof *retval, GFP_KERNEL, dev_to_node(dev)))) return retval; strlcpy (retval->name, name, sizeof retval->name); @@ -143,7 +144,7 @@ dma_pool_create (const char *name, struct device *dev, if (dev) { int ret; - down (&pools_lock); + mutex_lock(&pools_lock); if (list_empty (&dev->dma_pools)) ret = device_create_file (dev, &dev_attr_pools); else @@ -155,7 +156,7 @@ dma_pool_create (const char *name, struct device *dev, kfree(retval); retval = NULL; } - up (&pools_lock); + mutex_unlock(&pools_lock); } else INIT_LIST_HEAD (&retval->pools); @@ -231,11 +232,11 @@ pool_free_page (struct dma_pool *pool, struct dma_page *page) void dma_pool_destroy (struct dma_pool *pool) { - down (&pools_lock); + mutex_lock(&pools_lock); list_del (&pool->pools); if (pool->dev && list_empty (&pool->dev->dma_pools)) device_remove_file (pool->dev, &dev_attr_pools); - up (&pools_lock); + mutex_unlock(&pools_lock); while (!list_empty (&pool->page_list)) { struct dma_page *page;