aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPankaj Gupta2017-05-03 16:51:28 -0500
committerLinus Torvalds2017-05-03 17:52:07 -0500
commit6a5cd60ba84723c3f6cdb8dbe26a1dc9e26a0a02 (patch)
tree744f0a6c971469e7859ea0fbeae7bab11a34b1ea /lib
parent46f0537b1ecf672052007c97f102a7e6bf0791e4 (diff)
downloadkernel-6a5cd60ba84723c3f6cdb8dbe26a1dc9e26a0a02.tar.gz
kernel-6a5cd60ba84723c3f6cdb8dbe26a1dc9e26a0a02.tar.xz
kernel-6a5cd60ba84723c3f6cdb8dbe26a1dc9e26a0a02.zip
lib/dma-debug.c: make locking work for RT
Interrupt enable/disabled with spinlock is not a valid operation for RT as it can make executing tasks sleep from a non-sleepable context. So convert it to spin_lock_irq[save, restore]. Link: http://lkml.kernel.org/r/1492065666-3816-1-git-send-email-pagupta@redhat.com Signed-off-by: Pankaj Gupta <pagupta@redhat.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Cc: Vinod Koul <vinod.koul@intel.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Ville Syrjl <ville.syrjala@linux.intel.com> Cc: Miles Chen <miles.chen@mediatek.com> Cc: Marcelo Tosatti <mtosatti@redhat.com> Cc: Joerg Roedel <jroedel@suse.de> Cc: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/dma-debug.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index b157b46cc9a6..fe4d50c992df 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -942,21 +942,17 @@ static int device_dma_allocations(struct device *dev, struct dma_debug_entry **o
942 unsigned long flags; 942 unsigned long flags;
943 int count = 0, i; 943 int count = 0, i;
944 944
945 local_irq_save(flags);
946
947 for (i = 0; i < HASH_SIZE; ++i) { 945 for (i = 0; i < HASH_SIZE; ++i) {
948 spin_lock(&dma_entry_hash[i].lock); 946 spin_lock_irqsave(&dma_entry_hash[i].lock, flags);
949 list_for_each_entry(entry, &dma_entry_hash[i].list, list) { 947 list_for_each_entry(entry, &dma_entry_hash[i].list, list) {
950 if (entry->dev == dev) { 948 if (entry->dev == dev) {
951 count += 1; 949 count += 1;
952 *out_entry = entry; 950 *out_entry = entry;
953 } 951 }
954 } 952 }
955 spin_unlock(&dma_entry_hash[i].lock); 953 spin_unlock_irqrestore(&dma_entry_hash[i].lock, flags);
956 } 954 }
957 955
958 local_irq_restore(flags);
959
960 return count; 956 return count;
961} 957}
962 958