Skip to content

Commit

Permalink
dma-debug: disable/enable irqs only once in device_dma_allocations
Browse files Browse the repository at this point in the history
There is no need to disable/enable irqs on each loop iteration. Just
disable irqs for the whole time the loop runs.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
  • Loading branch information
Joerg Roedel committed Jun 8, 2009
1 parent e7ed70e commit be81c6e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/dma-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -649,15 +649,19 @@ static int device_dma_allocations(struct device *dev)
unsigned long flags;
int count = 0, i;

local_irq_save(flags);

for (i = 0; i < HASH_SIZE; ++i) {
spin_lock_irqsave(&dma_entry_hash[i].lock, flags);
spin_lock(&dma_entry_hash[i].lock);
list_for_each_entry(entry, &dma_entry_hash[i].list, list) {
if (entry->dev == dev)
count += 1;
}
spin_unlock_irqrestore(&dma_entry_hash[i].lock, flags);
spin_unlock(&dma_entry_hash[i].lock);
}

local_irq_restore(flags);

return count;
}

Expand Down

0 comments on commit be81c6e

Please sign in to comment.