Skip to content

Commit

Permalink
dma/debug: Remove dma_debug_resize_entries()
Browse files Browse the repository at this point in the history
With the only caller now gone, we can clean up this part of dma-debug's
exposed internals and make way to tweak the allocation behaviour.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Tested-by: Qian Cai <cai@lca.pw>
Signed-off-by: Christoph Hellwig <hch@lst.de>
  • Loading branch information
Robin Murphy authored and Christoph Hellwig committed Dec 11, 2018
1 parent a8a4c98 commit 0cb0e25
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 53 deletions.
7 changes: 0 additions & 7 deletions include/linux/dma-debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ struct bus_type;

extern void dma_debug_add_bus(struct bus_type *bus);

extern int dma_debug_resize_entries(u32 num_entries);

extern void debug_dma_map_single(struct device *dev, const void *addr,
unsigned long len);

Expand Down Expand Up @@ -101,11 +99,6 @@ static inline void dma_debug_add_bus(struct bus_type *bus)
{
}

static inline int dma_debug_resize_entries(u32 num_entries)
{
return 0;
}

static inline void debug_dma_map_single(struct device *dev, const void *addr,
unsigned long len)
{
Expand Down
46 changes: 0 additions & 46 deletions kernel/dma/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -755,52 +755,6 @@ static void dma_entry_free(struct dma_debug_entry *entry)
spin_unlock_irqrestore(&free_entries_lock, flags);
}

int dma_debug_resize_entries(u32 num_entries)
{
int i, delta, ret = 0;
unsigned long flags;
struct dma_debug_entry *entry;
LIST_HEAD(tmp);

spin_lock_irqsave(&free_entries_lock, flags);

if (nr_total_entries < num_entries) {
delta = num_entries - nr_total_entries;

spin_unlock_irqrestore(&free_entries_lock, flags);

for (i = 0; i < delta; i++) {
entry = kzalloc(sizeof(*entry), GFP_KERNEL);
if (!entry)
break;

list_add_tail(&entry->list, &tmp);
}

spin_lock_irqsave(&free_entries_lock, flags);

list_splice(&tmp, &free_entries);
nr_total_entries += i;
num_free_entries += i;
} else {
delta = nr_total_entries - num_entries;

for (i = 0; i < delta && !list_empty(&free_entries); i++) {
entry = __dma_entry_alloc();
kfree(entry);
}

nr_total_entries -= i;
}

if (nr_total_entries != num_entries)
ret = 1;

spin_unlock_irqrestore(&free_entries_lock, flags);

return ret;
}

/*
* DMA-API debugging init code
*
Expand Down

0 comments on commit 0cb0e25

Please sign in to comment.