diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/dma-debug.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index 1ac35dbaf8e0..9722bd2dbc9b 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c | |||
| @@ -102,9 +102,12 @@ static DEFINE_SPINLOCK(free_entries_lock); | |||
| 102 | /* Global disable flag - will be set in case of an error */ | 102 | /* Global disable flag - will be set in case of an error */ |
| 103 | static u32 global_disable __read_mostly; | 103 | static u32 global_disable __read_mostly; |
| 104 | 104 | ||
| 105 | /* Early initialization disable flag, set at the end of dma_debug_init */ | ||
| 106 | static bool dma_debug_initialized __read_mostly; | ||
| 107 | |||
| 105 | static inline bool dma_debug_disabled(void) | 108 | static inline bool dma_debug_disabled(void) |
| 106 | { | 109 | { |
| 107 | return global_disable; | 110 | return global_disable || !dma_debug_initialized; |
| 108 | } | 111 | } |
| 109 | 112 | ||
| 110 | /* Global error count */ | 113 | /* Global error count */ |
| @@ -999,7 +1002,10 @@ void dma_debug_init(u32 num_entries) | |||
| 999 | { | 1002 | { |
| 1000 | int i; | 1003 | int i; |
| 1001 | 1004 | ||
| 1002 | if (dma_debug_disabled()) | 1005 | /* Do not use dma_debug_initialized here, since we really want to be |
| 1006 | * called to set dma_debug_initialized | ||
| 1007 | */ | ||
| 1008 | if (global_disable) | ||
| 1003 | return; | 1009 | return; |
| 1004 | 1010 | ||
| 1005 | for (i = 0; i < HASH_SIZE; ++i) { | 1011 | for (i = 0; i < HASH_SIZE; ++i) { |
| @@ -1026,6 +1032,8 @@ void dma_debug_init(u32 num_entries) | |||
| 1026 | 1032 | ||
| 1027 | nr_total_entries = num_free_entries; | 1033 | nr_total_entries = num_free_entries; |
| 1028 | 1034 | ||
| 1035 | dma_debug_initialized = true; | ||
| 1036 | |||
| 1029 | pr_info("DMA-API: debugging enabled by kernel config\n"); | 1037 | pr_info("DMA-API: debugging enabled by kernel config\n"); |
| 1030 | } | 1038 | } |
| 1031 | 1039 | ||
