summaryrefslogtreecommitdiff
path: root/lib/dma-debug.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2017-06-02 17:49:10 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-06-02 17:49:10 -0700
commiteadcbfa58ae8693f0d6a0f591d8f51d55cf068e1 (patch)
treecff3f1c56a8bf15138b652ee9dab50dddd6edee5 /lib/dma-debug.c
parentc4beedb8a914af9c8c1b6e67c753adf411e05160 (diff)
parent5ed02dbb497422bf225783f46e6eadd237d23d6b (diff)
Merge tag 'v4.12-rc3' into for-linus
Merge with mainline to get acpi_dev_present() needed by patches to axp20x-pek driver.
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
unsigned long flags;
int count = 0, i;
- local_irq_save(flags);
-
for (i = 0; i < HASH_SIZE; ++i) {
- spin_lock(&dma_entry_hash[i].lock);
+ spin_lock_irqsave(&dma_entry_hash[i].lock, flags);
list_for_each_entry(entry, &dma_entry_hash[i].list, list) {
if (entry->dev == dev) {
count += 1;
*out_entry = entry;
}
}
- spin_unlock(&dma_entry_hash[i].lock);
+ spin_unlock_irqrestore(&dma_entry_hash[i].lock, flags);
}
- local_irq_restore(flags);
-
return count;
}
@@ -1502,7 +1498,7 @@ void debug_dma_alloc_coherent(struct device *dev, size_t size,
entry->type = dma_debug_coherent;
entry->dev = dev;
entry->pfn = page_to_pfn(virt_to_page(virt));
- entry->offset = (size_t) virt & ~PAGE_MASK;
+ entry->offset = offset_in_page(virt);
entry->size = size;
entry->dev_addr = dma_addr;
entry->direction = DMA_BIDIRECTIONAL;
@@ -1518,7 +1514,7 @@ void debug_dma_free_coherent(struct device *dev, size_t size,
.type = dma_debug_coherent,
.dev = dev,
.pfn = page_to_pfn(virt_to_page(virt)),
- .offset = (size_t) virt & ~PAGE_MASK,
+ .offset = offset_in_page(virt),
.dev_addr = addr,
.size = size,
.direction = DMA_BIDIRECTIONAL,