Skip to content

Commit

Permalink
net: make snmp_mib_free static inline
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Cong Wang authored and David S. Miller committed Sep 3, 2013
1 parent 660d98c commit 5a17a39
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
12 changes: 11 additions & 1 deletion include/net/ip.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,17 @@ static inline u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t syncp
}
#endif
extern int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align);
extern void snmp_mib_free(void __percpu *ptr[2]);

static inline void snmp_mib_free(void __percpu *ptr[SNMP_ARRAY_SZ])
{
int i;

BUG_ON(ptr == NULL);
for (i = 0; i < SNMP_ARRAY_SZ; i++) {
free_percpu(ptr[i]);
ptr[i] = NULL;
}
}

extern struct local_ports {
seqlock_t lock;
Expand Down
12 changes: 0 additions & 12 deletions net/ipv4/af_inet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1532,18 +1532,6 @@ int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align)
}
EXPORT_SYMBOL_GPL(snmp_mib_init);

void snmp_mib_free(void __percpu *ptr[SNMP_ARRAY_SZ])
{
int i;

BUG_ON(ptr == NULL);
for (i = 0; i < SNMP_ARRAY_SZ; i++) {
free_percpu(ptr[i]);
ptr[i] = NULL;
}
}
EXPORT_SYMBOL_GPL(snmp_mib_free);

#ifdef CONFIG_IP_MULTICAST
static const struct net_protocol igmp_protocol = {
.handler = igmp_rcv,
Expand Down

0 comments on commit 5a17a39

Please sign in to comment.