diff mbox series

net/llc/llc_conn.c: fix 4 instances of -Wmissing-variable-declarations

Message ID 20230808-llc_static-v1-1-c140c4c297e4@google.com (mailing list archive)
State Accepted
Commit fa1891aeb7620b51992d0db86c72c0cd3cf114ab
Delegated to: Netdev Maintainers
Headers show
Series net/llc/llc_conn.c: fix 4 instances of -Wmissing-variable-declarations | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next, async
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1330 this patch: 1330
netdev/cc_maintainers warning 1 maintainers not CCed: kuniyu@amazon.com
netdev/build_clang success Errors and warnings before: 1353 this patch: 1353
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1353 this patch: 1353
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 20 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Nick Desaulniers Aug. 8, 2023, 4:43 p.m. UTC
I'm looking to enable -Wmissing-variable-declarations behind W=1. 0day
bot spotted the following instances:

  net/llc/llc_conn.c:44:5: warning: no previous extern declaration for
  non-static variable 'sysctl_llc2_ack_timeout'
  [-Wmissing-variable-declarations]
  44 | int sysctl_llc2_ack_timeout = LLC2_ACK_TIME * HZ;
     |     ^
  net/llc/llc_conn.c:44:1: note: declare 'static' if the variable is not
  intended to be used outside of this translation unit
  44 | int sysctl_llc2_ack_timeout = LLC2_ACK_TIME * HZ;
     | ^
  net/llc/llc_conn.c:45:5: warning: no previous extern declaration for
  non-static variable 'sysctl_llc2_p_timeout'
  [-Wmissing-variable-declarations]
  45 | int sysctl_llc2_p_timeout = LLC2_P_TIME * HZ;
     |     ^
  net/llc/llc_conn.c:45:1: note: declare 'static' if the variable is not
  intended to be used outside of this translation unit
  45 | int sysctl_llc2_p_timeout = LLC2_P_TIME * HZ;
     | ^
  net/llc/llc_conn.c:46:5: warning: no previous extern declaration for
  non-static variable 'sysctl_llc2_rej_timeout'
  [-Wmissing-variable-declarations]
  46 | int sysctl_llc2_rej_timeout = LLC2_REJ_TIME * HZ;
     |     ^
  net/llc/llc_conn.c:46:1: note: declare 'static' if the variable is not
  intended to be used outside of this translation unit
  46 | int sysctl_llc2_rej_timeout = LLC2_REJ_TIME * HZ;
     | ^
  net/llc/llc_conn.c:47:5: warning: no previous extern declaration for
  non-static variable 'sysctl_llc2_busy_timeout'
  [-Wmissing-variable-declarations]
  47 | int sysctl_llc2_busy_timeout = LLC2_BUSY_TIME * HZ;
     |     ^
  net/llc/llc_conn.c:47:1: note: declare 'static' if the variable is not
  intended to be used outside of this translation unit
  47 | int sysctl_llc2_busy_timeout = LLC2_BUSY_TIME * HZ;
     | ^

These symbols are referenced by more than one translation unit, so make
include the correct header for their declarations. Finally, sort the
list of includes to help keep them tidy.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/llvm/202308081000.tTL1ElTr-lkp@intel.com/
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
 net/llc/llc_conn.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)


---
base-commit: 14f9643dc90adea074a0ffb7a17d337eafc6a5cc
change-id: 20230808-llc_static-de4dddcc64b4

Best regards,

Comments

Simon Horman Aug. 9, 2023, 12:59 p.m. UTC | #1
+ Kuniyuki Iwashima

