* [PATCH net-next] add missing includes and forward declarations to networking includes under linux/
@ 2022-07-23 4:57 Jakub Kicinski
2022-07-26 10:00 ` Paolo Abeni
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2022-07-23 4:57 UTC (permalink / raw)
To: davem; +Cc: netdev, edumazet, pabeni, Jakub Kicinski
Similarly to a recent include/net/ cleanup, this patch adds
missing includes to networking headers under include/linux.
All these problems are currently masked by the existing users
including the missing dependency before the broken header.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
include/linux/atm_tcp.h | 3 +++
include/linux/dsa/tag_qca.h | 6 ++++++
include/linux/hippidevice.h | 4 ++++
include/linux/if_eql.h | 1 +
include/linux/if_hsr.h | 4 ++++
include/linux/if_rmnet.h | 2 ++
include/linux/if_tap.h | 2 ++
include/linux/mdio/mdio-xgene.h | 4 ++++
include/linux/nl802154.h | 2 ++
include/linux/phy_fixed.h | 3 +++
include/linux/ppp-comp.h | 2 +-
include/linux/ppp_channel.h | 2 ++
include/linux/ptp_kvm.h | 2 ++
include/linux/ptp_pch.h | 4 ++++
include/linux/seq_file_net.h | 1 +
include/linux/sungem_phy.h | 2 ++
include/linux/usb/usbnet.h | 6 ++++++
include/net/llc_s_st.h | 6 ++++++
18 files changed, 55 insertions(+), 1 deletion(-)
diff --git a/include/linux/atm_tcp.h b/include/linux/atm_tcp.h
index c8ecf6f68fb5..ba4fe690bff0 100644
--- a/include/linux/atm_tcp.h
+++ b/include/linux/atm_tcp.h
@@ -9,6 +9,9 @@
#include <uapi/linux/atm_tcp.h>
+struct atm_tcp_ops;
+struct atm_vcc;
+struct module;
struct atm_tcp_ops {
int (*attach)(struct atm_vcc *vcc,int itf);
diff --git a/include/linux/dsa/tag_qca.h b/include/linux/dsa/tag_qca.h
index 4359fb0221cf..e357df561e55 100644
--- a/include/linux/dsa/tag_qca.h
+++ b/include/linux/dsa/tag_qca.h
@@ -3,6 +3,12 @@
#ifndef __TAG_QCA_H
#define __TAG_QCA_H
+#include <linux/types.h>
+
+struct dsa_switch;
+struct net_device;
+struct sk_buff;
+
#define QCA_HDR_LEN 2
#define QCA_HDR_VERSION 0x2
diff --git a/include/linux/hippidevice.h b/include/linux/hippidevice.h
index 9dc01f7ab5b4..07414c241e65 100644
--- a/include/linux/hippidevice.h
+++ b/include/linux/hippidevice.h
@@ -23,6 +23,10 @@
#ifdef __KERNEL__
+struct neigh_parms;
+struct net_device;
+struct sk_buff;
+
struct hippi_cb {
__u32 ifield;
};
diff --git a/include/linux/if_eql.h b/include/linux/if_eql.h
index d75601d613cc..07f9b660b741 100644
--- a/include/linux/if_eql.h
+++ b/include/linux/if_eql.h
@@ -21,6 +21,7 @@
#include <linux/timer.h>
#include <linux/spinlock.h>
+#include <net/net_trackers.h>
#include <uapi/linux/if_eql.h>
typedef struct slave {
diff --git a/include/linux/if_hsr.h b/include/linux/if_hsr.h
index 408539d5ea5f..0404f5bf4f30 100644
--- a/include/linux/if_hsr.h
+++ b/include/linux/if_hsr.h
@@ -2,6 +2,10 @@
#ifndef _LINUX_IF_HSR_H_
#define _LINUX_IF_HSR_H_
+#include <linux/types.h>
+
+struct net_device;
+
/* used to differentiate various protocols */
enum hsr_version {
HSR_V0 = 0,
diff --git a/include/linux/if_rmnet.h b/include/linux/if_rmnet.h
index 10e7521ecb6c..839d1e48b85e 100644
--- a/include/linux/if_rmnet.h
+++ b/include/linux/if_rmnet.h
@@ -5,6 +5,8 @@
#ifndef _LINUX_IF_RMNET_H_
#define _LINUX_IF_RMNET_H_
+#include <linux/types.h>
+
struct rmnet_map_header {
u8 flags; /* MAP_CMD_FLAG, MAP_PAD_LEN_MASK */
u8 mux_id;
diff --git a/include/linux/if_tap.h b/include/linux/if_tap.h
index 915a187cfabd..f21f87952b20 100644
--- a/include/linux/if_tap.h
+++ b/include/linux/if_tap.h
@@ -2,6 +2,8 @@
#ifndef _LINUX_IF_TAP_H_
#define _LINUX_IF_TAP_H_
+struct file;
+
#if IS_ENABLED(CONFIG_TAP)
struct socket *tap_get_socket(struct file *);
struct ptr_ring *tap_get_ptr_ring(struct file *file);
diff --git a/include/linux/mdio/mdio-xgene.h b/include/linux/mdio/mdio-xgene.h
index 8af93ada8b64..9e588965dc83 100644
--- a/include/linux/mdio/mdio-xgene.h
+++ b/include/linux/mdio/mdio-xgene.h
@@ -8,6 +8,10 @@
#ifndef __MDIO_XGENE_H__
#define __MDIO_XGENE_H__
+#include <linux/bits.h>
+#include <linux/spinlock.h>
+#include <linux/types.h>
+
#define BLOCK_XG_MDIO_CSR_OFFSET 0x5000
#define BLOCK_DIAG_CSR_OFFSET 0xd000
#define XGENET_CONFIG_REG_ADDR 0x20
diff --git a/include/linux/nl802154.h b/include/linux/nl802154.h
index b22782225f27..cbe5fd1dd2e7 100644
--- a/include/linux/nl802154.h
+++ b/include/linux/nl802154.h
@@ -8,6 +8,8 @@
#ifndef NL802154_H
#define NL802154_H
+#include <net/netlink.h>
+
#define IEEE802154_NL_NAME "802.15.4 MAC"
#define IEEE802154_MCAST_COORD_NAME "coordinator"
#define IEEE802154_MCAST_BEACON_NAME "beacon"
diff --git a/include/linux/phy_fixed.h b/include/linux/phy_fixed.h
index 52bc8e487ef7..1acafd86ab13 100644
--- a/include/linux/phy_fixed.h
+++ b/include/linux/phy_fixed.h
@@ -2,6 +2,8 @@
#ifndef __PHY_FIXED_H
#define __PHY_FIXED_H
+#include <linux/types.h>
+
struct fixed_phy_status {
int link;
int speed;
@@ -12,6 +14,7 @@ struct fixed_phy_status {
struct device_node;
struct gpio_desc;
+struct net_device;
#if IS_ENABLED(CONFIG_FIXED_PHY)
extern int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier);
diff --git a/include/linux/ppp-comp.h b/include/linux/ppp-comp.h
index 9d3ffc8f5ea6..fb847e47f148 100644
--- a/include/linux/ppp-comp.h
+++ b/include/linux/ppp-comp.h
@@ -9,7 +9,7 @@
#include <uapi/linux/ppp-comp.h>
-
+struct compstat;
struct module;
/*
diff --git a/include/linux/ppp_channel.h b/include/linux/ppp_channel.h
index 91f9a928344e..45e6e427ceb8 100644
--- a/include/linux/ppp_channel.h
+++ b/include/linux/ppp_channel.h
@@ -20,6 +20,8 @@
#include <linux/poll.h>
#include <net/net_namespace.h>
+struct net_device_path;
+struct net_device_path_ctx;
struct ppp_channel;
struct ppp_channel_ops {
diff --git a/include/linux/ptp_kvm.h b/include/linux/ptp_kvm.h
index f960a719f0d5..c2e28deef33a 100644
--- a/include/linux/ptp_kvm.h
+++ b/include/linux/ptp_kvm.h
@@ -8,6 +8,8 @@
#ifndef _PTP_KVM_H_
#define _PTP_KVM_H_
+#include <linux/types.h>
+
struct timespec64;
struct clocksource;
diff --git a/include/linux/ptp_pch.h b/include/linux/ptp_pch.h
index 51818198c292..7ba643b62c15 100644
--- a/include/linux/ptp_pch.h
+++ b/include/linux/ptp_pch.h
@@ -10,6 +10,10 @@
#ifndef _PTP_PCH_H_
#define _PTP_PCH_H_
+#include <linux/types.h>
+
+struct pci_dev;
+
void pch_ch_control_write(struct pci_dev *pdev, u32 val);
u32 pch_ch_event_read(struct pci_dev *pdev);
void pch_ch_event_write(struct pci_dev *pdev, u32 val);
diff --git a/include/linux/seq_file_net.h b/include/linux/seq_file_net.h
index b97912fdbae7..79638395bc32 100644
--- a/include/linux/seq_file_net.h
+++ b/include/linux/seq_file_net.h
@@ -3,6 +3,7 @@
#define __SEQ_FILE_NET_H__
#include <linux/seq_file.h>
+#include <net/net_trackers.h>
struct net;
extern struct net init_net;
diff --git a/include/linux/sungem_phy.h b/include/linux/sungem_phy.h
index 3a11fa41a131..c505f30e8b68 100644
--- a/include/linux/sungem_phy.h
+++ b/include/linux/sungem_phy.h
@@ -2,6 +2,8 @@
#ifndef __SUNGEM_PHY_H__
#define __SUNGEM_PHY_H__
+#include <linux/types.h>
+
struct mii_phy;
/* Operations supported by any kind of PHY */
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 1b4d72d5e891..b42b72391a8d 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -23,6 +23,12 @@
#ifndef __LINUX_USB_USBNET_H
#define __LINUX_USB_USBNET_H
+#include <linux/mii.h>
+#include <linux/netdevice.h>
+#include <linux/skbuff.h>
+#include <linux/types.h>
+#include <linux/usb.h>
+
/* interface from usbnet core to each USB networking link we handle */
struct usbnet {
/* housekeeping */
diff --git a/include/net/llc_s_st.h b/include/net/llc_s_st.h
index c4359e203013..ed5b2fa40d32 100644
--- a/include/net/llc_s_st.h
+++ b/include/net/llc_s_st.h
@@ -12,6 +12,12 @@
* See the GNU General Public License for more details.
*/
+#include <linux/types.h>
+#include <net/llc_s_ac.h>
+#include <net/llc_s_ev.h>
+
+struct llc_sap_state_trans;
+
#define LLC_NR_SAP_STATES 2 /* size of state table */
/* structures and types */
--
2.37.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] add missing includes and forward declarations to networking includes under linux/
2022-07-23 4:57 [PATCH net-next] add missing includes and forward declarations to networking includes under linux/ Jakub Kicinski
@ 2022-07-26 10:00 ` Paolo Abeni
2022-07-26 16:08 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Abeni @ 2022-07-26 10:00 UTC (permalink / raw)
To: Jakub Kicinski, davem; +Cc: netdev, edumazet
On Fri, 2022-07-22 at 21:57 -0700, Jakub Kicinski wrote:
> Similarly to a recent include/net/ cleanup, this patch adds
> missing includes to networking headers under include/linux.
> All these problems are currently masked by the existing users
> including the missing dependency before the broken header.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> include/linux/atm_tcp.h | 3 +++
> include/linux/dsa/tag_qca.h | 6 ++++++
> include/linux/hippidevice.h | 4 ++++
> include/linux/if_eql.h | 1 +
> include/linux/if_hsr.h | 4 ++++
> include/linux/if_rmnet.h | 2 ++
> include/linux/if_tap.h | 2 ++
> include/linux/mdio/mdio-xgene.h | 4 ++++
> include/linux/nl802154.h | 2 ++
> include/linux/phy_fixed.h | 3 +++
> include/linux/ppp-comp.h | 2 +-
> include/linux/ppp_channel.h | 2 ++
> include/linux/ptp_kvm.h | 2 ++
> include/linux/ptp_pch.h | 4 ++++
> include/linux/seq_file_net.h | 1 +
> include/linux/sungem_phy.h | 2 ++
> include/linux/usb/usbnet.h | 6 ++++++
> include/net/llc_s_st.h | 6 ++++++
> 18 files changed, 55 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/atm_tcp.h b/include/linux/atm_tcp.h
> index c8ecf6f68fb5..ba4fe690bff0 100644
> --- a/include/linux/atm_tcp.h
> +++ b/include/linux/atm_tcp.h
> @@ -9,6 +9,9 @@
>
> #include <uapi/linux/atm_tcp.h>
>
> +struct atm_tcp_ops;
This looks not needed? 'struct atm_tcp_ops' is defined a few lines
below...
> +struct atm_vcc;
> +struct module;
>
> struct atm_tcp_ops {
> int (*attach)(struct atm_vcc *vcc,int itf);
> diff --git a/include/linux/dsa/tag_qca.h b/include/linux/dsa/tag_qca.h
> index 4359fb0221cf..e357df561e55 100644
> --- a/include/linux/dsa/tag_qca.h
> +++ b/include/linux/dsa/tag_qca.h
> @@ -3,6 +3,12 @@
> #ifndef __TAG_QCA_H
> #define __TAG_QCA_H
>
> +#include <linux/types.h>
> +
> +struct dsa_switch;
> +struct net_device;
It looks like 'struct net_device' is not used in this header file.
> +struct sk_buff;
> +
> #define QCA_HDR_LEN 2
> #define QCA_HDR_VERSION 0x2
>
[...]
> diff --git a/include/linux/if_tap.h b/include/linux/if_tap.h
> index 915a187cfabd..f21f87952b20 100644
> --- a/include/linux/if_tap.h
> +++ b/include/linux/if_tap.h
> @@ -2,6 +2,8 @@
> #ifndef _LINUX_IF_TAP_H_
> #define _LINUX_IF_TAP_H_
>
> +struct file;
I guess even:
struct socket;
struct ptr_ring;
are needed, and you can remove the forward declaration from the #else
branch.
> +
> #if IS_ENABLED(CONFIG_TAP)
> struct socket *tap_get_socket(struct file *);
> struct ptr_ring *tap_get_ptr_ring(struct file *file);
> diff --git a/include/linux/mdio/mdio-xgene.h b/include/linux/mdio/mdio-xgene.h
> index 8af93ada8b64..9e588965dc83 100644
> --- a/include/linux/mdio/mdio-xgene.h
> +++ b/include/linux/mdio/mdio-xgene.h
> @@ -8,6 +8,10 @@
> #ifndef __MDIO_XGENE_H__
> #define __MDIO_XGENE_H__
>
> +#include <linux/bits.h>
> +#include <linux/spinlock.h>
> +#include <linux/types.h>
> +
possibly even:
struct clk;
struct device;
struct mii_bus;
used below.
> #define BLOCK_XG_MDIO_CSR_OFFSET 0x5000
> #define BLOCK_DIAG_CSR_OFFSET 0xd000
> #define XGENET_CONFIG_REG_ADDR 0x20
[...]
> diff --git a/include/linux/sungem_phy.h b/include/linux/sungem_phy.h
> index 3a11fa41a131..c505f30e8b68 100644
> --- a/include/linux/sungem_phy.h
> +++ b/include/linux/sungem_phy.h
> @@ -2,6 +2,8 @@
> #ifndef __SUNGEM_PHY_H__
> #define __SUNGEM_PHY_H__
>
> +#include <linux/types.h>
> +
> struct mii_phy;
Possibly even:
struct net_device;
used below.
>
> /* Operations supported by any kind of PHY */
> diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
> index 1b4d72d5e891..b42b72391a8d 100644
> --- a/include/linux/usb/usbnet.h
> +++ b/include/linux/usb/usbnet.h
> @@ -23,6 +23,12 @@
> #ifndef __LINUX_USB_USBNET_H
> #define __LINUX_USB_USBNET_H
>
> +#include <linux/mii.h>
> +#include <linux/netdevice.h>
> +#include <linux/skbuff.h>
> +#include <linux/types.h>
'linux/types.h' should not be needed: already included via skbuff.h ->
atomic.h -> types.h
> +#include <linux/usb.h>
> +
> /* interface from usbnet core to each USB networking link we handle */
> struct usbnet {
> /* housekeeping */
Cheers,
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] add missing includes and forward declarations to networking includes under linux/
2022-07-26 10:00 ` Paolo Abeni
@ 2022-07-26 16:08 ` Jakub Kicinski
0 siblings, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2022-07-26 16:08 UTC (permalink / raw)
To: Paolo Abeni; +Cc: davem, netdev, edumazet
On Tue, 26 Jul 2022 12:00:47 +0200 Paolo Abeni wrote:
> On Fri, 2022-07-22 at 21:57 -0700, Jakub Kicinski wrote:
> > Similarly to a recent include/net/ cleanup, this patch adds
> > missing includes to networking headers under include/linux.
> > All these problems are currently masked by the existing users
> > including the missing dependency before the broken header.
Thanks for the detailed review!
> > --- a/include/linux/if_tap.h
> > +++ b/include/linux/if_tap.h
> > @@ -2,6 +2,8 @@
> > #ifndef _LINUX_IF_TAP_H_
> > #define _LINUX_IF_TAP_H_
> >
> > +struct file;
>
> I guess even:
>
> struct socket;
> struct ptr_ring;
>
> are needed, and you can remove the forward declaration from the #else
> branch.
Let me move the includes which are later on int the file, for some
reason, up.
> > #if IS_ENABLED(CONFIG_TAP)
> > struct socket *tap_get_socket(struct file *);
> > struct ptr_ring *tap_get_ptr_ring(struct file *file);
> > diff --git a/include/linux/mdio/mdio-xgene.h b/include/linux/mdio/mdio-xgene.h
> > index 8af93ada8b64..9e588965dc83 100644
> > --- a/include/linux/mdio/mdio-xgene.h
> > +++ b/include/linux/mdio/mdio-xgene.h
> > @@ -8,6 +8,10 @@
> > #ifndef __MDIO_XGENE_H__
> > #define __MDIO_XGENE_H__
> >
> > +#include <linux/bits.h>
> > +#include <linux/spinlock.h>
> > +#include <linux/types.h>
> > +
>
> possibly even:
>
> struct clk;
> struct device;
> struct mii_bus;
>
> used below.
I don't understand why but apparently using a struct type in another
struct is considered a forward declaration.
09:05 ~$ cat /tmp/one.c
int some_func(struct bla *b);
int main()
{
return 0;
}
09:05 ~$ gcc -W -Wall -Wextra -O2 /tmp/one.c -o /dev/null
/tmp/one.c:1:22: warning: ‘struct bla’ declared inside parameter list will not be visible outside of this definition or declaration
1 | int some_func(struct bla *b);
| ^~~
09:05 ~$ cat /tmp/two.c
struct other {
struct bla *b;
};
int some_func(struct bla *b);
int main()
{
return 0;
}
09:05 ~$ gcc -W -Wall -Wextra -O2 /tmp/two.c -o /dev/null
09:05 ~$
> > +++ b/include/linux/sungem_phy.h
> > @@ -2,6 +2,8 @@
> > #ifndef __SUNGEM_PHY_H__
> > #define __SUNGEM_PHY_H__
> >
> > +#include <linux/types.h>
> > +
> > struct mii_phy;
>
> Possibly even:
>
> struct net_device;
Same story.
> > /* Operations supported by any kind of PHY */
> > diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
> > index 1b4d72d5e891..b42b72391a8d 100644
> > --- a/include/linux/usb/usbnet.h
> > +++ b/include/linux/usb/usbnet.h
> > @@ -23,6 +23,12 @@
> > #ifndef __LINUX_USB_USBNET_H
> > #define __LINUX_USB_USBNET_H
> >
> > +#include <linux/mii.h>
> > +#include <linux/netdevice.h>
> > +#include <linux/skbuff.h>
> > +#include <linux/types.h>
>
> 'linux/types.h' should not be needed: already included via skbuff.h ->
> atomic.h -> types.h
Yea... sometimes I added it sometimes I didn't.. :) I don't think
the explicit include hurts.
> > +#include <linux/usb.h>
> > +
> > /* interface from usbnet core to each USB networking link we handle */
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-26 16:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-23 4:57 [PATCH net-next] add missing includes and forward declarations to networking includes under linux/ Jakub Kicinski
2022-07-26 10:00 ` Paolo Abeni
2022-07-26 16:08 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).