linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] net/ipv4/sysctl_net_ipv4.c: remove superfluous header files from sysctl_net_ipv4.c
@ 2021-09-20 13:42 Mianhan Liu
  2021-09-20 21:02 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Mianhan Liu @ 2021-09-20 13:42 UTC (permalink / raw)
  To: David S. Miller, Hideaki YOSHIFUJI, David Ahern
  Cc: Jakub Kicinski, netdev, linux-kernel, Mianhan Liu

sysctl_net_ipv4.c hasn't use any macro or function declared in mm.h, module.h,
igmp.h, inetdevice.h, swap.h, slab.h, nsproxy.h, snmp.h, route.h and inet_frag.h. 
Thus, these files can be removed from sysctl_net_ipv4.c safely without affecting
the compilation of the net module.

Signed-off-by: Mianhan Liu <liumh1@shanghaitech.edu.cn>

---
 net/ipv4/sysctl_net_ipv4.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 6f1e64d49..f8e39d00b 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -6,25 +6,15 @@
  * Added /proc/sys/net/ipv4 directory entry (empty =) ). [MS]
  */
 
-#include <linux/mm.h>
-#include <linux/module.h>
 #include <linux/sysctl.h>
-#include <linux/igmp.h>
-#include <linux/inetdevice.h>
 #include <linux/seqlock.h>
 #include <linux/init.h>
-#include <linux/slab.h>
-#include <linux/nsproxy.h>
-#include <linux/swap.h>
-#include <net/snmp.h>
 #include <net/icmp.h>
 #include <net/ip.h>
 #include <net/ip_fib.h>
-#include <net/route.h>
 #include <net/tcp.h>
 #include <net/udp.h>
 #include <net/cipso_ipv4.h>
-#include <net/inet_frag.h>
 #include <net/ping.h>
 #include <net/protocol.h>
 #include <net/netevent.h>
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] net/ipv4/sysctl_net_ipv4.c: remove superfluous header files from sysctl_net_ipv4.c
  2021-09-20 13:42 [PATCH -next] net/ipv4/sysctl_net_ipv4.c: remove superfluous header files from sysctl_net_ipv4.c Mianhan Liu
@ 2021-09-20 21:02 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2021-09-20 21:02 UTC (permalink / raw)
  To: Mianhan Liu
  Cc: David S. Miller, Hideaki YOSHIFUJI, David Ahern, netdev, linux-kernel

On Mon, 20 Sep 2021 21:42:00 +0800 Mianhan Liu wrote:
> sysctl_net_ipv4.c hasn't use any macro or function declared in mm.h, module.h,
> igmp.h, inetdevice.h, swap.h, slab.h, nsproxy.h, snmp.h, route.h and inet_frag.h. 
> Thus, these files can be removed from sysctl_net_ipv4.c safely without affecting
> the compilation of the net module.

How did you arrive at this conclusion? It certainly uses linux/slab.h
as it calls kmalloc(). Please don't introduce dependencies on
second-order includes. If file uses a function, define, struct etc.
from a header it should directly include that header. Just because the
code still compiles doesn't mean the change is for good.

> diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
> index 6f1e64d49..f8e39d00b 100644
> --- a/net/ipv4/sysctl_net_ipv4.c
> +++ b/net/ipv4/sysctl_net_ipv4.c
> @@ -6,25 +6,15 @@
>   * Added /proc/sys/net/ipv4 directory entry (empty =) ). [MS]
>   */
>  
> -#include <linux/mm.h>
> -#include <linux/module.h>
>  #include <linux/sysctl.h>
> -#include <linux/igmp.h>
> -#include <linux/inetdevice.h>
>  #include <linux/seqlock.h>
>  #include <linux/init.h>
> -#include <linux/slab.h>
> -#include <linux/nsproxy.h>
> -#include <linux/swap.h>
> -#include <net/snmp.h>
>  #include <net/icmp.h>
>  #include <net/ip.h>
>  #include <net/ip_fib.h>
> -#include <net/route.h>
>  #include <net/tcp.h>
>  #include <net/udp.h>
>  #include <net/cipso_ipv4.h>
> -#include <net/inet_frag.h>
>  #include <net/ping.h>
>  #include <net/protocol.h>
>  #include <net/netevent.h>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-20 21:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-20 13:42 [PATCH -next] net/ipv4/sysctl_net_ipv4.c: remove superfluous header files from sysctl_net_ipv4.c Mianhan Liu
2021-09-20 21:02 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).