git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
drivers
/
base
/
dmapool.c
diff --git
a/drivers/base/dmapool.c
b/drivers/base/dmapool.c
index
e2f64f9
..
f95d502
100644
(file)
--- a/
drivers/base/dmapool.c
+++ b/
drivers/base/dmapool.c
@@
-7,6
+7,7
@@
#include <linux/dmapool.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/dmapool.h>
#include <linux/slab.h>
#include <linux/module.h>
+#include <linux/poison.h>
/*
* Pool allocator ... wraps the dma_alloc_coherent page allocator, so
/*
* Pool allocator ... wraps the dma_alloc_coherent page allocator, so
@@
-35,8
+36,6
@@
struct dma_page { /* cacheable header for 'allocation' bytes */
};
#define POOL_TIMEOUT_JIFFIES ((100 /* msec */ * HZ) / 1000)
};
#define POOL_TIMEOUT_JIFFIES ((100 /* msec */ * HZ) / 1000)
-#define POOL_POISON_FREED 0xa7 /* !inuse */
-#define POOL_POISON_ALLOCATED 0xa9 /* !initted */
static DECLARE_MUTEX (pools_lock);
static DECLARE_MUTEX (pools_lock);
@@
-127,7
+126,7
@@
dma_pool_create (const char *name, struct device *dev,
} else if (allocation < size)
return NULL;
} else if (allocation < size)
return NULL;
- if (!(retval = kmalloc (sizeof *retval,
SLAB
_KERNEL)))
+ if (!(retval = kmalloc (sizeof *retval,
GFP
_KERNEL)))
return retval;
strlcpy (retval->name, name, sizeof retval->name);
return retval;
strlcpy (retval->name, name, sizeof retval->name);
@@
-142,11
+141,20
@@
dma_pool_create (const char *name, struct device *dev,
init_waitqueue_head (&retval->waitq);
if (dev) {
init_waitqueue_head (&retval->waitq);
if (dev) {
+ int ret;
+
down (&pools_lock);
if (list_empty (&dev->dma_pools))
down (&pools_lock);
if (list_empty (&dev->dma_pools))
- device_create_file (dev, &dev_attr_pools);
+ ret = device_create_file (dev, &dev_attr_pools);
+ else
+ ret = 0;
/* note: not currently insisting "name" be unique */
/* note: not currently insisting "name" be unique */
- list_add (&retval->pools, &dev->dma_pools);
+ if (!ret)
+ list_add (&retval->pools, &dev->dma_pools);
+ else {
+ kfree(retval);
+ retval = NULL;
+ }
up (&pools_lock);
} else
INIT_LIST_HEAD (&retval->pools);
up (&pools_lock);
} else
INIT_LIST_HEAD (&retval->pools);
@@
-165,7
+173,7
@@
pool_alloc_page (struct dma_pool *pool, gfp_t mem_flags)
mapsize = (mapsize + BITS_PER_LONG - 1) / BITS_PER_LONG;
mapsize *= sizeof (long);
mapsize = (mapsize + BITS_PER_LONG - 1) / BITS_PER_LONG;
mapsize *= sizeof (long);
- page =
(struct dma_page *) kmalloc
(mapsize + sizeof *page, mem_flags);
+ page =
kmalloc
(mapsize + sizeof *page, mem_flags);
if (!page)
return NULL;
page->vaddr = dma_alloc_coherent (pool->dev,
if (!page)
return NULL;
page->vaddr = dma_alloc_coherent (pool->dev,
@@
-289,7
+297,7
@@
restart:
}
}
}
}
}
}
- if (!(page = pool_alloc_page (pool,
SLAB
_ATOMIC))) {
+ if (!(page = pool_alloc_page (pool,
GFP
_ATOMIC))) {
if (mem_flags & __GFP_WAIT) {
DECLARE_WAITQUEUE (wait, current);
if (mem_flags & __GFP_WAIT) {
DECLARE_WAITQUEUE (wait, current);