On Tue, Aug 08, 2023 at 09:43:09AM -0700, Nick Desaulniers wrote:
> I'm looking to enable -Wmissing-variable-declarations behind W=1. 0day
> bot spotted the following instances:
> 
>   net/llc/llc_conn.c:44:5: warning: no previous extern declaration for
>   non-static variable 'sysctl_llc2_ack_timeout'
>   [-Wmissing-variable-declarations]
>   44 | int sysctl_llc2_ack_timeout = LLC2_ACK_TIME * HZ;
>      |     ^
>   net/llc/llc_conn.c:44:1: note: declare 'static' if the variable is not
>   intended to be used outside of this translation unit
>   44 | int sysctl_llc2_ack_timeout = LLC2_ACK_TIME * HZ;
>      | ^
>   net/llc/llc_conn.c:45:5: warning: no previous extern declaration for
>   non-static variable 'sysctl_llc2_p_timeout'
>   [-Wmissing-variable-declarations]
>   45 | int sysctl_llc2_p_timeout = LLC2_P_TIME * HZ;
>      |     ^
>   net/llc/llc_conn.c:45:1: note: declare 'static' if the variable is not
>   intended to be used outside of this translation unit
>   45 | int sysctl_llc2_p_timeout = LLC2_P_TIME * HZ;
>      | ^
>   net/llc/llc_conn.c:46:5: warning: no previous extern declaration for
>   non-static variable 'sysctl_llc2_rej_timeout'
>   [-Wmissing-variable-declarations]
>   46 | int sysctl_llc2_rej_timeout = LLC2_REJ_TIME * HZ;
>      |     ^
>   net/llc/llc_conn.c:46:1: note: declare 'static' if the variable is not
>   intended to be used outside of this translation unit
>   46 | int sysctl_llc2_rej_timeout = LLC2_REJ_TIME * HZ;
>      | ^
>   net/llc/llc_conn.c:47:5: warning: no previous extern declaration for
>   non-static variable 'sysctl_llc2_busy_timeout'
>   [-Wmissing-variable-declarations]
>   47 | int sysctl_llc2_busy_timeout = LLC2_BUSY_TIME * HZ;
>      |     ^
>   net/llc/llc_conn.c:47:1: note: declare 'static' if the variable is not
>   intended to be used outside of this translation unit
>   47 | int sysctl_llc2_busy_timeout = LLC2_BUSY_TIME * HZ;
>      | ^
> 
> These symbols are referenced by more than one translation unit, so make
> include the correct header for their declarations. Finally, sort the
> list of includes to help keep them tidy.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/llvm/202308081000.tTL1ElTr-lkp@intel.com/
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

Reviewed-by: Simon Horman <horms@kernel.org>

> ---
>  net/llc/llc_conn.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c
> index d037009ee10f..0a3f5e0bec00 100644
> --- a/net/llc/llc_conn.c
> +++ b/net/llc/llc_conn.c
> @@ -14,14 +14,15 @@
>  
>  #include <linux/init.h>
>  #include <linux/slab.h>
> -#include <net/llc_sap.h>
> -#include <net/llc_conn.h>
> -#include <net/sock.h>
> -#include <net/tcp_states.h>
> -#include <net/llc_c_ev.h>
> +#include <net/llc.h>
>  #include <net/llc_c_ac.h>
> +#include <net/llc_c_ev.h>
>  #include <net/llc_c_st.h>
> +#include <net/llc_conn.h>
>  #include <net/llc_pdu.h>
> +#include <net/llc_sap.h>
> +#include <net/sock.h>
> +#include <net/tcp_states.h>
>  
>  #if 0
>  #define dprintk(args...) printk(KERN_DEBUG args)
> 
> ---
> base-commit: 14f9643dc90adea074a0ffb7a17d337eafc6a5cc
> change-id: 20230808-llc_static-de4dddcc64b4
> 
> Best regards,
> -- 
> Nick Desaulniers <ndesaulniers@google.com>
> 
>
Kuniyuki Iwashima Aug. 9, 2023, 3:41 p.m. UTC | #2
From: Simon Horman <horms@kernel.org>
Date: Wed, 9 Aug 2023 14:59:51 +0200
> + Kuniyuki Iwashima

Thanks Simon.

