All of lore.kernel.org
 help / color / mirror / Atom feed
From: dust.li <dust.li@linux.alibaba.com>
To: kbuild-all@lists.01.org
Subject: Re: [saeed:net-next 154/185] net/smc/smc_sysctl.h:23:16: warning: no previous prototype for 'smc_sysctl_net_init'
Date: Tue, 08 Mar 2022 14:24:04 +0800	[thread overview]
Message-ID: <20220308062404.GG35207@linux.alibaba.com> (raw)
In-Reply-To: <20220307212520.176fce24@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>

[-- Attachment #1: Type: text/plain, Size: 2373 bytes --]

On Mon, Mar 07, 2022 at 09:25:20PM -0800, Jakub Kicinski wrote:
>On Tue, 8 Mar 2022 13:16:55 +0800 dust.li wrote:
>> >vim +/smc_sysctl_net_init +23 net/smc/smc_sysctl.h
>> >
>> >    22	  
>> >  > 23	int __net_init smc_sysctl_net_init(struct net *net)  
>> >    24	{
>> >    25		net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE;
>> >    26		return 0;
>> >    27	}
>> >    28	  
>> >  > 29	void __net_exit smc_sysctl_net_exit(struct net *net) { }  
>> >    30	  
>> 
>> Hi Jakub:
>> 
>> Sorry to bother again on this !
>> Looks like we still need to add 'static inline' or add an extra
>> declaration for these 2 functions if we want to get rid of these warnings.
>> What do you think ?
>
>Sorry my comment was pretty unclear an unnecessary.
>
>I meant that you don't need the __net_init annotation, it still 
>needs to be a static inline. So this is what I meant:

Ah, I see. Thanks for your detailed explanation.
I will post another fix.

>
>diff --git a/net/smc/smc_sysctl.h b/net/smc/smc_sysctl.h
>index 1d554300604d..0becc11bd2f4 100644
>--- a/net/smc/smc_sysctl.h
>+++ b/net/smc/smc_sysctl.h
>@@ -20,13 +20,13 @@ void __net_exit smc_sysctl_net_exit(struct net *net);
> 
> #else
> 
>-int __net_init smc_sysctl_net_init(struct net *net)
>+static inline int smc_sysctl_net_init(struct net *net)
> {
>        net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE;
>        return 0;
> }
> 
>-void __net_exit smc_sysctl_net_exit(struct net *net) { }
>+static inline void smc_sysctl_net_exit(struct net *net) { }
> 
> #endif /* CONFIG_SYSCTL */
>
>
>
>But really it does not matter if the __net_init / exit is there, 
>so this works too:
>
>diff --git a/net/smc/smc_sysctl.h b/net/smc/smc_sysctl.h
>index 1d554300604d..6979e7173669 100644
>--- a/net/smc/smc_sysctl.h
>+++ b/net/smc/smc_sysctl.h
>@@ -20,13 +20,13 @@ void __net_exit smc_sysctl_net_exit(struct net *net);
> 
> #else
> 
>-int __net_init smc_sysctl_net_init(struct net *net)
>+static inline int __net_init smc_sysctl_net_init(struct net *net)
> {
>        net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE;
>        return 0;
> }
> 
>-void __net_exit smc_sysctl_net_exit(struct net *net) { }
>+static inline void __net_exit smc_sysctl_net_exit(struct net *net) { }
> 
> #endif /* CONFIG_SYSCTL */
> 

WARNING: multiple messages have this Message-ID (diff)
From: "dust.li" <dust.li@linux.alibaba.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: kernel test robot <lkp@intel.com>,
	kbuild-all@lists.01.org, linux-kernel@vger.kernel.org
Subject: Re: [saeed:net-next 154/185] net/smc/smc_sysctl.h:23:16: warning: no previous prototype for 'smc_sysctl_net_init'
Date: Tue, 8 Mar 2022 14:24:04 +0800	[thread overview]
Message-ID: <20220308062404.GG35207@linux.alibaba.com> (raw)
In-Reply-To: <20220307212520.176fce24@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>

On Mon, Mar 07, 2022 at 09:25:20PM -0800, Jakub Kicinski wrote:
>On Tue, 8 Mar 2022 13:16:55 +0800 dust.li wrote:
>> >vim +/smc_sysctl_net_init +23 net/smc/smc_sysctl.h
>> >
>> >    22	  
>> >  > 23	int __net_init smc_sysctl_net_init(struct net *net)  
>> >    24	{
>> >    25		net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE;
>> >    26		return 0;
>> >    27	}
>> >    28	  
>> >  > 29	void __net_exit smc_sysctl_net_exit(struct net *net) { }  
>> >    30	  
>> 
>> Hi Jakub:
>> 
>> Sorry to bother again on this !
>> Looks like we still need to add 'static inline' or add an extra
>> declaration for these 2 functions if we want to get rid of these warnings.
>> What do you think ?
>
>Sorry my comment was pretty unclear an unnecessary.
>
>I meant that you don't need the __net_init annotation, it still 
>needs to be a static inline. So this is what I meant:

Ah, I see. Thanks for your detailed explanation.
I will post another fix.

>
>diff --git a/net/smc/smc_sysctl.h b/net/smc/smc_sysctl.h
>index 1d554300604d..0becc11bd2f4 100644
>--- a/net/smc/smc_sysctl.h
>+++ b/net/smc/smc_sysctl.h
>@@ -20,13 +20,13 @@ void __net_exit smc_sysctl_net_exit(struct net *net);
> 
> #else
> 
>-int __net_init smc_sysctl_net_init(struct net *net)
>+static inline int smc_sysctl_net_init(struct net *net)
> {
>        net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE;
>        return 0;
> }
> 
>-void __net_exit smc_sysctl_net_exit(struct net *net) { }
>+static inline void smc_sysctl_net_exit(struct net *net) { }
> 
> #endif /* CONFIG_SYSCTL */
>
>
>
>But really it does not matter if the __net_init / exit is there, 
>so this works too:
>
>diff --git a/net/smc/smc_sysctl.h b/net/smc/smc_sysctl.h
>index 1d554300604d..6979e7173669 100644
>--- a/net/smc/smc_sysctl.h
>+++ b/net/smc/smc_sysctl.h
>@@ -20,13 +20,13 @@ void __net_exit smc_sysctl_net_exit(struct net *net);
> 
> #else
> 
>-int __net_init smc_sysctl_net_init(struct net *net)
>+static inline int __net_init smc_sysctl_net_init(struct net *net)
> {
>        net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE;
>        return 0;
> }
> 
>-void __net_exit smc_sysctl_net_exit(struct net *net) { }
>+static inline void __net_exit smc_sysctl_net_exit(struct net *net) { }
> 
> #endif /* CONFIG_SYSCTL */
> 

  reply	other threads:[~2022-03-08  6:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08  2:43 [saeed:net-next 154/185] net/smc/smc_sysctl.h:23:16: warning: no previous prototype for 'smc_sysctl_net_init' kernel test robot
2022-03-08  5:16 ` dust.li
2022-03-08  5:16   ` dust.li
2022-03-08  5:25   ` Jakub Kicinski
2022-03-08  5:25     ` Jakub Kicinski
2022-03-08  6:24     ` dust.li [this message]
2022-03-08  6:24       ` dust.li
2022-03-09  3:30     ` dust.li
2022-03-09  3:30       ` dust.li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220308062404.GG35207@linux.alibaba.com \
    --to=dust.li@linux.alibaba.com \
    --cc=kbuild-all@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.