Commit b2366d68d9ec3498b342507facf526c1f66ffa41

Authored by Matthias Kaehlcke
Committed by Greg Kroah-Hartman
1 parent 4f6e1945fe

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>

Showing 1 changed file with 7 additions and 7 deletions Side-by-side Diff

drivers/base/dmapool.c
... ... @@ -37,7 +37,7 @@
37 37  
38 38 #define POOL_TIMEOUT_JIFFIES ((100 /* msec */ * HZ) / 1000)
39 39  
40   -static DECLARE_MUTEX (pools_lock);
  40 +static DEFINE_MUTEX (pools_lock);
41 41  
42 42 static ssize_t
43 43 show_pools (struct device *dev, struct device_attribute *attr, char *buf)
... ... @@ -55,7 +55,7 @@
55 55 size -= temp;
56 56 next += temp;
57 57  
58   - down (&pools_lock);
  58 + mutex_lock(&pools_lock);
59 59 list_for_each_entry(pool, &dev->dma_pools, pools) {
60 60 unsigned pages = 0;
61 61 unsigned blocks = 0;
... ... @@ -73,7 +73,7 @@
73 73 size -= temp;
74 74 next += temp;
75 75 }
76   - up (&pools_lock);
  76 + mutex_unlock(&pools_lock);
77 77  
78 78 return PAGE_SIZE - size;
79 79 }
... ... @@ -143,7 +143,7 @@
143 143 if (dev) {
144 144 int ret;
145 145  
146   - down (&pools_lock);
  146 + mutex_lock(&pools_lock);
147 147 if (list_empty (&dev->dma_pools))
148 148 ret = device_create_file (dev, &dev_attr_pools);
149 149 else
... ... @@ -155,7 +155,7 @@
155 155 kfree(retval);
156 156 retval = NULL;
157 157 }
158   - up (&pools_lock);
  158 + mutex_unlock(&pools_lock);
159 159 } else
160 160 INIT_LIST_HEAD (&retval->pools);
161 161  
162 162  
... ... @@ -231,11 +231,11 @@
231 231 void
232 232 dma_pool_destroy (struct dma_pool *pool)
233 233 {
234   - down (&pools_lock);
  234 + mutex_lock(&pools_lock);
235 235 list_del (&pool->pools);
236 236 if (pool->dev && list_empty (&pool->dev->dma_pools))
237 237 device_remove_file (pool->dev, &dev_attr_pools);
238   - up (&pools_lock);
  238 + mutex_unlock(&pools_lock);
239 239  
240 240 while (!list_empty (&pool->page_list)) {
241 241 struct dma_page *page;