> 
> On Tue, Aug 08, 2023 at 09:43:09AM -0700, Nick Desaulniers wrote:
> > I'm looking to enable -Wmissing-variable-declarations behind W=1. 0day
> > bot spotted the following instances:
> > 
> >   net/llc/llc_conn.c:44:5: warning: no previous extern declaration for
> >   non-static variable 'sysctl_llc2_ack_timeout'
> >   [-Wmissing-variable-declarations]
> >   44 | int sysctl_llc2_ack_timeout = LLC2_ACK_TIME * HZ;
> >      |     ^
> >   net/llc/llc_conn.c:44:1: note: declare 'static' if the variable is not
> >   intended to be used outside of this translation unit
> >   44 | int sysctl_llc2_ack_timeout = LLC2_ACK_TIME * HZ;
> >      | ^
> >   net/llc/llc_conn.c:45:5: warning: no previous extern declaration for
> >   non-static variable 'sysctl_llc2_p_timeout'
> >   [-Wmissing-variable-declarations]
> >   45 | int sysctl_llc2_p_timeout = LLC2_P_TIME * HZ;
> >      |     ^
> >   net/llc/llc_conn.c:45:1: note: declare 'static' if the variable is not
> >   intended to be used outside of this translation unit
> >   45 | int sysctl_llc2_p_timeout = LLC2_P_TIME * HZ;
> >      | ^
> >   net/llc/llc_conn.c:46:5: warning: no previous extern declaration for
> >   non-static variable 'sysctl_llc2_rej_timeout'
> >   [-Wmissing-variable-declarations]
> >   46 | int sysctl_llc2_rej_timeout = LLC2_REJ_TIME * HZ;
> >      |     ^
> >   net/llc/llc_conn.c:46:1: note: declare 'static' if the variable is not
> >   intended to be used outside of this translation unit
> >   46 | int sysctl_llc2_rej_timeout = LLC2_REJ_TIME * HZ;
> >      | ^
> >   net/llc/llc_conn.c:47:5: warning: no previous extern declaration for
> >   non-static variable 'sysctl_llc2_busy_timeout'
> >   [-Wmissing-variable-declarations]
> >   47 | int sysctl_llc2_busy_timeout = LLC2_BUSY_TIME * HZ;
> >      |     ^
> >   net/llc/llc_conn.c:47:1: note: declare 'static' if the variable is not
> >   intended to be used outside of this translation unit
> >   47 | int sysctl_llc2_busy_timeout = LLC2_BUSY_TIME * HZ;
> >      | ^
> > 
> > These symbols are referenced by more than one translation unit, so make
> > include the correct header for their declarations. Finally, sort the
> > list of includes to help keep them tidy.
> > 
> > Reported-by: kernel test robot <lkp@intel.com>
> > Closes: https://lore.kernel.org/llvm/202308081000.tTL1ElTr-lkp@intel.com/
> > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> 
> Reviewed-by: Simon Horman <horms@kernel.org>

Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>

Thanks!

