summaryrefslogtreecommitdiffstats
path: root/include/asm-generic/memory_model.h
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2023-03-13 10:14:05 +0100
committerThomas Zimmermann <tzimmermann@suse.de>2023-03-13 10:14:05 +0100
commitb3c9a04135bdbd3aabd5e9534bad0fe6df505f8a (patch)
tree2372cd098db2a0e45da99125258e454b827cb577 /include/asm-generic/memory_model.h
parentfbdev: Fix incorrect page mapping clearance at fb_deferred_io_release() (diff)
parentLinux 6.3-rc2 (diff)
downloadlinux-b3c9a04135bdbd3aabd5e9534bad0fe6df505f8a.tar.xz
linux-b3c9a04135bdbd3aabd5e9534bad0fe6df505f8a.zip
Merge drm/drm-fixes into drm-misc-fixes
Backmerging to get latest upstream. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Diffstat (limited to 'include/asm-generic/memory_model.h')
-rw-r--r--include/asm-generic/memory_model.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_model.h
index a2c8ed60233a..6796abe1900e 100644
--- a/include/asm-generic/memory_model.h
+++ b/include/asm-generic/memory_model.h
@@ -19,6 +19,18 @@
#define __page_to_pfn(page) ((unsigned long)((page) - mem_map) + \
ARCH_PFN_OFFSET)
+#ifndef pfn_valid
+static inline int pfn_valid(unsigned long pfn)
+{
+ /* avoid <linux/mm.h> include hell */
+ extern unsigned long max_mapnr;
+ unsigned long pfn_offset = ARCH_PFN_OFFSET;
+
+ return pfn >= pfn_offset && (pfn - pfn_offset) < max_mapnr;
+}
+#define pfn_valid pfn_valid
+#endif
+
#elif defined(CONFIG_SPARSEMEM_VMEMMAP)
/* memmap is virtually contiguous. */