diff options
Diffstat (limited to 'lib/dma-debug.c')
-rw-r--r-- | lib/dma-debug.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index 7f5cdc1e6b29..712a897174e4 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c | |||
@@ -41,6 +41,11 @@ | |||
41 | #define HASH_FN_SHIFT 13 | 41 | #define HASH_FN_SHIFT 13 |
42 | #define HASH_FN_MASK (HASH_SIZE - 1) | 42 | #define HASH_FN_MASK (HASH_SIZE - 1) |
43 | 43 | ||
44 | /* allow architectures to override this if absolutely required */ | ||
45 | #ifndef PREALLOC_DMA_DEBUG_ENTRIES | ||
46 | #define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16) | ||
47 | #endif | ||
48 | |||
44 | enum { | 49 | enum { |
45 | dma_debug_single, | 50 | dma_debug_single, |
46 | dma_debug_page, | 51 | dma_debug_page, |
@@ -1004,18 +1009,16 @@ void dma_debug_add_bus(struct bus_type *bus) | |||
1004 | bus_register_notifier(bus, nb); | 1009 | bus_register_notifier(bus, nb); |
1005 | } | 1010 | } |
1006 | 1011 | ||
1007 | /* | 1012 | static int dma_debug_init(void) |
1008 | * Let the architectures decide how many entries should be preallocated. | ||
1009 | */ | ||
1010 | void dma_debug_init(u32 num_entries) | ||
1011 | { | 1013 | { |
1014 | u32 num_entries; | ||
1012 | int i; | 1015 | int i; |
1013 | 1016 | ||
1014 | /* Do not use dma_debug_initialized here, since we really want to be | 1017 | /* Do not use dma_debug_initialized here, since we really want to be |
1015 | * called to set dma_debug_initialized | 1018 | * called to set dma_debug_initialized |
1016 | */ | 1019 | */ |
1017 | if (global_disable) | 1020 | if (global_disable) |
1018 | return; | 1021 | return 0; |
1019 | 1022 | ||
1020 | for (i = 0; i < HASH_SIZE; ++i) { | 1023 | for (i = 0; i < HASH_SIZE; ++i) { |
1021 | INIT_LIST_HEAD(&dma_entry_hash[i].list); | 1024 | INIT_LIST_HEAD(&dma_entry_hash[i].list); |
@@ -1026,17 +1029,19 @@ void dma_debug_init(u32 num_entries) | |||
1026 | pr_err("DMA-API: error creating debugfs entries - disabling\n"); | 1029 | pr_err("DMA-API: error creating debugfs entries - disabling\n"); |
1027 | global_disable = true; | 1030 | global_disable = true; |
1028 | 1031 | ||
1029 | return; | 1032 | return 0; |
1030 | } | 1033 | } |
1031 | 1034 | ||
1032 | if (req_entries) | 1035 | if (req_entries) |
1033 | num_entries = req_entries; | 1036 | num_entries = req_entries; |
1037 | else | ||
1038 | num_entries = PREALLOC_DMA_DEBUG_ENTRIES; | ||
1034 | 1039 | ||
1035 | if (prealloc_memory(num_entries) != 0) { | 1040 | if (prealloc_memory(num_entries) != 0) { |
1036 | pr_err("DMA-API: debugging out of memory error - disabled\n"); | 1041 | pr_err("DMA-API: debugging out of memory error - disabled\n"); |
1037 | global_disable = true; | 1042 | global_disable = true; |
1038 | 1043 | ||
1039 | return; | 1044 | return 0; |
1040 | } | 1045 | } |
1041 | 1046 | ||
1042 | nr_total_entries = num_free_entries; | 1047 | nr_total_entries = num_free_entries; |
@@ -1044,7 +1049,9 @@ void dma_debug_init(u32 num_entries) | |||
1044 | dma_debug_initialized = true; | 1049 | dma_debug_initialized = true; |
1045 | 1050 | ||
1046 | pr_info("DMA-API: debugging enabled by kernel config\n"); | 1051 | pr_info("DMA-API: debugging enabled by kernel config\n"); |
1052 | return 0; | ||
1047 | } | 1053 | } |
1054 | core_initcall(dma_debug_init); | ||
1048 | 1055 | ||
1049 | static __init int dma_debug_cmdline(char *str) | 1056 | static __init int dma_debug_cmdline(char *str) |
1050 | { | 1057 | { |