diff mbox series

[v1,1/1] wwan: Replace kernel.h with the necessary inclusions

Message ID 20211222163256.66270-1-andriy.shevchenko@linux.intel.com (mailing list archive)
State Accepted
Commit 30be4551f9e26292599e666985119a5b559a2e4a
Headers show
Series [v1,1/1] wwan: Replace kernel.h with the necessary inclusions | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch, async

Commit Message

Andy Shevchenko Dec. 22, 2021, 4:32 p.m. UTC
When kernel.h is used in the headers it adds a lot into dependency hell,
especially when there are circular dependencies are involved.

Replace kernel.h inclusion with the list of what is really being used.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 include/linux/wwan.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Sergey Ryazanov Dec. 22, 2021, 8:38 p.m. UTC | #1
On Wed, Dec 22, 2021 at 7:32 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> When kernel.h is used in the headers it adds a lot into dependency hell,
> especially when there are circular dependencies are involved.
>
> Replace kernel.h inclusion with the list of what is really being used.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Subject and description do not cover cleanup of includes besides the
kernel.h. But that does not seem like a big issue, so:

Reviewed-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Andy Shevchenko Dec. 23, 2021, 10:14 a.m. UTC | #2
On Wed, Dec 22, 2021 at 11:38:44PM +0300, Sergey Ryazanov wrote:
> On Wed, Dec 22, 2021 at 7:32 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > When kernel.h is used in the headers it adds a lot into dependency hell,
> > especially when there are circular dependencies are involved.
> >
> > Replace kernel.h inclusion with the list of what is really being used.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Subject and description do not cover cleanup of includes besides the
> kernel.h. But that does not seem like a big issue, so:

Not sure what it's supposed from me to do. The forward declarations are
the tighten part of the cleanup (*) and it's exactly what is happening here,
i.e.  replacing kernel.h "with the list of what is really being used".

*) Either you need a header, or you need a forward declaration, or rely on
   the compiler not to be so strict. I prefer the second option out of three.

> Reviewed-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>

Thanks!
Andy Shevchenko Dec. 23, 2021, 10:16 a.m. UTC | #3
On Thu, Dec 23, 2021 at 12:14:09PM +0200, Andy Shevchenko wrote:
> On Wed, Dec 22, 2021 at 11:38:44PM +0300, Sergey Ryazanov wrote:
> > On Wed, Dec 22, 2021 at 7:32 PM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:

...

> Not sure what it's supposed from me to do. The forward declarations are
> the tighten part of the cleanup (*) and it's exactly what is happening here,
> i.e.  replacing kernel.h "with the list of what is really being used".
> 
> *) Either you need a header, or you need a forward declaration, or rely on
>    the compiler not to be so strict. I prefer the second option out of three.

Ah, seems indeed the skbuf and netdevice ones can be split. Do you want me to
resend as series of two?

(Sorry I have sent many similar changes and haven't remembered by heart where
 I did what exactly, but here it looks natural to cleanup that stuff at the
 same time, so the question is if it should be a separate change or not)
Sergey Ryazanov Dec. 23, 2021, 10:46 a.m. UTC | #4
On Thu, Dec 23, 2021 at 1:18 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Thu, Dec 23, 2021 at 12:14:09PM +0200, Andy Shevchenko wrote:
>> On Wed, Dec 22, 2021 at 11:38:44PM +0300, Sergey Ryazanov wrote:
>>> On Wed, Dec 22, 2021 at 7:32 PM Andy Shevchenko
>>> <andriy.shevchenko@linux.intel.com> wrote:
>
> ...
>
>> Not sure what it's supposed from me to do. The forward declarations are
>> the tighten part of the cleanup (*) and it's exactly what is happening here,
>> i.e.  replacing kernel.h "with the list of what is really being used".
>>
>> *) Either you need a header, or you need a forward declaration, or rely on
>>    the compiler not to be so strict. I prefer the second option out of three.
>
> Ah, seems indeed the skbuf and netdevice ones can be split. Do you want me to
> resend as series of two?

No. The single patch cleanup looks pretty good.

It might be worth pointing out in the commit message that the other
included headers were removed as they indirectly include the kernel.h
header. This will be helpful for future readers. But I don’t think
such a comment is worth a patch update. So I am Ok if this patch will
be applied as is.

> (Sorry I have sent many similar changes and haven't remembered by heart where
>  I did what exactly, but here it looks natural to cleanup that stuff at the
>  same time, so the question is if it should be a separate change or not)

The patch looks good. Thank you for this hard cleanup work!
patchwork-bot+netdevbpf@kernel.org Dec. 23, 2021, 11:30 a.m. UTC | #5
Hello:

This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Wed, 22 Dec 2021 18:32:56 +0200 you wrote:
> When kernel.h is used in the headers it adds a lot into dependency hell,
> especially when there are circular dependencies are involved.
> 
> Replace kernel.h inclusion with the list of what is really being used.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> [...]

Here is the summary with links:
  - [v1,1/1] wwan: Replace kernel.h with the necessary inclusions
    https://git.kernel.org/netdev/net-next/c/30be4551f9e2

You are awesome, thank you!
diff mbox series

Patch

diff --git a/include/linux/wwan.h b/include/linux/wwan.h
index e143c88bf4b0..afb3334ec8c5 100644
--- a/include/linux/wwan.h
+++ b/include/linux/wwan.h
@@ -4,12 +4,9 @@ 
 #ifndef __WWAN_H
 #define __WWAN_H
 
-#include <linux/device.h>
-#include <linux/kernel.h>
 #include <linux/poll.h>
-#include <linux/skbuff.h>
-#include <linux/netlink.h>
 #include <linux/netdevice.h>
+#include <linux/types.h>
 
 /**
  * enum wwan_port_type - WWAN port types
@@ -37,6 +34,10 @@  enum wwan_port_type {
 	WWAN_PORT_UNKNOWN,
 };
 
+struct device;
+struct file;
+struct netlink_ext_ack;
+struct sk_buff;
 struct wwan_port;
 
 /** struct wwan_port_ops - The WWAN port operations