[RFC PATCH 4/5] riscv: Drop redundant internal header includes from the vDSO sources

From: Fang Xieyan

Date: Tue Dec 01 2026 - 06:56:01 EST


With the sanctioned headers providing all types through <vdso/types.h>,
the direct includes of internal headers in the riscv vDSO sources are
dead weight: they are the only thing keeping the <linux/types.h> ->
<asm/...> -> bitsperlong chain alive inside these vDSO translation
units.

The vDSO Makefile already force-includes the sanctioned headers
(c-gettimeofday-y / c-getrandom-y), so the same code shape as the
include-free arm64 vDSO sources can be used here. <linux/time.h> in
vgettimeofday.c is redundant for the same reason: struct
__kernel_timespec and friends reach the file through the same chain.

hwprobe.c is left untouched: it still needs <linux/string.h> from the
internal chain, a separate cleanup.

Signed-off-by: Fang Xieyan <fangxy@xxxxxxxxxxxx>
---
Build-tested at the series tip (this patch and patch 5 both applied):
riscv64 defconfig cross-build (clang --target=riscv64-linux-gnu)
completes with 0 errors and still produces
arch/riscv/kernel/vdso/vdso.so(.dbg); the riscv sources are identical
between this commit and the tested tip.

arch/riscv/kernel/vdso/getrandom.c | 1 -
arch/riscv/kernel/vdso/vgettimeofday.c | 2 --
2 files changed, 3 deletions(-)

diff --git a/arch/riscv/kernel/vdso/getrandom.c b/arch/riscv/kernel/vdso/getrandom.c
index f21922e8cebd..6524e918c494 100644
--- a/arch/riscv/kernel/vdso/getrandom.c
+++ b/arch/riscv/kernel/vdso/getrandom.c
@@ -2,7 +2,6 @@
/*
* Copyright (C) 2025 Xi Ruoyao <xry111@xxxxxxxxxxx>. All Rights Reserved.
*/
-#include <linux/types.h>

ssize_t __vdso_getrandom(void *buffer, size_t len, unsigned int flags, void *opaque_state, size_t opaque_len)
{
diff --git a/arch/riscv/kernel/vdso/vgettimeofday.c b/arch/riscv/kernel/vdso/vgettimeofday.c
index b35057802584..57bd32c5bf2b 100644
--- a/arch/riscv/kernel/vdso/vgettimeofday.c
+++ b/arch/riscv/kernel/vdso/vgettimeofday.c
@@ -6,8 +6,6 @@
* Copyright (C) 2020 SiFive
*/

-#include <linux/time.h>
-#include <linux/types.h>
#include <vdso/gettime.h>

int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts)
--
2.50.1