Commit e363eca3 authored by Alexander Aring's avatar Alexander Aring Committed by Marcel Holtmann

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: default avatarAlexander Aring <alex.aring@gmail.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 5d65cae4
...@@ -29,6 +29,8 @@ static inline int drv_start(struct ieee802154_local *local) ...@@ -29,6 +29,8 @@ static inline int drv_start(struct ieee802154_local *local)
{ {
might_sleep(); might_sleep();
local->started = true;
return local->ops->start(&local->hw); return local->ops->start(&local->hw);
} }
...@@ -37,6 +39,8 @@ static inline void drv_stop(struct ieee802154_local *local) ...@@ -37,6 +39,8 @@ static inline void drv_stop(struct ieee802154_local *local)
might_sleep(); might_sleep();
local->ops->stop(&local->hw); local->ops->stop(&local->hw);
local->started = false;
} }
static inline int drv_set_channel(struct ieee802154_local *local, static inline int drv_set_channel(struct ieee802154_local *local,
......
...@@ -50,19 +50,12 @@ struct ieee802154_local { ...@@ -50,19 +50,12 @@ struct ieee802154_local {
*/ */
struct workqueue_struct *workqueue; struct workqueue_struct *workqueue;
/* SoftMAC device is registered and running. One can add subinterfaces.
* This flag should be modified under slaves_mtx and RTNL, so you can
* read them using any of protection methods.
*/
bool started; bool started;
struct tasklet_struct tasklet; struct tasklet_struct tasklet;
struct sk_buff_head skb_queue; struct sk_buff_head skb_queue;
}; };
#define MAC802154_DEVICE_STOPPED 0x00
#define MAC802154_DEVICE_RUN 0x01
enum { enum {
IEEE802154_RX_MSG = 1, IEEE802154_RX_MSG = 1,
}; };
......
...@@ -46,13 +46,6 @@ mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev) ...@@ -46,13 +46,6 @@ mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev)
SET_NETDEV_DEV(dev, &local->phy->dev); SET_NETDEV_DEV(dev, &local->phy->dev);
mutex_lock(&local->iflist_mtx);
if (!local->started) {
mutex_unlock(&local->iflist_mtx);
return -ENODEV;
}
mutex_unlock(&local->iflist_mtx);
err = register_netdev(dev); err = register_netdev(dev);
if (err < 0) if (err < 0)
return err; return err;
...@@ -235,14 +228,6 @@ int ieee802154_register_hw(struct ieee802154_hw *hw) ...@@ -235,14 +228,6 @@ int ieee802154_register_hw(struct ieee802154_hw *hw)
if (rc < 0) if (rc < 0)
goto out_wq; goto out_wq;
rtnl_lock();
mutex_lock(&local->iflist_mtx);
local->started = MAC802154_DEVICE_RUN;
mutex_unlock(&local->iflist_mtx);
rtnl_unlock();
return 0; return 0;
out_wq: out_wq:
...@@ -263,10 +248,6 @@ void ieee802154_unregister_hw(struct ieee802154_hw *hw) ...@@ -263,10 +248,6 @@ void ieee802154_unregister_hw(struct ieee802154_hw *hw)
rtnl_lock(); rtnl_lock();
mutex_lock(&local->iflist_mtx);
local->started = MAC802154_DEVICE_STOPPED;
mutex_unlock(&local->iflist_mtx);
list_for_each_entry_safe(sdata, next, &local->interfaces, list) { list_for_each_entry_safe(sdata, next, &local->interfaces, list) {
mutex_lock(&sdata->local->iflist_mtx); mutex_lock(&sdata->local->iflist_mtx);
list_del(&sdata->list); list_del(&sdata->list);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment