diff mbox series

[net-next] tun: add __exit annotations to module exit func tun_cleanup()

Message ID 20230814083000.3893589-1-william.xuanziyang@huawei.com (mailing list archive)
State Accepted
Commit b2f8323364abf1b6fcd828851ea8be2f757c052a
Delegated to: Netdev Maintainers
Headers show
Series [net-next] tun: add __exit annotations to module exit func tun_cleanup() | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
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 success CCed 7 of 7 maintainers
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, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Ziyang Xuan (William) Aug. 14, 2023, 8:30 a.m. UTC
Add missing __exit annotations to module exit func tun_cleanup().

Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
---
 drivers/net/tun.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Leon Romanovsky Aug. 14, 2023, 10:17 a.m. UTC | #1
On Mon, Aug 14, 2023 at 04:30:00PM +0800, Ziyang Xuan wrote:
> Add missing __exit annotations to module exit func tun_cleanup().
> 
> Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
> ---
>  drivers/net/tun.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index 973b2fc74de3..291c118579a9 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -3740,7 +3740,7 @@ static int __init tun_init(void)
>  	return ret;
>  }
>  
> -static void tun_cleanup(void)
> +static void __exit tun_cleanup(void)

Why __exit and not __net_exit?

Thanks

>  {
>  	misc_deregister(&tun_miscdev);
>  	rtnl_link_unregister(&tun_link_ops);
> -- 
> 2.25.1
> 
>
Ziyang Xuan (William) Aug. 14, 2023, 11:27 a.m. UTC | #2
> On Mon, Aug 14, 2023 at 04:30:00PM +0800, Ziyang Xuan wrote:
>> Add missing __exit annotations to module exit func tun_cleanup().
>>
>> Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
>> ---
>>  drivers/net/tun.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
>> index 973b2fc74de3..291c118579a9 100644
>> --- a/drivers/net/tun.c
>> +++ b/drivers/net/tun.c
>> @@ -3740,7 +3740,7 @@ static int __init tun_init(void)
>>  	return ret;
>>  }
>>  
>> -static void tun_cleanup(void)
>> +static void __exit tun_cleanup(void)
> 
> Why __exit and not __net_exit?

tun_cleanup() is a module exit function. it corresponds to tun_init().
tun_init() uses __init, so tun_cleanup() uses __exit.

Thank you!
William Xuan
> 
> Thanks
> 
>>  {
>>  	misc_deregister(&tun_miscdev);
>>  	rtnl_link_unregister(&tun_link_ops);
>> -- 
>> 2.25.1
>>
>>
> .
>
Leon Romanovsky Aug. 14, 2023, 12:05 p.m. UTC | #3
On Mon, Aug 14, 2023 at 07:27:59PM +0800, Ziyang Xuan (William) wrote:
> > On Mon, Aug 14, 2023 at 04:30:00PM +0800, Ziyang Xuan wrote:
> >> Add missing __exit annotations to module exit func tun_cleanup().
> >>
> >> Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
> >> ---
> >>  drivers/net/tun.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> >> index 973b2fc74de3..291c118579a9 100644
> >> --- a/drivers/net/tun.c
> >> +++ b/drivers/net/tun.c
> >> @@ -3740,7 +3740,7 @@ static int __init tun_init(void)
> >>  	return ret;
> >>  }
> >>  
> >> -static void tun_cleanup(void)
> >> +static void __exit tun_cleanup(void)
> > 
> > Why __exit and not __net_exit?
> 
> tun_cleanup() is a module exit function. it corresponds to tun_init().
> tun_init() uses __init, so tun_cleanup() uses __exit.

__net_init is equal to __init.

