#include <asm/cpufeature.h>
 #include <asm/special_insns.h>
 
-#define ARCH_MEMREMAP_PMEM MEMREMAP_WB
-
 #ifdef CONFIG_ARCH_HAS_PMEM_API
 /**
  * arch_memcpy_to_pmem - copy data to persistent memory
        __arch_wb_cache_pmem(vaddr, size);
 }
 
-static inline bool arch_has_wmb_pmem(void)
+static inline bool __arch_has_wmb_pmem(void)
 {
-#ifdef CONFIG_X86_64
        /*
         * We require that wmb() be an 'sfence', that is only guaranteed on
         * 64-bit builds
         */
        return static_cpu_has(X86_FEATURE_PCOMMIT);
-#else
-       return false;
-#endif
 }
 #endif /* CONFIG_ARCH_HAS_PMEM_API */
-
 #endif /* __ASM_X86_PMEM_H__ */
 
 #include <linux/uio.h>
 
 #ifdef CONFIG_ARCH_HAS_PMEM_API
+#define ARCH_MEMREMAP_PMEM MEMREMAP_WB
 #include <asm/pmem.h>
 #else
-static inline void arch_wmb_pmem(void)
+#define ARCH_MEMREMAP_PMEM MEMREMAP_WT
+/*
+ * These are simply here to enable compilation, all call sites gate
+ * calling these symbols with arch_has_pmem_api() and redirect to the
+ * implementation in asm/pmem.h.
+ */
+static inline bool __arch_has_wmb_pmem(void)
 {
-       BUG();
+       return false;
 }
 
-static inline bool arch_has_wmb_pmem(void)
+static inline void arch_wmb_pmem(void)
 {
-       return false;
+       BUG();
 }
 
 static inline void arch_memcpy_to_pmem(void __pmem *dst, const void *src,
  * implementations for arch_memcpy_to_pmem(), arch_wmb_pmem(),
  * arch_copy_from_iter_pmem(), arch_clear_pmem() and arch_has_wmb_pmem().
  */
-
 static inline void memcpy_from_pmem(void *dst, void __pmem const *src, size_t size)
 {
        memcpy(dst, (void __force const *) src, size);
        devm_memunmap(dev, (void __force *) addr);
 }
 
+static inline bool arch_has_pmem_api(void)
+{
+       return IS_ENABLED(CONFIG_ARCH_HAS_PMEM_API);
+}
+
 /**
- * arch_has_pmem_api - true if wmb_pmem() ensures durability
+ * arch_has_wmb_pmem - true if wmb_pmem() ensures durability
  *
  * For a given cpu implementation within an architecture it is possible
  * that wmb_pmem() resolves to a nop.  In the case this returns
  * fall back to a different data consistency model, or otherwise notify
  * the user.
  */
-static inline bool arch_has_pmem_api(void)
+static inline bool arch_has_wmb_pmem(void)
 {
-       return IS_ENABLED(CONFIG_ARCH_HAS_PMEM_API) && arch_has_wmb_pmem();
+       return arch_has_pmem_api() && __arch_has_wmb_pmem();
 }
 
 /*
 static inline void __pmem *memremap_pmem(struct device *dev,
                resource_size_t offset, unsigned long size)
 {
-#ifdef ARCH_MEMREMAP_PMEM
        return (void __pmem *) devm_memremap(dev, offset, size,
                        ARCH_MEMREMAP_PMEM);
-#else
-       return (void __pmem *) devm_memremap(dev, offset, size,
-                       MEMREMAP_WT);
-#endif
 }
 
 /**
  */
 static inline void wmb_pmem(void)
 {
-       if (arch_has_pmem_api())
+       if (arch_has_wmb_pmem())
                arch_wmb_pmem();
+       else
+               wmb();
 }
 
 /**