aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias.kaehlcke@gmail.com>2007-04-24 16:45:25 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-04-27 13:57:32 -0400
commitb2366d68d9ec3498b342507facf526c1f66ffa41 (patch)
tree5435ab9f6b328d2e04250274618f775ee58172d8 /drivers/base
parent4f6e1945fecad6ac8134e9fa68b7708e55690e9e (diff)
Driver core: use mutex instead of semaphore in DMA pool handler
the DMA pool handler uses a semaphore as mutex. use the mutex API instead of the (binary) semaphore Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/dmapool.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/base/dmapool.c b/drivers/base/dmapool.c
index cd467c9f33b3..9406259754ad 100644
--- a/drivers/base/dmapool.c
+++ b/drivers/base/dmapool.c
@@ -37,7 +37,7 @@ struct dma_page { /* cacheable header for 'allocation' bytes */
37 37
38#define POOL_TIMEOUT_JIFFIES ((100 /* msec */ * HZ) / 1000) 38#define POOL_TIMEOUT_JIFFIES ((100 /* msec */ * HZ) / 1000)
39 39
40static DECLARE_MUTEX (pools_lock); 40static DEFINE_MUTEX (pools_lock);
41 41
42static ssize_t 42static ssize_t
43show_pools (struct device *dev, struct device_attribute *attr, char *buf) 43show_pools (struct device *dev, struct device_attribute *attr, char *buf)
@@ -55,7 +55,7 @@ show_pools (struct device *dev, struct device_attribute *attr, char *buf)
55 size -= temp; 55 size -= temp;
56 next += temp; 56 next += temp;
57 57
58 down (&pools_lock); 58 mutex_lock(&pools_lock);
59 list_for_each_entry(pool, &dev->dma_pools, pools) { 59 list_for_each_entry(pool, &dev->dma_pools, pools) {
60 unsigned pages = 0; 60 unsigned pages = 0;
61 unsigned blocks = 0; 61 unsigned blocks = 0;
@@ -73,7 +73,7 @@ show_pools (struct device *dev, struct device_attribute *attr, char *buf)
73 size -= temp; 73 size -= temp;
74 next += temp; 74 next += temp;
75 } 75 }
76 up (&pools_lock); 76 mutex_unlock(&pools_lock);
77 77
78 return PAGE_SIZE - size; 78 return PAGE_SIZE - size;
79} 79}
@@ -143,7 +143,7 @@ dma_pool_create (const char *name, struct device *dev,
143 if (dev) { 143 if (dev) {
144 int ret; 144 int ret;
145 145
146 down (&pools_lock); 146 mutex_lock(&pools_lock);
147 if (list_empty (&dev->dma_pools)) 147 if (list_empty (&dev->dma_pools))
148 ret = device_create_file (dev, &dev_attr_pools); 148 ret = device_create_file (dev, &dev_attr_pools);
149 else 149 else
@@ -155,7 +155,7 @@ dma_pool_create (const char *name, struct device *dev,
155 kfree(retval); 155 kfree(retval);
156 retval = NULL; 156 retval = NULL;
157 } 157 }
158 up (&pools_lock); 158 mutex_unlock(&pools_lock);
159 } else 159 } else
160 INIT_LIST_HEAD (&retval->pools); 160 INIT_LIST_HEAD (&retval->pools);
161 161
@@ -231,11 +231,11 @@ pool_free_page (struct dma_pool *pool, struct dma_page *page)
231void 231void
232dma_pool_destroy (struct dma_pool *pool) 232dma_pool_destroy (struct dma_pool *pool)
233{ 233{
234 down (&pools_lock); 234 mutex_lock(&pools_lock);
235 list_del (&pool->pools); 235 list_del (&pool->pools);
236 if (pool->dev && list_empty (&pool->dev->dma_pools)) 236 if (pool->dev && list_empty (&pool->dev->dma_pools))
237 device_remove_file (pool->dev, &dev_attr_pools); 237 device_remove_file (pool->dev, &dev_attr_pools);
238 up (&pools_lock); 238 mutex_unlock(&pools_lock);
239 239
240 while (!list_empty (&pool->page_list)) { 240 while (!list_empty (&pool->page_list)) {
241 struct dma_page *page; 241 struct dma_page *page;