[PATCH net-next 0/2] bareudp: Remove unused code from header file

STALE1761d

4 messages, 2 authors, 2021-12-13 · open the first message on its own page

[PATCH net-next 0/2] bareudp: Remove unused code from header file

From: Guillaume Nault <hidden>
Date: 2021-12-10 19:56:41

Stop exporting unused functions and structures in bareudp.h. The only
piece of bareudp.h that is actually used is netif_is_bareudp(). The
rest can be moved to bareudp.c or even dropped entirely.


Guillaume Nault (2):
  bareudp: Remove bareudp_dev_create()
  bareudp: Move definition of struct bareudp_conf to bareudp.c

 drivers/net/bareudp.c | 41 +++++++----------------------------------
 include/net/bareudp.h | 13 +------------
 2 files changed, 8 insertions(+), 46 deletions(-)

-- 
2.21.3

[PATCH net-next 1/2] bareudp: Remove bareudp_dev_create()

From: Guillaume Nault <hidden>
Date: 2021-12-10 19:56:43

There's no user for this function.

Signed-off-by: Guillaume Nault <redacted>
---
 drivers/net/bareudp.c | 34 ----------------------------------
 include/net/bareudp.h |  4 ----
 2 files changed, 38 deletions(-)
diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c
index edffc3489a12..fb71a0753385 100644
--- a/drivers/net/bareudp.c
+++ b/drivers/net/bareudp.c
@@ -721,40 +721,6 @@ static struct rtnl_link_ops bareudp_link_ops __read_mostly = {
 	.fill_info      = bareudp_fill_info,
 };
 
-struct net_device *bareudp_dev_create(struct net *net, const char *name,
-				      u8 name_assign_type,
-				      struct bareudp_conf *conf)
-{
-	struct nlattr *tb[IFLA_MAX + 1];
-	struct net_device *dev;
-	int err;
-
-	memset(tb, 0, sizeof(tb));
-	dev = rtnl_create_link(net, name, name_assign_type,
-			       &bareudp_link_ops, tb, NULL);
-	if (IS_ERR(dev))
-		return dev;
-
-	err = bareudp_configure(net, dev, conf);
-	if (err) {
-		free_netdev(dev);
-		return ERR_PTR(err);
-	}
-	err = dev_set_mtu(dev, IP_MAX_MTU - BAREUDP_BASE_HLEN);
-	if (err)
-		goto err;
-
-	err = rtnl_configure_link(dev, NULL);
-	if (err < 0)
-		goto err;
-
-	return dev;
-err:
-	bareudp_dellink(dev, NULL);
-	return ERR_PTR(err);
-}
-EXPORT_SYMBOL_GPL(bareudp_dev_create);
-
 static __net_init int bareudp_init_net(struct net *net)
 {
 	struct bareudp_net *bn = net_generic(net, bareudp_net_id);
diff --git a/include/net/bareudp.h b/include/net/bareudp.h
index dc65a0d71d9b..8f07a91e0f25 100644
--- a/include/net/bareudp.h
+++ b/include/net/bareudp.h
@@ -14,10 +14,6 @@ struct bareudp_conf {
 	bool multi_proto_mode;
 };
 
-struct net_device *bareudp_dev_create(struct net *net, const char *name,
-				      u8 name_assign_type,
-				      struct bareudp_conf *info);
-
 static inline bool netif_is_bareudp(const struct net_device *dev)
 {
 	return dev->rtnl_link_ops &&
-- 
2.21.3

[PATCH net-next 2/2] bareudp: Move definition of struct bareudp_conf to bareudp.c

From: Guillaume Nault <hidden>
Date: 2021-12-10 19:56:47

This structure is used only in bareudp.c.

While there, adjust include files: we need netdevice.h, not skbuff.h.

Signed-off-by: Guillaume Nault <redacted>
---
 drivers/net/bareudp.c | 7 +++++++
 include/net/bareudp.h | 9 +--------
 2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c
index fb71a0753385..f80330361399 100644
--- a/drivers/net/bareudp.c
+++ b/drivers/net/bareudp.c
@@ -38,6 +38,13 @@ struct bareudp_net {
 	struct list_head        bareudp_list;
 };
 
+struct bareudp_conf {
+	__be16 ethertype;
+	__be16 port;
+	u16 sport_min;
+	bool multi_proto_mode;
+};
+
 /* Pseudo network device */
 struct bareudp_dev {
 	struct net         *net;        /* netns for packet i/o */
diff --git a/include/net/bareudp.h b/include/net/bareudp.h
index 8f07a91e0f25..17610c8d6361 100644
--- a/include/net/bareudp.h
+++ b/include/net/bareudp.h
@@ -3,17 +3,10 @@
 #ifndef __NET_BAREUDP_H
 #define __NET_BAREUDP_H
 
+#include <linux/netdevice.h>
 #include <linux/types.h>
-#include <linux/skbuff.h>
 #include <net/rtnetlink.h>
 
-struct bareudp_conf {
-	__be16 ethertype;
-	__be16 port;
-	u16 sport_min;
-	bool multi_proto_mode;
-};
-
 static inline bool netif_is_bareudp(const struct net_device *dev)
 {
 	return dev->rtnl_link_ops &&
-- 
2.21.3

Re: [PATCH net-next 0/2] bareudp: Remove unused code from header file

From: patchwork-bot+netdevbpf@kernel.org
Date: 2021-12-13 12:50:16

Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller [off-list ref]:

On Fri, 10 Dec 2021 20:56:33 +0100 you wrote:
Stop exporting unused functions and structures in bareudp.h. The only
piece of bareudp.h that is actually used is netif_is_bareudp(). The
rest can be moved to bareudp.c or even dropped entirely.


Guillaume Nault (2):
  bareudp: Remove bareudp_dev_create()
  bareudp: Move definition of struct bareudp_conf to bareudp.c

[...]
Here is the summary with links:
  - [net-next,1/2] bareudp: Remove bareudp_dev_create()
    https://git.kernel.org/netdev/net-next/c/614b7a1f28f4
  - [net-next,2/2] bareudp: Move definition of struct bareudp_conf to bareudp.c
    https://git.kernel.org/netdev/net-next/c/dcdd77ee55a7

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help