> 
> Thank you!
> William Xuan
> > 
> > Thanks
> > 
> >>  {
> >>  	misc_deregister(&tun_miscdev);
> >>  	rtnl_link_unregister(&tun_link_ops);
> >> -- 
> >> 2.25.1
> >>
> >>
> > .
> >
Ziyang Xuan (William) Aug. 14, 2023, 12:23 p.m. UTC | #4
> On Mon, Aug 14, 2023 at 07:27:59PM +0800, Ziyang Xuan (William) wrote:
>>> On Mon, Aug 14, 2023 at 04:30:00PM +0800, Ziyang Xuan wrote:
>>>> Add missing __exit annotations to module exit func tun_cleanup().
>>>>
>>>> Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
>>>> ---
>>>>  drivers/net/tun.c | 2 +-
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
>>>> index 973b2fc74de3..291c118579a9 100644
>>>> --- a/drivers/net/tun.c
>>>> +++ b/drivers/net/tun.c
>>>> @@ -3740,7 +3740,7 @@ static int __init tun_init(void)
>>>>  	return ret;
>>>>  }
>>>>  
>>>> -static void tun_cleanup(void)
>>>> +static void __exit tun_cleanup(void)
>>>
>>> Why __exit and not __net_exit?
>>
>> tun_cleanup() is a module exit function. it corresponds to tun_init().
>> tun_init() uses __init, so tun_cleanup() uses __exit.
> 
> __net_init is equal to __init.

That is not. They are equal when CONFIG_NET_NS is not enabled.
Refer to the definition of __net_init and __net_eixt in include/net/net_namespace.h.

> 
>>
>> Thank you!
>> William Xuan
>>>
>>> Thanks
>>>
>>>>  {
>>>>  	misc_deregister(&tun_miscdev);
>>>>  	rtnl_link_unregister(&tun_link_ops);
>>>> -- 
>>>> 2.25.1
>>>>
>>>>
>>> .
>>>
> .
>
Leon Romanovsky Aug. 14, 2023, 12:32 p.m. UTC | #5
On Mon, Aug 14, 2023 at 08:23:37PM +0800, Ziyang Xuan (William) wrote:
> > On Mon, Aug 14, 2023 at 07:27:59PM +0800, Ziyang Xuan (William) wrote:
> >>> On Mon, Aug 14, 2023 at 04:30:00PM +0800, Ziyang Xuan wrote:
> >>>> Add missing __exit annotations to module exit func tun_cleanup().
> >>>>
> >>>> Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
> >>>> ---
> >>>>  drivers/net/tun.c | 2 +-
> >>>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>>
> >>>> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> >>>> index 973b2fc74de3..291c118579a9 100644
> >>>> --- a/drivers/net/tun.c
> >>>> +++ b/drivers/net/tun.c
> >>>> @@ -3740,7 +3740,7 @@ static int __init tun_init(void)
> >>>>  	return ret;
> >>>>  }
> >>>>  
> >>>> -static void tun_cleanup(void)
> >>>> +static void __exit tun_cleanup(void)
> >>>
> >>> Why __exit and not __net_exit?
> >>
> >> tun_cleanup() is a module exit function. it corresponds to tun_init().
> >> tun_init() uses __init, so tun_cleanup() uses __exit.
> > 
> > __net_init is equal to __init.
> 
> That is not. They are equal when CONFIG_NET_NS is not enabled.
> Refer to the definition of __net_init and __net_eixt in include/net/net_namespace.h.

Right, thanks
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
patchwork-bot+netdevbpf@kernel.org Aug. 18, 2023, 2:20 a.m. UTC | #6
Hello:

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

On Mon, 14 Aug 2023 16:30:00 +0800 you wrote:
> Add missing __exit annotations to module exit func tun_cleanup().
> 
> Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
> ---
>  drivers/net/tun.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
  - [net-next] tun: add __exit annotations to module exit func tun_cleanup()
    https://git.kernel.org/netdev/net-next/c/b2f8323364ab

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 973b2fc74de3..291c118579a9 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -3740,7 +3740,7 @@  static int __init tun_init(void)
 	return ret;
 }
 
-static void tun_cleanup(void)
+static void __exit tun_cleanup(void)
 {
 	misc_deregister(&tun_miscdev);
 	rtnl_link_unregister(&tun_link_ops);