highmem: Fix debug_kmap_atomic() to also handle KM_IRQ_PTE, KM_NMI, and KM_NMI_PTE
[sfrench/cifs-2.6.git] / mm / highmem.c
index 25878cc49daa268806f46dfa4e05af8d6f8f3998..9c1e627f282e58e7b85f6dae52098c2f222a44e7 100644 (file)
@@ -426,16 +426,21 @@ void __init page_address_init(void)
 
 void debug_kmap_atomic(enum km_type type)
 {
-       static unsigned warn_count = 10;
+       static int warn_count = 10;
 
-       if (unlikely(warn_count == 0))
+       if (unlikely(warn_count < 0))
                return;
 
        if (unlikely(in_interrupt())) {
-               if (in_irq()) {
+               if (in_nmi()) {
+                       if (type != KM_NMI && type != KM_NMI_PTE) {
+                               WARN_ON(1);
+                               warn_count--;
+                       }
+               } else if (in_irq()) {
                        if (type != KM_IRQ0 && type != KM_IRQ1 &&
                            type != KM_BIO_SRC_IRQ && type != KM_BIO_DST_IRQ &&
-                           type != KM_BOUNCE_READ) {
+                           type != KM_BOUNCE_READ && type != KM_IRQ_PTE) {
                                WARN_ON(1);
                                warn_count--;
                        }
@@ -452,7 +457,9 @@ void debug_kmap_atomic(enum km_type type)
        }
 
        if (type == KM_IRQ0 || type == KM_IRQ1 || type == KM_BOUNCE_READ ||
-                       type == KM_BIO_SRC_IRQ || type == KM_BIO_DST_IRQ) {
+                       type == KM_BIO_SRC_IRQ || type == KM_BIO_DST_IRQ ||
+                       type == KM_IRQ_PTE || type == KM_NMI ||
+                       type == KM_NMI_PTE ) {
                if (!irqs_disabled()) {
                        WARN_ON(1);
                        warn_count--;