linux/arch/arm/mach-shmobile
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
..
common.h ARM: shmobile: Remove unused shmobile_smp_init_fallback_ops() 2018-06-18 12:00:22 +02:00
emev2.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
headsmp-apmu.S ARM: shmobile: rcar-gen2: Stop compiling headsmp-apmu on !SMP 2018-06-27 17:08:52 +02:00
headsmp-scu.S ARM: mm: Make virt_to_pfn() a static inline 2023-05-29 11:27:08 +02:00
headsmp.S ARM: mm: Make virt_to_pfn() a static inline 2023-05-29 11:27:08 +02:00
Kconfig ARM: shmobile: Drop selecting GPIOLIB and PINCTRL 2022-10-28 14:31:24 +02:00
Makefile ARM: shmobile: R-Mobile: Move pm-rmobile to drivers/soc/renesas/ 2018-11-30 11:29:11 +01:00
platsmp-apmu.c ARM: sh-mobile: Use of_cpu_node_to_id() to read CPU node 'reg' 2023-03-30 16:02:42 +02:00
platsmp-scu.c ARM: shmobile: Stop using __raw_*() I/O accessors 2020-11-23 09:54:59 +01:00
platsmp.c ARM: shmobile: convert to SPDX identifiers 2018-09-11 15:41:30 +02:00
pm-rcar-gen2.c remove ioremap_nocache and devm_ioremap_nocache 2020-01-06 09:45:59 +01:00
r8a7779.h ARM: shmobile: r8a7779: Remove explicit SYSC config and init 2018-06-18 12:00:28 +02:00
rcar-gen2.h ARM: shmobile: rcar-gen2: Make rcar_gen2_{timer_init, reserve}() static 2020-09-10 19:01:26 +02:00
regulator-quirk-rcar-gen2.c ARM: shmobile: rcar-gen2: Increase refcount for new reference 2022-07-05 09:08:35 +02:00
setup-emev2.c ARM: shmobile: Drop commas after dt_compat sentinels 2022-05-05 12:32:40 +02:00
setup-r7s9210.c ARM: shmobile: Drop commas after dt_compat sentinels 2022-05-05 12:32:40 +02:00
setup-r7s72100.c ARM: shmobile: Drop commas after dt_compat sentinels 2022-05-05 12:32:40 +02:00
setup-r8a73a4.c ARM: shmobile: Drop commas after dt_compat sentinels 2022-05-05 12:32:40 +02:00
setup-r8a7740.c ARM: shmobile: Drop commas after dt_compat sentinels 2022-05-05 12:32:40 +02:00
setup-r8a7778.c ARM: shmobile: Drop commas after dt_compat sentinels 2022-05-05 12:32:40 +02:00
setup-r8a7779.c ARM: shmobile: Drop commas after dt_compat sentinels 2022-05-05 12:32:40 +02:00
setup-rcar-gen2.c ARM: shmobile: Drop commas after dt_compat sentinels 2022-05-05 12:32:40 +02:00
setup-sh73a0.c ARM: shmobile: Drop commas after dt_compat sentinels 2022-05-05 12:32:40 +02:00
sh73a0.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
smp-emev2.c ARM: shmobile: convert to SPDX identifier 2018-06-18 12:00:29 +02:00
smp-r8a7779.c ARM: shmobile: Stop using __raw_*() I/O accessors 2020-11-23 09:54:59 +01:00
smp-sh73a0.c ARM: shmobile: Stop using __raw_*() I/O accessors 2020-11-23 09:54:59 +01:00
suspend.c ARM: shmobile: convert to SPDX identifiers 2018-09-11 15:41:30 +02:00
timer.c ARM: SoC platform updates for 4.20 2018-10-29 15:37:33 -07:00