diff mbox series

packet: Don't include <linux/rculist.h>

Message ID adc33d6c7dd01e29c848b9519b6a601219ba6780.1670086158.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series packet: Don't include <linux/rculist.h> | expand

Checks

Context Check Description
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 4555 this patch: 4555
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 1094 this patch: 1094
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
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: 4737 this patch: 4737
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Christophe JAILLET Dec. 3, 2022, 4:49 p.m. UTC
There is no need to include <linux/rculist.h> here.

Prefer the less invasive <linux/types.h> which is needed for 'hlist_head'.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Let see if build-bots agree with me!

Just declaring 'struct mutex' and 'struct hlist_head' would also be an
option.
It would remove the need of any include, but is more likely to break
something.
---
 include/net/netns/packet.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eric Dumazet Dec. 5, 2022, 5:24 a.m. UTC | #1
On Sat, Dec 3, 2022 at 5:49 PM Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
>
> There is no need to include <linux/rculist.h> here.
>
> Prefer the less invasive <linux/types.h> which is needed for 'hlist_head'.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Let see if build-bots agree with me!
>

net/packet/af_packet.c does not explicitly include linux/rculist.h

It might be provided by include/linux/netdevice.h, but I wonder if
this is best practice.

> Just declaring 'struct mutex' and 'struct hlist_head' would also be an
> option.

I do not get it, see [1]

> It would remove the need of any include, but is more likely to break
> something.

I do not see why you are even trying this ?

> ---
>  include/net/netns/packet.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/net/netns/packet.h b/include/net/netns/packet.h
> index aae69bb43cde..74750865df36 100644
> --- a/include/net/netns/packet.h
> +++ b/include/net/netns/packet.h
> @@ -5,8 +5,8 @@
>  #ifndef __NETNS_PACKET_H__
>  #define __NETNS_PACKET_H__
>
> -#include <linux/rculist.h>
>  #include <linux/mutex.h>
> +#include <linux/types.h>
>
>  struct netns_packet {
>         struct mutex            sklist_lock;

[1] Definition of 'struct mutex' is definitely needed here.

> --
> 2.34.1
>
Christophe JAILLET Dec. 7, 2022, 6:29 a.m. UTC | #2
Le 05/12/2022 à 06:24, Eric Dumazet a écrit :
> On Sat, Dec 3, 2022 at 5:49 PM Christophe JAILLET
> <christophe.jaillet@wanadoo.fr> wrote:
>>
>> There is no need to include <linux/rculist.h> here.
>>
>> Prefer the less invasive <linux/types.h> which is needed for 'hlist_head'.
>>
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>> Let see if build-bots agree with me!
>>
> 
> net/packet/af_packet.c does not explicitly include linux/rculist.h
> 
> It might be provided by include/linux/netdevice.h, but I wonder if
> this is best practice.

At least, it is not what I expect.

My goal is to avoid some unneeded includes AND the related indirect 
needed includes that are buried somewhere in the dependency hell.

I missed the one in af_packet.c

I'll repost a v2 with the fix for af_packet.c (and double-check if some 
other are also needed)

> 
>> Just declaring 'struct mutex' and 'struct hlist_head' would also be an
>> option.
> 
> I do not get it, see [1]

Just forget about it.

Requirement for:
    struct my_struct {
           struct another_struct            x;

and
    struct my_struct {
           struct another_struct            *x;
                                           ~~~
are not the same, even if 'my_struct' is not used at all...

(*ashamed *)

CJ

> 
>> It would remove the need of any include, but is more likely to break
>> something.
> 
> I do not see why you are even trying this ?
> 
>> ---
>>   include/net/netns/packet.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/net/netns/packet.h b/include/net/netns/packet.h
>> index aae69bb43cde..74750865df36 100644
>> --- a/include/net/netns/packet.h
>> +++ b/include/net/netns/packet.h
>> @@ -5,8 +5,8 @@
>>   #ifndef __NETNS_PACKET_H__
>>   #define __NETNS_PACKET_H__
>>
>> -#include <linux/rculist.h>
>>   #include <linux/mutex.h>
>> +#include <linux/types.h>
>>
>>   struct netns_packet {
>>          struct mutex            sklist_lock;
> 
> [1] Definition of 'struct mutex' is definitely needed here.
> 
>> --
>> 2.34.1
>>
>
diff mbox series

Patch

diff --git a/include/net/netns/packet.h b/include/net/netns/packet.h
index aae69bb43cde..74750865df36 100644
--- a/include/net/netns/packet.h
+++ b/include/net/netns/packet.h
@@ -5,8 +5,8 @@ 
 #ifndef __NETNS_PACKET_H__
 #define __NETNS_PACKET_H__
 
-#include <linux/rculist.h>
 #include <linux/mutex.h>
+#include <linux/types.h>
 
 struct netns_packet {
 	struct mutex		sklist_lock;