diff options
author | Alexander Aring <alex.aring@gmail.com> | 2014-10-28 13:21:26 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-10-28 18:19:08 -0400 |
commit | e363eca386d0c28d8c6c4f176e1fa48b09a75315 (patch) | |
tree | 0e65a12c2987d3ef6f68d240288b1d5dfc764eab /net/mac802154 | |
parent | 5d65cae4bf6ffe29bba90f621e947922c5fb80db (diff) |
mac802154: move local started handling
This patch removes the current handling of started boolean. This is
actually dead code, because mac802154_netdev_register can't never be
called before ieee802154_register_hw. This means that local->started is
always be true when mac802154_netdev_register is called. Instead we
using this now like mac80211 to indicate that an instance of sdata is
running.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/mac802154')
-rw-r--r-- | net/mac802154/driver-ops.h | 4 | ||||
-rw-r--r-- | net/mac802154/ieee802154_i.h | 7 | ||||
-rw-r--r-- | net/mac802154/main.c | 19 |
3 files changed, 4 insertions, 26 deletions
diff --git a/net/mac802154/driver-ops.h b/net/mac802154/driver-ops.h index bf7980bbceff..bb3ee03c1669 100644 --- a/net/mac802154/driver-ops.h +++ b/net/mac802154/driver-ops.h | |||
@@ -29,6 +29,8 @@ static inline int drv_start(struct ieee802154_local *local) | |||
29 | { | 29 | { |
30 | might_sleep(); | 30 | might_sleep(); |
31 | 31 | ||
32 | local->started = true; | ||
33 | |||
32 | return local->ops->start(&local->hw); | 34 | return local->ops->start(&local->hw); |
33 | } | 35 | } |
34 | 36 | ||
@@ -37,6 +39,8 @@ static inline void drv_stop(struct ieee802154_local *local) | |||
37 | might_sleep(); | 39 | might_sleep(); |
38 | 40 | ||
39 | local->ops->stop(&local->hw); | 41 | local->ops->stop(&local->hw); |
42 | |||
43 | local->started = false; | ||
40 | } | 44 | } |
41 | 45 | ||
42 | static inline int drv_set_channel(struct ieee802154_local *local, | 46 | static inline int drv_set_channel(struct ieee802154_local *local, |
diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h index f52afd4ced92..bf0b5f613c36 100644 --- a/net/mac802154/ieee802154_i.h +++ b/net/mac802154/ieee802154_i.h | |||
@@ -50,19 +50,12 @@ struct ieee802154_local { | |||
50 | */ | 50 | */ |
51 | struct workqueue_struct *workqueue; | 51 | struct workqueue_struct *workqueue; |
52 | 52 | ||
53 | /* SoftMAC device is registered and running. One can add subinterfaces. | ||
54 | * This flag should be modified under slaves_mtx and RTNL, so you can | ||
55 | * read them using any of protection methods. | ||
56 | */ | ||
57 | bool started; | 53 | bool started; |
58 | 54 | ||
59 | struct tasklet_struct tasklet; | 55 | struct tasklet_struct tasklet; |
60 | struct sk_buff_head skb_queue; | 56 | struct sk_buff_head skb_queue; |
61 | }; | 57 | }; |
62 | 58 | ||
63 | #define MAC802154_DEVICE_STOPPED 0x00 | ||
64 | #define MAC802154_DEVICE_RUN 0x01 | ||
65 | |||
66 | enum { | 59 | enum { |
67 | IEEE802154_RX_MSG = 1, | 60 | IEEE802154_RX_MSG = 1, |
68 | }; | 61 | }; |
diff --git a/net/mac802154/main.c b/net/mac802154/main.c index 7458f71c151c..21dcc56930d1 100644 --- a/net/mac802154/main.c +++ b/net/mac802154/main.c | |||
@@ -46,13 +46,6 @@ mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev) | |||
46 | 46 | ||
47 | SET_NETDEV_DEV(dev, &local->phy->dev); | 47 | SET_NETDEV_DEV(dev, &local->phy->dev); |
48 | 48 | ||
49 | mutex_lock(&local->iflist_mtx); | ||
50 | if (!local->started) { | ||
51 | mutex_unlock(&local->iflist_mtx); | ||
52 | return -ENODEV; | ||
53 | } | ||
54 | mutex_unlock(&local->iflist_mtx); | ||
55 | |||
56 | err = register_netdev(dev); | 49 | err = register_netdev(dev); |
57 | if (err < 0) | 50 | if (err < 0) |
58 | return err; | 51 | return err; |
@@ -235,14 +228,6 @@ int ieee802154_register_hw(struct ieee802154_hw *hw) | |||
235 | if (rc < 0) | 228 | if (rc < 0) |
236 | goto out_wq; | 229 | goto out_wq; |
237 | 230 | ||
238 | rtnl_lock(); | ||
239 | |||
240 | mutex_lock(&local->iflist_mtx); | ||
241 | local->started = MAC802154_DEVICE_RUN; | ||
242 | mutex_unlock(&local->iflist_mtx); | ||
243 | |||
244 | rtnl_unlock(); | ||
245 | |||
246 | return 0; | 231 | return 0; |
247 | 232 | ||
248 | out_wq: | 233 | out_wq: |
@@ -263,10 +248,6 @@ void ieee802154_unregister_hw(struct ieee802154_hw *hw) | |||
263 | 248 | ||
264 | rtnl_lock(); | 249 | rtnl_lock(); |
265 | 250 | ||
266 | mutex_lock(&local->iflist_mtx); | ||
267 | local->started = MAC802154_DEVICE_STOPPED; | ||
268 | mutex_unlock(&local->iflist_mtx); | ||
269 | |||
270 | list_for_each_entry_safe(sdata, next, &local->interfaces, list) { | 251 | list_for_each_entry_safe(sdata, next, &local->interfaces, list) { |
271 | mutex_lock(&sdata->local->iflist_mtx); | 252 | mutex_lock(&sdata->local->iflist_mtx); |
272 | list_del(&sdata->list); | 253 | list_del(&sdata->list); |