diff options
author | Alexander Aring <alex.aring@gmail.com> | 2014-10-25 17:16:40 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-10-25 21:55:38 +0200 |
commit | 59d19cd70cd38afd2d9bf2e3b48c3a5bbb630b5a (patch) | |
tree | c50750db9700ada4088809468424c9e22fb59581 /net/mac802154/main.c | |
parent | 60741361c3ca229a1dbb18e05d11e97b7ea75d69 (diff) |
mac802154: introduce IEEE802154_DEV_TO_SUB_IF
This function adds a wrapper to call netdev_priv to getting the sdata
attribute. This is similar like the IEEE80211_DEV_TO_SUB_IF function
inside wireless stack implementation.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/mac802154/main.c')
-rw-r--r-- | net/mac802154/main.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/net/mac802154/main.c b/net/mac802154/main.c index c7799faf508b..a34006edcb8d 100644 --- a/net/mac802154/main.c +++ b/net/mac802154/main.c @@ -31,7 +31,7 @@ int mac802154_slave_open(struct net_device *dev) { - struct ieee802154_sub_if_data *sdata = netdev_priv(dev); + struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); struct ieee802154_sub_if_data *subif; struct ieee802154_local *local = sdata->local; int res = 0; @@ -81,7 +81,7 @@ err: int mac802154_slave_close(struct net_device *dev) { - struct ieee802154_sub_if_data *sdata = netdev_priv(dev); + struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); struct ieee802154_local *local = sdata->local; ASSERT_RTNL(); @@ -101,13 +101,12 @@ int mac802154_slave_close(struct net_device *dev) static int mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev) { - struct ieee802154_sub_if_data *sdata; + struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); struct ieee802154_local *local; int err; local = wpan_phy_priv(phy); - sdata = netdev_priv(dev); sdata->dev = dev; sdata->local = local; @@ -138,12 +137,10 @@ mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev) static void mac802154_del_iface(struct wpan_phy *phy, struct net_device *dev) { - struct ieee802154_sub_if_data *sdata; + struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); ASSERT_RTNL(); - sdata = netdev_priv(dev); - BUG_ON(sdata->local->phy != phy); mutex_lock(&sdata->local->iflist_mtx); |