linux/arch/arm/mm
Linus Walleij a9ff696160 ARM: mm: Make virt_to_pfn() a static inline
Making virt_to_pfn() a static inline taking a strongly typed
(const void *) makes the contract of a passing a pointer of that
type to the function explicit and exposes any misuse of the
macro virt_to_pfn() acting polymorphic and accepting many types
such as (void *), (unitptr_t) or (unsigned long) as arguments
without warnings.

Doing this is a bit intrusive: virt_to_pfn() requires
PHYS_PFN_OFFSET and PAGE_SHIFT to be defined, and this is defined in
<asm/page.h>, so this must be included *before* <asm/memory.h>.

The use of macros were obscuring the unclear inclusion order here,
as the macros would eventually be resolved, but a static inline
like this cannot be compiled with unresolved macros.

The naive solution to include <asm/page.h> at the top of
<asm/memory.h> does not work, because <asm/memory.h> sometimes
includes <asm/page.h> at the end of itself, which would create a
confusing inclusion loop. So instead, take the approach to always
unconditionally include <asm/page.h> at the end of <asm/memory.h>

arch/arm uses <asm/memory.h> explicitly in a lot of places,
however it turns out that if we just unconditionally include
<asm/memory.h> into <asm/page.h> and switch all inclusions of
<asm/memory.h> to <asm/page.h> instead, we enforce the right
order and <asm/memory.h> will always have access to the
definitions.

Put an inclusion guard in place making it impossible to include
<asm/memory.h> explicitly.

