Skip to content

Commit 1d143d9

Browse files
shemmingerdavem330
authored andcommitted
net: core functions cleanup
The following functions are not used outside of net/core/dev.c and should be declared static. call_netdevice_notifiers_info __dev_remove_offload netdev_has_any_upper_dev __netdev_adjacent_dev_remove __netdev_adjacent_dev_link_lists __netdev_adjacent_dev_unlink_lists __netdev_adjacent_dev_unlink __netdev_adjacent_dev_link_neighbour __netdev_adjacent_dev_unlink_neighbour And the following are never used and should be deleted netdev_lower_dev_get_private_rcu __netdev_find_adj_rcu Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2173f8d commit 1d143d9

File tree

2 files changed

+26
-62
lines changed

2 files changed

+26
-62
lines changed

include/linux/netdevice.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1741,8 +1741,6 @@ netdev_notifier_info_to_dev(const struct netdev_notifier_info *info)
17411741
return info->dev;
17421742
}
17431743

1744-
int call_netdevice_notifiers_info(unsigned long val, struct net_device *dev,
1745-
struct netdev_notifier_info *info);
17461744
int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
17471745

17481746

@@ -1809,7 +1807,6 @@ void dev_remove_pack(struct packet_type *pt);
18091807
void __dev_remove_pack(struct packet_type *pt);
18101808
void dev_add_offload(struct packet_offload *po);
18111809
void dev_remove_offload(struct packet_offload *po);
1812-
void __dev_remove_offload(struct packet_offload *po);
18131810

18141811
struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags,
18151812
unsigned short mask);
@@ -2867,7 +2864,6 @@ extern int weight_p;
28672864
extern int bpf_jit_enable;
28682865

28692866
bool netdev_has_upper_dev(struct net_device *dev, struct net_device *upper_dev);
2870-
bool netdev_has_any_upper_dev(struct net_device *dev);
28712867
struct net_device *netdev_all_upper_get_next_dev_rcu(struct net_device *dev,
28722868
struct list_head **iter);
28732869

@@ -2907,8 +2903,6 @@ int netdev_master_upper_dev_link_private(struct net_device *dev,
29072903
void *private);
29082904
void netdev_upper_dev_unlink(struct net_device *dev,
29092905
struct net_device *upper_dev);
2910-
void *netdev_lower_dev_get_private_rcu(struct net_device *dev,
2911-
struct net_device *lower_dev);
29122906
void *netdev_lower_dev_get_private(struct net_device *dev,
29132907
struct net_device *lower_dev);
29142908
int skb_checksum_help(struct sk_buff *skb);

net/core/dev.c

Lines changed: 26 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ EXPORT_SYMBOL(dev_add_offload);
480480
* and must not be freed until after all the CPU's have gone
481481
* through a quiescent state.
482482
*/
483-
void __dev_remove_offload(struct packet_offload *po)
483+
static void __dev_remove_offload(struct packet_offload *po)
484484
{
485485
struct list_head *head = &offload_base;
486486
struct packet_offload *po1;
@@ -498,7 +498,6 @@ void __dev_remove_offload(struct packet_offload *po)
498498
out:
499499
spin_unlock(&offload_lock);
500500
}
501-
EXPORT_SYMBOL(__dev_remove_offload);
502501

503502
/**
504503
* dev_remove_offload - remove packet offload handler
@@ -1566,14 +1565,14 @@ EXPORT_SYMBOL(unregister_netdevice_notifier);
15661565
* are as for raw_notifier_call_chain().
15671566
*/
15681567

1569-
int call_netdevice_notifiers_info(unsigned long val, struct net_device *dev,
1570-
struct netdev_notifier_info *info)
1568+
static int call_netdevice_notifiers_info(unsigned long val,
1569+
struct net_device *dev,
1570+
struct netdev_notifier_info *info)
15711571
{
15721572
ASSERT_RTNL();
15731573
netdev_notifier_info_init(info, dev);
15741574
return raw_notifier_call_chain(&netdev_chain, val, info);
15751575
}
1576-
EXPORT_SYMBOL(call_netdevice_notifiers_info);
15771576

15781577
/**
15791578
* call_netdevice_notifiers - call all network notifier blocks
@@ -4355,19 +4354,6 @@ struct netdev_adjacent {
43554354
struct rcu_head rcu;
43564355
};
43574356

4358-
static struct netdev_adjacent *__netdev_find_adj_rcu(struct net_device *dev,
4359-
struct net_device *adj_dev,
4360-
struct list_head *adj_list)
4361-
{
4362-
struct netdev_adjacent *adj;
4363-
4364-
list_for_each_entry_rcu(adj, adj_list, list) {
4365-
if (adj->dev == adj_dev)
4366-
return adj;
4367-
}
4368-
return NULL;
4369-
}
4370-
43714357
static struct netdev_adjacent *__netdev_find_adj(struct net_device *dev,
43724358
struct net_device *adj_dev,
43734359
struct list_head *adj_list)
@@ -4406,13 +4392,12 @@ EXPORT_SYMBOL(netdev_has_upper_dev);
44064392
* Find out if a device is linked to an upper device and return true in case
44074393
* it is. The caller must hold the RTNL lock.
44084394
*/
4409-
bool netdev_has_any_upper_dev(struct net_device *dev)
4395+
static bool netdev_has_any_upper_dev(struct net_device *dev)
44104396
{
44114397
ASSERT_RTNL();
44124398

44134399
return !list_empty(&dev->all_adj_list.upper);
44144400
}
4415-
EXPORT_SYMBOL(netdev_has_any_upper_dev);
44164401

