Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
[linux-2.6-block.git] / mm / dmapool.c
index 71a8998cd03a6b8b0d2dbfe36a24ce70766047e8..57312b5d6e12aaf2da3f6acd38a19bbe28959077 100644 (file)
@@ -326,7 +326,7 @@ void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags,
        size_t offset;
        void *retval;
 
-       might_sleep_if(mem_flags & __GFP_WAIT);
+       might_sleep_if(gfpflags_allow_blocking(mem_flags));
 
        spin_lock_irqsave(&pool->lock, flags);
        list_for_each_entry(page, &pool->page_list, page_list) {
@@ -394,7 +394,7 @@ static struct dma_page *pool_find_page(struct dma_pool *pool, dma_addr_t dma)
        list_for_each_entry(page, &pool->page_list, page_list) {
                if (dma < page->dma)
                        continue;
-               if (dma < (page->dma + pool->allocation))
+               if ((dma - page->dma) < pool->allocation)
                        return page;
        }
        return NULL;