Skip to content

Commit 5a17a39

Browse files
Cong Wangdavem330
authored andcommitted
net: make snmp_mib_free static inline
Fengguang reported: net/built-in.o: In function `in6_dev_finish_destroy': (.text+0x4ca7d): undefined reference to `snmp_mib_free' this is due to snmp_mib_free() is defined when CONFIG_INET is enabled, but in6_dev_finish_destroy() is now moved to core kernel. I think snmp_mib_free() is small enough to be inlined, so just make it static inline. Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Cong Wang <amwang@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 660d98c commit 5a17a39

2 files changed

Lines changed: 11 additions & 13 deletions

File tree

‎include/net/ip.h‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,17 @@ static inline u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t syncp
194194
}
195195
#endif
196196
extern int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align);
197-
extern void snmp_mib_free(void __percpu *ptr[2]);
197+
198+
static inline void snmp_mib_free(void __percpu *ptr[SNMP_ARRAY_SZ])
199+
{
200+
int i;
201+
202+
BUG_ON(ptr == NULL);
203+
for (i = 0; i < SNMP_ARRAY_SZ; i++) {
204+
free_percpu(ptr[i]);
205+
ptr[i] = NULL;
206+
}
207+
}
198208

199209
extern struct local_ports {
200210
seqlock_t lock;

‎net/ipv4/af_inet.c‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,18 +1532,6 @@ int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align)
15321532
}
15331533
EXPORT_SYMBOL_GPL(snmp_mib_init);
15341534

1535-
void snmp_mib_free(void __percpu *ptr[SNMP_ARRAY_SZ])
1536-
{
1537-
int i;
1538-
1539-
BUG_ON(ptr == NULL);
1540-
for (i = 0; i < SNMP_ARRAY_SZ; i++) {
1541-
free_percpu(ptr[i]);
1542-
ptr[i] = NULL;
1543-
}
1544-
}
1545-
EXPORT_SYMBOL_GPL(snmp_mib_free);
1546-
15471535
#ifdef CONFIG_IP_MULTICAST
15481536
static const struct net_protocol igmp_protocol = {
15491537
.handler = igmp_rcv,

0 commit comments

Comments
 (0)