44174402
/**
44184403
* netdev_master_upper_dev_get - Get master upper device
@@ -4644,9 +4629,9 @@ static int __netdev_adjacent_dev_insert(struct net_device *dev,
46444629
return ret;
46454630
}
46464631

4647-
void __netdev_adjacent_dev_remove(struct net_device *dev,
4648-
struct net_device *adj_dev,
4649-
struct list_head *dev_list)
4632+
static void __netdev_adjacent_dev_remove(struct net_device *dev,
4633+
struct net_device *adj_dev,
4634+
struct list_head *dev_list)
46504635
{
46514636
struct netdev_adjacent *adj;
46524637
char linkname[IFNAMSIZ+7];
@@ -4684,11 +4669,11 @@ void __netdev_adjacent_dev_remove(struct net_device *dev,
46844669
kfree_rcu(adj, rcu);
46854670
}
46864671

4687-
int __netdev_adjacent_dev_link_lists(struct net_device *dev,
4688-
struct net_device *upper_dev,
4689-
struct list_head *up_list,
4690-
struct list_head *down_list,
4691-
void *private, bool master)
4672+
static int __netdev_adjacent_dev_link_lists(struct net_device *dev,
4673+
struct net_device *upper_dev,
4674+
struct list_head *up_list,
4675+
struct list_head *down_list,
4676+
void *private, bool master)
46924677
{
46934678
int ret;
46944679

@@ -4707,35 +4692,35 @@ int __netdev_adjacent_dev_link_lists(struct net_device *dev,
47074692
return 0;
47084693
}
47094694

4710-
int __netdev_adjacent_dev_link(struct net_device *dev,
4711-
struct net_device *upper_dev)
4695+
static int __netdev_adjacent_dev_link(struct net_device *dev,
4696+
struct net_device *upper_dev)
47124697
{
47134698
return __netdev_adjacent_dev_link_lists(dev, upper_dev,
47144699
&dev->all_adj_list.upper,
47154700
&upper_dev->all_adj_list.lower,
47164701
NULL, false);
47174702
}
47184703

4719-
void __netdev_adjacent_dev_unlink_lists(struct net_device *dev,
4720-
struct net_device *upper_dev,
4721-
struct list_head *up_list,
4722-
struct list_head *down_list)
4704+
static void __netdev_adjacent_dev_unlink_lists(struct net_device *dev,
4705+
struct net_device *upper_dev,
4706+
struct list_head *up_list,
4707+
struct list_head *down_list)
47234708
{
47244709
__netdev_adjacent_dev_remove(dev, upper_dev, up_list);
47254710
__netdev_adjacent_dev_remove(upper_dev, dev, down_list);
47264711
}
47274712

4728-
void __netdev_adjacent_dev_unlink(struct net_device *dev,
4729-
struct net_device *upper_dev)
4713+
static void __netdev_adjacent_dev_unlink(struct net_device *dev,
4714+
struct net_device *upper_dev)
47304715
{
47314716
__netdev_adjacent_dev_unlink_lists(dev, upper_dev,
47324717
&dev->all_adj_list.upper,
47334718
&upper_dev->all_adj_list.lower);
47344719
}
47354720

4736-
int __netdev_adjacent_dev_link_neighbour(struct net_device *dev,
4737-
struct net_device *upper_dev,
4738-
void *private, bool master)
4721+
static int __netdev_adjacent_dev_link_neighbour(struct net_device *dev,
4722+
struct net_device *upper_dev,
4723+
void *private, bool master)
47394724
{
47404725
int ret = __netdev_adjacent_dev_link(dev, upper_dev);
47414726

@@ -4754,8 +4739,8 @@ int __netdev_adjacent_dev_link_neighbour(struct net_device *dev,
47544739
return 0;
47554740
}
47564741

4757-
void __netdev_adjacent_dev_unlink_neighbour(struct net_device *dev,
4758-
struct net_device *upper_dev)
4742+
static void __netdev_adjacent_dev_unlink_neighbour(struct net_device *dev,
4743+
struct net_device *upper_dev)
47594744
{
47604745
__netdev_adjacent_dev_unlink(dev, upper_dev);
47614746
__netdev_adjacent_dev_unlink_lists(dev, upper_dev,
@@ -4944,21 +4929,6 @@ void netdev_upper_dev_unlink(struct net_device *dev,
49444929
}
49454930
EXPORT_SYMBOL(netdev_upper_dev_unlink);
49464931

4947-
void *netdev_lower_dev_get_private_rcu(struct net_device *dev,
4948-
struct net_device *lower_dev)
4949-
{
4950-
struct netdev_adjacent *lower;
4951-
4952-
if (!lower_dev)
4953-
return NULL;
4954-
lower = __netdev_find_adj_rcu(dev, lower_dev, &dev->adj_list.lower);
4955-
if (!lower)
4956-
return NULL;
4957-
4958-
return lower->private;
4959-
}
4960-
EXPORT_SYMBOL(netdev_lower_dev_get_private_rcu);
4961-
49624932
void *netdev_lower_dev_get_private(struct net_device *dev,
49634933
struct net_device *lower_dev)
49644934
{

0 commit comments

Comments
 (0)