summaryrefslogtreecommitdiffstats
path: root/lib/dma-debug.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-04-24 03:40:51 -0400
committerChristoph Hellwig <hch@lst.de>2018-05-08 07:03:05 -0400
commitbcebe324cb44f0298f6bb5fcb5eb92a3ec55feeb (patch)
tree7633bdda6688354c06bda803f08c743fd1efa84d /lib/dma-debug.c
parent15b28bbcd567a9199481ecfef39702b258f9baff (diff)
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>
Diffstat (limited to 'lib/dma-debug.c')
-rw-r--r--lib/dma-debug.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 712a897174e4..075253cb613b 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -132,7 +132,7 @@ static u32 min_free_entries;
132static u32 nr_total_entries; 132static u32 nr_total_entries;
133 133
134/* number of preallocated entries requested by kernel cmdline */ 134/* number of preallocated entries requested by kernel cmdline */
135static u32 req_entries; 135static u32 nr_prealloc_entries = PREALLOC_DMA_DEBUG_ENTRIES;
136 136
137/* debugfs dentry's for the stuff above */ 137/* debugfs dentry's for the stuff above */
138static struct dentry *dma_debug_dent __read_mostly; 138static struct dentry *dma_debug_dent __read_mostly;
@@ -1011,7 +1011,6 @@ void dma_debug_add_bus(struct bus_type *bus)
1011 1011
1012static int dma_debug_init(void) 1012static int dma_debug_init(void)
1013{ 1013{
1014 u32 num_entries;
1015 int i; 1014 int i;
1016 1015
1017 /* Do not use dma_debug_initialized here, since we really want to be 1016 /* Do not use dma_debug_initialized here, since we really want to be
@@ -1032,12 +1031,7 @@ static int dma_debug_init(void)
1032 return 0; 1031 return 0;
1033 } 1032 }
1034 1033
1035 if (req_entries) 1034 if (prealloc_memory(nr_prealloc_entries) != 0) {
1036 num_entries = req_entries;
1037 else
1038 num_entries = PREALLOC_DMA_DEBUG_ENTRIES;
1039
1040 if (prealloc_memory(num_entries) != 0) {
1041 pr_err("DMA-API: debugging out of memory error - disabled\n"); 1035 pr_err("DMA-API: debugging out of memory error - disabled\n");
1042 global_disable = true; 1036 global_disable = true;
1043 1037
@@ -1068,16 +1062,10 @@ static __init int dma_debug_cmdline(char *str)
1068 1062
1069static __init int dma_debug_entries_cmdline(char *str) 1063static __init int dma_debug_entries_cmdline(char *str)
1070{ 1064{
1071 int res;
1072
1073 if (!str) 1065 if (!str)
1074 return -EINVAL; 1066 return -EINVAL;
1075 1067 if (!get_option(&str, &nr_prealloc_entries))
1076 res = get_option(&str, &req_entries); 1068 nr_prealloc_entries = PREALLOC_DMA_DEBUG_ENTRIES;
1077
1078 if (!res)
1079 req_entries = 0;
1080
1081 return 0; 1069 return 0;
1082} 1070}
1083 1071