Link: https://lore.kernel.org/linux-mm/20220701160004.2ffff4e5ab59a55499f4c736@linux-foundation.org/
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2023-05-29 11:27:08 +02:00
..
abort-ev4.S
abort-ev4t.S
abort-ev5t.S
abort-ev5tj.S
abort-ev6.S ARM: 9263/1: use .arch directives instead of assembler command line flags 2022-11-08 18:36:17 +00:00
abort-ev7.S ARM: 9263/1: use .arch directives instead of assembler command line flags 2022-11-08 18:36:17 +00:00
abort-lv4t.S
abort-macro.S
abort-nommu.S
alignment.c ARM: 9214/1: alignment: advance IT state after emulating Thumb instruction 2022-07-06 22:44:49 +01:00
cache-b15-rac.c ARM: mm: fix typos in comments 2022-04-04 10:18:54 -07:00
cache-fa.S ARM: mm: Make virt_to_pfn() a static inline 2023-05-29 11:27:08 +02:00
cache-feroceon-l2.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_56.RULE (part 1) 2022-06-10 14:51:35 +02:00
cache-l2x0-pmu.c
cache-l2x0.c
cache-nop.S
cache-tauros2.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_56.RULE (part 1) 2022-06-10 14:51:35 +02:00
cache-tauros3.h
cache-uniphier.c
cache-v4.S
cache-v4wb.S ARM: mm: Make virt_to_pfn() a static inline 2023-05-29 11:27:08 +02:00
cache-v4wt.S
cache-v6.S ARM: 9263/1: use .arch directives instead of assembler command line flags 2022-11-08 18:36:17 +00:00
cache-v7.S ARM: 9263/1: use .arch directives instead of assembler command line flags 2022-11-08 18:36:17 +00:00
cache-v7m.S ARM: 9263/1: use .arch directives instead of assembler command line flags 2022-11-08 18:36:17 +00:00
cache-xsc3l2.c
context.c ARM: mm: make vmalloc_seq handling SMP safe 2022-01-25 09:53:52 +01:00
copypage-fa.c
copypage-feroceon.c ARM: 9263/1: use .arch directives instead of assembler command line flags 2022-11-08 18:36:17 +00:00
copypage-v4mc.c
copypage-v4wb.c
copypage-v4wt.c
copypage-v6.c
copypage-xsc3.c ARM: PXA: fix multi-cpu build of xsc3 2022-05-07 22:56:16 +02:00
copypage-xscale.c
dma-mapping-nommu.c
dma-mapping.c ARM: mm: Make virt_to_pfn() a static inline 2023-05-29 11:27:08 +02:00
dma.h
dump.c ARM: mm: Make virt_to_pfn() a static inline 2023-05-29 11:27:08 +02:00
extable.c
fault-armv.c
fault.c ARM updates for 6.2 2022-12-13 15:22:14 -08:00
fault.h ARM: 9278/1: kfence: only handle translation faults 2022-12-07 14:08:09 +00:00
flush.c
fsr-2level.c
fsr-3level.c
hugetlbpage.c
idmap.c
init.c ARM: mm: Make virt_to_pfn() a static inline 2023-05-29 11:27:08 +02:00
iomap.c
ioremap.c ARM: mm: kill unused runtime hook arch_iounmap() 2022-06-27 12:21:09 +01:00
kasan_init.c ARM: mm: Make virt_to_pfn() a static inline 2023-05-29 11:27:08 +02:00
Kconfig ARM: Make CONFIG_CPU_V7 valid for 32bit ARMv8 implementations 2023-03-27 14:01:18 +01:00
l2c-common.c
l2c-l2x0-resume.S
Makefile ARM: 9263/1: use .arch directives instead of assembler command line flags 2022-11-08 18:36:17 +00:00
mm.h ARM/dma-mapping: Remove CMA code when not built with CMA 2022-03-31 11:19:25 -07:00
mmap.c
mmu.c ARM: mm: Make virt_to_pfn() a static inline 2023-05-29 11:27:08 +02:00
nommu.c ARM: 9280/1: mm: fix warning on phys_addr_t to void pointer assignment 2023-01-11 16:20:05 +00:00
pabort-legacy.S
pabort-v6.S
pabort-v7.S
pageattr.c ARM: 9164/1: mm: Provide set_memory_valid() 2021-12-17 11:34:36 +00:00
pgd.c
physaddr.c ARM: mm: Make virt_to_pfn() a static inline 2023-05-29 11:27:08 +02:00
pmsa-v7.c
pmsa-v8.c ARM: mm: Make virt_to_pfn() a static inline 2023-05-29 11:27:08 +02:00
proc-arm7tdmi.S
proc-arm9tdmi.S
proc-arm720.S
proc-arm740.S
proc-arm920.S
proc-arm922.S
proc-arm925.S
proc-arm926.S
proc-arm940.S
proc-arm946.S
proc-arm1020.S
proc-arm1020e.S
proc-arm1022.S
proc-arm1026.S
proc-fa526.S
proc-feroceon.S
proc-macros.S ARM: 9284/1: include <asm/pgtable.h> from proc-macros.S to fix -Wundef warnings 2023-01-11 16:22:05 +00:00
proc-mohawk.S
proc-sa110.S
proc-sa1100.S
proc-syms.c
proc-v6.S ARM: 9263/1: use .arch directives instead of assembler command line flags 2022-11-08 18:36:17 +00:00
proc-v7-2level.S ARM: 9263/1: use .arch directives instead of assembler command line flags 2022-11-08 18:36:17 +00:00
proc-v7-3level.S
proc-v7-bugs.c ARM: 9213/1: Print message about disabled Spectre workarounds only once 2022-07-06 22:44:49 +01:00
proc-v7.S ARM: mm: Make virt_to_pfn() a static inline 2023-05-29 11:27:08 +02:00
proc-v7m.S ARM: mm: Make virt_to_pfn() a static inline 2023-05-29 11:27:08 +02:00
proc-xsc3.S
proc-xscale.S
ptdump_debugfs.c
pv-fixup-asm.S ARM: mm: Make virt_to_pfn() a static inline 2023-05-29 11:27:08 +02:00
tcm.h
tlb-fa.S
tlb-v4.S
tlb-v4wb.S
tlb-v4wbi.S
tlb-v6.S ARM: 9263/1: use .arch directives instead of assembler command line flags 2022-11-08 18:36:17 +00:00
tlb-v7.S ARM: 9263/1: use .arch directives instead of assembler command line flags 2022-11-08 18:36:17 +00:00