summaryrefslogtreecommitdiff
path: root/net/mac802154/iface.c
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2014-10-28 20:21:24 +0300
committerMarcel Holtmann <marcel@holtmann.org>2014-10-29 01:19:07 +0300
commit0ea3da64fa602efa0a89502eefdb396be84d2eba (patch)
tree9438ff7ae9c8c5c8e9b6d29bab56086748ae774b /net/mac802154/iface.c
parenta543c5989d7711d984608f4e12a73218642ca865 (diff)
downloadlinux-0ea3da64fa602efa0a89502eefdb396be84d2eba.tar.xz
mac802154: rework sdata state change to running
This patch reworks the handling for setting the state like mac80211. We use bit's instead a bool variable. The mutex is not needed because it use test and set bits which are atomic operations. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/mac802154/iface.c')
-rw-r--r--net/mac802154/iface.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 300877a1a0c9..e10fd786a11f 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -156,7 +156,7 @@ static int mac802154_slave_open(struct net_device *dev)
mutex_lock(&sdata->local->iflist_mtx);
list_for_each_entry(subif, &sdata->local->interfaces, list) {
if (subif != sdata && subif->type == sdata->type &&
- subif->running) {
+ ieee802154_sdata_running(subif)) {
mutex_unlock(&sdata->local->iflist_mtx);
return -EBUSY;
}
@@ -164,9 +164,7 @@ static int mac802154_slave_open(struct net_device *dev)
mutex_unlock(&sdata->local->iflist_mtx);
}
- mutex_lock(&sdata->local->iflist_mtx);
- sdata->running = true;
- mutex_unlock(&sdata->local->iflist_mtx);
+ set_bit(SDATA_STATE_RUNNING, &sdata->state);
if (local->open_count++ == 0) {
res = drv_start(local);
@@ -178,6 +176,8 @@ static int mac802154_slave_open(struct net_device *dev)
netif_start_queue(dev);
return 0;
err:
+ /* might already be clear but that doesn't matter */
+ clear_bit(SDATA_STATE_RUNNING, &sdata->state);
sdata->local->open_count--;
return res;
@@ -253,9 +253,7 @@ static int mac802154_slave_close(struct net_device *dev)
netif_stop_queue(dev);
- mutex_lock(&sdata->local->iflist_mtx);
- sdata->running = false;
- mutex_unlock(&sdata->local->iflist_mtx);
+ clear_bit(SDATA_STATE_RUNNING, &sdata->state);
if (!--local->open_count)
drv_stop(local);