dma-debug: simplify counting of preallocated requests
Just keep a single variable with a descriptive name instead of two with confusing names. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Robin Murphy <robin.murphy@arm.com>
This commit is contained in:
parent
15b28bbcd5
commit
bcebe324cb
@ -132,7 +132,7 @@ static u32 min_free_entries;
|
|||||||
static u32 nr_total_entries;
|
static u32 nr_total_entries;
|
||||||
|
|
||||||
/* number of preallocated entries requested by kernel cmdline */
|
/* number of preallocated entries requested by kernel cmdline */
|
||||||
static u32 req_entries;
|
static u32 nr_prealloc_entries = PREALLOC_DMA_DEBUG_ENTRIES;
|
||||||
|
|
||||||
/* debugfs dentry's for the stuff above */
|
/* debugfs dentry's for the stuff above */
|
||||||
static struct dentry *dma_debug_dent __read_mostly;
|
static struct dentry *dma_debug_dent __read_mostly;
|
||||||
@ -1011,7 +1011,6 @@ void dma_debug_add_bus(struct bus_type *bus)
|
|||||||
|
|
||||||
static int dma_debug_init(void)
|
static int dma_debug_init(void)
|
||||||
{
|
{
|
||||||
u32 num_entries;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Do not use dma_debug_initialized here, since we really want to be
|
/* Do not use dma_debug_initialized here, since we really want to be
|
||||||
@ -1032,12 +1031,7 @@ static int dma_debug_init(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req_entries)
|
if (prealloc_memory(nr_prealloc_entries) != 0) {
|
||||||
num_entries = req_entries;
|
|
||||||
else
|
|
||||||
num_entries = PREALLOC_DMA_DEBUG_ENTRIES;
|
|
||||||
|
|
||||||
if (prealloc_memory(num_entries) != 0) {
|
|
||||||
pr_err("DMA-API: debugging out of memory error - disabled\n");
|
pr_err("DMA-API: debugging out of memory error - disabled\n");
|
||||||
global_disable = true;
|
global_disable = true;
|
||||||
|
|
||||||
@ -1068,16 +1062,10 @@ static __init int dma_debug_cmdline(char *str)
|
|||||||
|
|
||||||
static __init int dma_debug_entries_cmdline(char *str)
|
static __init int dma_debug_entries_cmdline(char *str)
|
||||||
{
|
{
|
||||||
int res;
|
|
||||||
|
|
||||||
if (!str)
|
if (!str)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
if (!get_option(&str, &nr_prealloc_entries))
|
||||||
res = get_option(&str, &req_entries);
|
nr_prealloc_entries = PREALLOC_DMA_DEBUG_ENTRIES;
|
||||||
|
|
||||||
if (!res)
|
|
||||||
req_entries = 0;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user