> 
> > ---
> >  net/llc/llc_conn.c | 11 ++++++-----
> >  1 file changed, 6 insertions(+), 5 deletions(-)
> > 
> > diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c
> > index d037009ee10f..0a3f5e0bec00 100644
> > --- a/net/llc/llc_conn.c
> > +++ b/net/llc/llc_conn.c
> > @@ -14,14 +14,15 @@
> >  
> >  #include <linux/init.h>
> >  #include <linux/slab.h>
> > -#include <net/llc_sap.h>
> > -#include <net/llc_conn.h>
> > -#include <net/sock.h>
> > -#include <net/tcp_states.h>
> > -#include <net/llc_c_ev.h>
> > +#include <net/llc.h>
> >  #include <net/llc_c_ac.h>
> > +#include <net/llc_c_ev.h>
> >  #include <net/llc_c_st.h>
> > +#include <net/llc_conn.h>
> >  #include <net/llc_pdu.h>
> > +#include <net/llc_sap.h>
> > +#include <net/sock.h>
> > +#include <net/tcp_states.h>
> >  
> >  #if 0
> >  #define dprintk(args...) printk(KERN_DEBUG args)
> > 
> > ---
> > base-commit: 14f9643dc90adea074a0ffb7a17d337eafc6a5cc
> > change-id: 20230808-llc_static-de4dddcc64b4
> > 
> > Best regards,
> > -- 
> > Nick Desaulniers <ndesaulniers@google.com>
patchwork-bot+netdevbpf@kernel.org Aug. 9, 2023, 11 p.m. UTC | #3
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 08 Aug 2023 09:43:09 -0700 you wrote:
> I'm looking to enable -Wmissing-variable-declarations behind W=1. 0day
> bot spotted the following instances:
> 
>   net/llc/llc_conn.c:44:5: warning: no previous extern declaration for
>   non-static variable 'sysctl_llc2_ack_timeout'
>   [-Wmissing-variable-declarations]
>   44 | int sysctl_llc2_ack_timeout = LLC2_ACK_TIME * HZ;
>      |     ^
>   net/llc/llc_conn.c:44:1: note: declare 'static' if the variable is not
>   intended to be used outside of this translation unit
>   44 | int sysctl_llc2_ack_timeout = LLC2_ACK_TIME * HZ;
>      | ^
>   net/llc/llc_conn.c:45:5: warning: no previous extern declaration for
>   non-static variable 'sysctl_llc2_p_timeout'
>   [-Wmissing-variable-declarations]
>   45 | int sysctl_llc2_p_timeout = LLC2_P_TIME * HZ;
>      |     ^
>   net/llc/llc_conn.c:45:1: note: declare 'static' if the variable is not
>   intended to be used outside of this translation unit
>   45 | int sysctl_llc2_p_timeout = LLC2_P_TIME * HZ;
>      | ^
>   net/llc/llc_conn.c:46:5: warning: no previous extern declaration for
>   non-static variable 'sysctl_llc2_rej_timeout'
>   [-Wmissing-variable-declarations]
>   46 | int sysctl_llc2_rej_timeout = LLC2_REJ_TIME * HZ;
>      |     ^
>   net/llc/llc_conn.c:46:1: note: declare 'static' if the variable is not
>   intended to be used outside of this translation unit
>   46 | int sysctl_llc2_rej_timeout = LLC2_REJ_TIME * HZ;
>      | ^
>   net/llc/llc_conn.c:47:5: warning: no previous extern declaration for
>   non-static variable 'sysctl_llc2_busy_timeout'
>   [-Wmissing-variable-declarations]
>   47 | int sysctl_llc2_busy_timeout = LLC2_BUSY_TIME * HZ;
>      |     ^
>   net/llc/llc_conn.c:47:1: note: declare 'static' if the variable is not
>   intended to be used outside of this translation unit
>   47 | int sysctl_llc2_busy_timeout = LLC2_BUSY_TIME * HZ;
>      | ^
> 
> [...]

Here is the summary with links:
  - net/llc/llc_conn.c: fix 4 instances of -Wmissing-variable-declarations
    https://git.kernel.org/netdev/net-next/c/fa1891aeb762

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c
index d037009ee10f..0a3f5e0bec00 100644
--- a/net/llc/llc_conn.c
+++ b/net/llc/llc_conn.c
@@ -14,14 +14,15 @@ 
 
 #include <linux/init.h>
 #include <linux/slab.h>
-#include <net/llc_sap.h>
-#include <net/llc_conn.h>
-#include <net/sock.h>
-#include <net/tcp_states.h>
-#include <net/llc_c_ev.h>
+#include <net/llc.h>
 #include <net/llc_c_ac.h>
+#include <net/llc_c_ev.h>
 #include <net/llc_c_st.h>
+#include <net/llc_conn.h>
 #include <net/llc_pdu.h>
+#include <net/llc_sap.h>
+#include <net/sock.h>
+#include <net/tcp_states.h>
 
 #if 0
 #define dprintk(args...) printk(KERN_DEBUG args)