Merge tag 'please-pull-pstore' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl...
[firefly-linux-kernel-4.4.55.git] / include / asm-generic / pgtable.h
index 081ff8826bf6855630f1a7d5a3c51302d72b87c7..752e30d639045c2ec970b479c680a08d4381d4e1 100644 (file)
@@ -253,6 +253,20 @@ static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b)
 #define pgprot_device pgprot_noncached
 #endif
 
+#ifndef pgprot_modify
+#define pgprot_modify pgprot_modify
+static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
+{
+       if (pgprot_val(oldprot) == pgprot_val(pgprot_noncached(oldprot)))
+               newprot = pgprot_noncached(newprot);
+       if (pgprot_val(oldprot) == pgprot_val(pgprot_writecombine(oldprot)))
+               newprot = pgprot_writecombine(newprot);
+       if (pgprot_val(oldprot) == pgprot_val(pgprot_device(oldprot)))
+               newprot = pgprot_device(newprot);
+       return newprot;
+}
+#endif
+
 /*
  * When walking page tables, get the address of the next boundary,
  * or the end address of the range if that comes earlier.  Although no