aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dma-debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dma-debug.c')
-rw-r--r--lib/dma-debug.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index b157b46cc9a6..ea4cc3dde4f1 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -942,21 +942,17 @@ static int device_dma_allocations(struct device *dev, struct dma_debug_entry **o
942 unsigned long flags; 942 unsigned long flags;
943 int count = 0, i; 943 int count = 0, i;
944 944
945 local_irq_save(flags);
946
947 for (i = 0; i < HASH_SIZE; ++i) { 945 for (i = 0; i < HASH_SIZE; ++i) {
948 spin_lock(&dma_entry_hash[i].lock); 946 spin_lock_irqsave(&dma_entry_hash[i].lock, flags);
949 list_for_each_entry(entry, &dma_entry_hash[i].list, list) { 947 list_for_each_entry(entry, &dma_entry_hash[i].list, list) {
950 if (entry->dev == dev) { 948 if (entry->dev == dev) {
951 count += 1; 949 count += 1;
952 *out_entry = entry; 950 *out_entry = entry;
953 } 951 }
954 } 952 }
955 spin_unlock(&dma_entry_hash[i].lock); 953 spin_unlock_irqrestore(&dma_entry_hash[i].lock, flags);
956 } 954 }
957 955
958 local_irq_restore(flags);
959
960 return count; 956 return count;
961} 957}
962 958
@@ -1502,7 +1498,7 @@ void debug_dma_alloc_coherent(struct device *dev, size_t size,
1502 entry->type = dma_debug_coherent; 1498 entry->type = dma_debug_coherent;
1503 entry->dev = dev; 1499 entry->dev = dev;
1504 entry->pfn = page_to_pfn(virt_to_page(virt)); 1500 entry->pfn = page_to_pfn(virt_to_page(virt));
1505 entry->offset = (size_t) virt & ~PAGE_MASK; 1501 entry->offset = offset_in_page(virt);
1506 entry->size = size; 1502 entry->size = size;
1507 entry->dev_addr = dma_addr; 1503 entry->dev_addr = dma_addr;
1508 entry->direction = DMA_BIDIRECTIONAL; 1504 entry->direction = DMA_BIDIRECTIONAL;
@@ -1518,7 +1514,7 @@ void debug_dma_free_coherent(struct device *dev, size_t size,
1518 .type = dma_debug_coherent, 1514 .type = dma_debug_coherent,
1519 .dev = dev, 1515 .dev = dev,
1520 .pfn = page_to_pfn(virt_to_page(virt)), 1516 .pfn = page_to_pfn(virt_to_page(virt)),
1521 .offset = (size_t) virt & ~PAGE_MASK, 1517 .offset = offset_in_page(virt),
1522 .dev_addr = addr, 1518 .dev_addr = addr,
1523 .size = size, 1519 .size = size,
1524 .direction = DMA_BIDIRECTIONAL, 1520 .direction = DMA_BIDIRECTIONAL,