Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: checksum: drop the linux/uaccess.h include

net/checksum.h pulls in linux/uaccess.h which is large.

In the x86 header the include seems to not be needed at all.
ARM on the other hand does not include uaccess.h, even tho
it calls access_ok().

In the generic implementation guard the include of linux/uaccess.h
with the same condition as the code that needs it.

With this change pre-processed net/checksum.h shrinks on x86
from 30616 lines to just 1193.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jakub Kicinski and committed by
David S. Miller
68f4eae7 9a859da2

+4 -2
+1
arch/arm/include/asm/checksum.h
··· 11 11 #define __ASM_ARM_CHECKSUM_H 12 12 13 13 #include <linux/in6.h> 14 + #include <linux/uaccess.h> 14 15 15 16 /* 16 17 * computes the checksum of a memory block at buff, length len,
-1
arch/x86/include/asm/checksum_64.h
··· 9 9 */ 10 10 11 11 #include <linux/compiler.h> 12 - #include <linux/uaccess.h> 13 12 #include <asm/byteorder.h> 14 13 15 14 /**
+3 -1
include/net/checksum.h
··· 18 18 #include <linux/errno.h> 19 19 #include <asm/types.h> 20 20 #include <asm/byteorder.h> 21 - #include <linux/uaccess.h> 22 21 #include <asm/checksum.h> 22 + #if !defined(_HAVE_ARCH_COPY_AND_CSUM_FROM_USER) || !defined(HAVE_CSUM_COPY_USER) 23 + #include <linux/uaccess.h> 24 + #endif 23 25 24 26 #ifndef _HAVE_ARCH_COPY_AND_CSUM_FROM_USER 25 27 static __always_inline