aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/dmapool.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/mm/dmapool.c b/mm/dmapool.c
index 92e886d37e90..b5ff9ce8765b 100644
--- a/mm/dmapool.c
+++ b/mm/dmapool.c
@@ -275,8 +275,8 @@ void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags,
275 size_t offset; 275 size_t offset;
276 void *retval; 276 void *retval;
277 277
278 restart:
279 spin_lock_irqsave(&pool->lock, flags); 278 spin_lock_irqsave(&pool->lock, flags);
279 restart:
280 list_for_each_entry(page, &pool->page_list, page_list) { 280 list_for_each_entry(page, &pool->page_list, page_list) {
281 int i; 281 int i;
282 /* only cachable accesses here ... */ 282 /* only cachable accesses here ... */
@@ -299,12 +299,13 @@ void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags,
299 DECLARE_WAITQUEUE(wait, current); 299 DECLARE_WAITQUEUE(wait, current);
300 300
301 __set_current_state(TASK_INTERRUPTIBLE); 301 __set_current_state(TASK_INTERRUPTIBLE);
302 add_wait_queue(&pool->waitq, &wait); 302 __add_wait_queue(&pool->waitq, &wait);
303 spin_unlock_irqrestore(&pool->lock, flags); 303 spin_unlock_irqrestore(&pool->lock, flags);
304 304
305 schedule_timeout(POOL_TIMEOUT_JIFFIES); 305 schedule_timeout(POOL_TIMEOUT_JIFFIES);
306 306
307 remove_wait_queue(&pool->waitq, &wait); 307 spin_lock_irqsave(&pool->lock, flags);
308 __remove_wait_queue(&pool->waitq, &wait);
308 goto restart; 309 goto restart;
309 } 310 }
310 retval = NULL; 311 retval = NULL;
@@ -406,7 +407,7 @@ void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t dma)
406 page->in_use--; 407 page->in_use--;
407 set_bit(block, &page->bitmap[map]); 408 set_bit(block, &page->bitmap[map]);
408 if (waitqueue_active(&pool->waitq)) 409 if (waitqueue_active(&pool->waitq))
409 wake_up(&pool->waitq); 410 wake_up_locked(&pool->waitq);
410 /* 411 /*
411 * Resist a temptation to do 412 * Resist a temptation to do
412 * if (!is_page_busy(bpp, page->bitmap)) pool_free_page(pool, page); 413 * if (!is_page_busy(bpp, page->bitmap)) pool_free_page(pool, page);