Skip to contentSkip to conversation

bareudp: Remove unused code from header file

PATCH Applied Guillaume Nault 2 participants 4 messages Dec 10, 2021 – Dec 13, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover bareudp: Remove unused code from header file

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(-)
Signature · 1 line
2.21.3
#1 lore raw

PATCH 1/2 bareudp: Remove bareudp_dev_create()

There's no user for this function.

---
 drivers/net/bareudp.c | 34 ----------------------------------
 include/net/bareudp.h |  4 ----
 2 files changed, 38 deletions(-)
drivers/net/bareudp.c +0 -34
index edffc3489a12..fb71a0753385 100644
@@ -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);
include/net/bareudp.h +0 -4
index dc65a0d71d9b..8f07a91e0f25 100644
@@ -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 &&
Signature · 1 line
2.21.3
#2 lore raw

PATCH 2/2 bareudp: Move definition of struct bareudp_conf to bareudp.c

In reply to Guillaume Nault

This structure is used only in bareudp.c.

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

---
 drivers/net/bareudp.c | 7 +++++++
 include/net/bareudp.h | 9 +--------
 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/net/bareudp.c +7 -0
index fb71a0753385..f80330361399 100644
@@ -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 */
include/net/bareudp.h +1 -8
index 8f07a91e0f25..17610c8d6361 100644
@@ -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 &&
Signature · 1 line
2.21.3
#3 lore raw
In reply to Guillaume Nault
This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Quoted 10 lines · 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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html