Skip to content

Commit

Permalink
Merge branch 'net-dev-Make-protocol-ptr-dependent-on-CONFIG'
Browse files Browse the repository at this point in the history
David Ahern says:

====================
net: dev: Make protocol ptr dependent on CONFIG

Found these in a branch from 3-years ago. Still relevant today.
Make decnet, ax25, and atalk ptrs in net_device based on their
respective CONFIG.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
davem330 committed Feb 14, 2018
2 parents 7707968 + e92bad5 commit 1d63158
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions include/linux/atalk.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,12 @@ extern void aarp_proto_init(void);
/* Inter module exports */

/* Give a device find its atif control structure */
#if IS_ENABLED(CONFIG_IRDA) || IS_ENABLED(CONFIG_ATALK)
static inline struct atalk_iface *atalk_find_dev(struct net_device *dev)
{
return dev->atalk_ptr;
}
#endif

extern struct atalk_addr *atalk_find_dev_addr(struct net_device *dev);
extern struct net_device *atrtr_get_dev(struct atalk_addr *sa);
Expand Down
6 changes: 6 additions & 0 deletions include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -1798,11 +1798,17 @@ struct net_device {
#if IS_ENABLED(CONFIG_TIPC)
struct tipc_bearer __rcu *tipc_ptr;
#endif
#if IS_ENABLED(CONFIG_IRDA) || IS_ENABLED(CONFIG_ATALK)
void *atalk_ptr;
#endif
struct in_device __rcu *ip_ptr;
#if IS_ENABLED(CONFIG_DECNET)
struct dn_dev __rcu *dn_ptr;
#endif
struct inet6_dev __rcu *ip6_ptr;
#if IS_ENABLED(CONFIG_AX25)
void *ax25_ptr;
#endif
struct wireless_dev *ieee80211_ptr;
struct wpan_dev *ieee802154_ptr;
#if IS_ENABLED(CONFIG_MPLS_ROUTING)
Expand Down
2 changes: 2 additions & 0 deletions include/net/ax25.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,12 @@ void ax25_digi_invert(const ax25_digi *, ax25_digi *);
extern ax25_dev *ax25_dev_list;
extern spinlock_t ax25_dev_lock;

#if IS_ENABLED(CONFIG_AX25)
static inline ax25_dev *ax25_dev_ax25dev(struct net_device *dev)
{
return dev->ax25_ptr;
}
#endif

ax25_dev *ax25_addr_ax25dev(ax25_address *);
void ax25_dev_device_up(struct net_device *);
Expand Down
3 changes: 2 additions & 1 deletion net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -8134,8 +8134,9 @@ void netdev_run_todo(void)
BUG_ON(!list_empty(&dev->ptype_specific));
WARN_ON(rcu_access_pointer(dev->ip_ptr));
WARN_ON(rcu_access_pointer(dev->ip6_ptr));
#if IS_ENABLED(CONFIG_DECNET)
WARN_ON(dev->dn_ptr);

#endif
if (dev->priv_destructor)
dev->priv_destructor(dev);
if (dev->needs_free_netdev)
Expand Down
1 change: 0 additions & 1 deletion net/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@
#include <linux/ipv6_route.h>
#include <linux/route.h>
#include <linux/sockios.h>
#include <linux/atalk.h>
#include <net/busy_poll.h>
#include <linux/errqueue.h>

Expand Down

0 comments on commit 1d63158

Please sign in to comment.