main.c (1201cd22fd1f4579a888c0f7abc65627d5962f29) main.c (4a9a816a4f8c79260446811bdf80615b36539949)
1/*
2 * Copyright (C) 2007-2012 Siemens AG
3 *
4 * Written by:
5 * Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
6 *
7 * Based on the code from 'linux-zigbee.sourceforge.net' project.
8 *

--- 45 unchanged lines hidden (view full) ---

54 mutex_lock(&local->iflist_mtx);
55 list_add_tail_rcu(&sdata->list, &local->interfaces);
56 mutex_unlock(&local->iflist_mtx);
57 rtnl_unlock();
58
59 return 0;
60}
61
1/*
2 * Copyright (C) 2007-2012 Siemens AG
3 *
4 * Written by:
5 * Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
6 *
7 * Based on the code from 'linux-zigbee.sourceforge.net' project.
8 *

--- 45 unchanged lines hidden (view full) ---

54 mutex_lock(&local->iflist_mtx);
55 list_add_tail_rcu(&sdata->list, &local->interfaces);
56 mutex_unlock(&local->iflist_mtx);
57 rtnl_unlock();
58
59 return 0;
60}
61
62static void
63mac802154_del_iface(struct wpan_phy *phy, struct net_device *dev)
62void mac802154_del_iface(struct wpan_phy *phy, struct net_device *dev)
64{
65 struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
66
67 ASSERT_RTNL();
68
69 BUG_ON(sdata->local->phy != phy);
70
71 mutex_lock(&sdata->local->iflist_mtx);
72 list_del_rcu(&sdata->list);
73 mutex_unlock(&sdata->local->iflist_mtx);
74
75 synchronize_rcu();
76 unregister_netdevice(sdata->dev);
77}
78
63{
64 struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
65
66 ASSERT_RTNL();
67
68 BUG_ON(sdata->local->phy != phy);
69
70 mutex_lock(&sdata->local->iflist_mtx);
71 list_del_rcu(&sdata->list);
72 mutex_unlock(&sdata->local->iflist_mtx);
73
74 synchronize_rcu();
75 unregister_netdevice(sdata->dev);
76}
77
79static struct net_device *
78struct net_device *
80mac802154_add_iface(struct wpan_phy *phy, const char *name, int type)
81{
82 struct net_device *dev;
83 int err = -ENOMEM;
84
85 switch (type) {
86 case IEEE802154_DEV_MONITOR:
87 dev = alloc_netdev(sizeof(struct ieee802154_sub_if_data),

--- 128 unchanged lines hidden (view full) ---

216 create_singlethread_workqueue(wpan_phy_name(local->phy));
217 if (!local->workqueue) {
218 rc = -ENOMEM;
219 goto out;
220 }
221
222 wpan_phy_set_dev(local->phy, local->hw.parent);
223
79mac802154_add_iface(struct wpan_phy *phy, const char *name, int type)
80{
81 struct net_device *dev;
82 int err = -ENOMEM;
83
84 switch (type) {
85 case IEEE802154_DEV_MONITOR:
86 dev = alloc_netdev(sizeof(struct ieee802154_sub_if_data),

--- 128 unchanged lines hidden (view full) ---

215 create_singlethread_workqueue(wpan_phy_name(local->phy));
216 if (!local->workqueue) {
217 rc = -ENOMEM;
218 goto out;
219 }
220
221 wpan_phy_set_dev(local->phy, local->hw.parent);
222
224 local->phy->add_iface = mac802154_add_iface;
225 local->phy->del_iface = mac802154_del_iface;
226
227 rc = wpan_phy_register(local->phy);
228 if (rc < 0)
229 goto out_wq;
230
231 return 0;
232
233out_wq:
234 destroy_workqueue(local->workqueue);

--- 32 unchanged lines hidden ---
223 rc = wpan_phy_register(local->phy);
224 if (rc < 0)
225 goto out_wq;
226
227 return 0;
228
229out_wq:
230 destroy_workqueue(local->workqueue);

--- 32 unchanged lines hidden ---