diff options
| author | James Bottomley <James.Bottomley@HansenPartnership.com> | 2016-05-17 21:12:50 -0400 |
|---|---|---|
| committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2016-05-17 21:12:50 -0400 |
| commit | e7ca7f9fa2cda220ba807620c992ce77c33a32ea (patch) | |
| tree | fb8a6c1abc638c5a79645f4b9f44ece7c67187b4 /include/linux/pmem.h | |
| parent | 5f0dfb7a9bcc8139958f59ecb9bbd7e738ae702d (diff) | |
| parent | d65c8fff867a6450c58ce31572e883148a445ddf (diff) | |
Merge branch 'fixes' into misc
Diffstat (limited to 'include/linux/pmem.h')
| -rw-r--r-- | include/linux/pmem.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/include/linux/pmem.h b/include/linux/pmem.h index ac6d872ce067..57d146fe44dd 100644 --- a/include/linux/pmem.h +++ b/include/linux/pmem.h @@ -72,6 +72,18 @@ static inline void arch_invalidate_pmem(void __pmem *addr, size_t size) } #endif +static inline bool arch_has_pmem_api(void) +{ + return IS_ENABLED(CONFIG_ARCH_HAS_PMEM_API); +} + +static inline int default_memcpy_from_pmem(void *dst, void __pmem const *src, + size_t size) +{ + memcpy(dst, (void __force *) src, size); + return 0; +} + /* * memcpy_from_pmem - read from persistent memory with error handling * @dst: destination buffer @@ -83,12 +95,10 @@ static inline void arch_invalidate_pmem(void __pmem *addr, size_t size) static inline int memcpy_from_pmem(void *dst, void __pmem const *src, size_t size) { - return arch_memcpy_from_pmem(dst, src, size); -} - -static inline bool arch_has_pmem_api(void) -{ - return IS_ENABLED(CONFIG_ARCH_HAS_PMEM_API); + if (arch_has_pmem_api()) + return arch_memcpy_from_pmem(dst, src, size); + else + return default_memcpy_from_pmem(dst, src, size); } /** |
