mac820154: move mutex locks out of loop
authorAlexander Aring <alex.aring@gmail.com>
Wed, 12 Nov 2014 02:36:50 +0000 (03:36 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 12 Nov 2014 04:10:36 +0000 (05:10 +0100)
Instead of always re-lock the iflist_mtx at multiple interfaces we lock
the complete for each loop at start and at the end.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/mac802154/iface.c

index 8b21d201fc973223690d23a29874f54ad68a92d7..85d215562b4af30cb0414af1bff72cc7a132c827 100644 (file)
@@ -540,11 +540,11 @@ void ieee802154_remove_interfaces(struct ieee802154_local *local)
 {
        struct ieee802154_sub_if_data *sdata, *tmp;
 
+       mutex_lock(&local->iflist_mtx);
        list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) {
-               mutex_lock(&sdata->local->iflist_mtx);
                list_del(&sdata->list);
-               mutex_unlock(&sdata->local->iflist_mtx);
 
                unregister_netdevice(sdata->dev);
        }
+       mutex_unlock(&local->iflist_mtx);
 }
This page took 0.026899 seconds and 5 git commands to generate.