mac802154: add synchronization handling
authorAlexander Aring <alex.aring@gmail.com>
Tue, 28 Oct 2014 17:21:27 +0000 (18:21 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 28 Oct 2014 22:19:08 +0000 (23:19 +0100)
This patch adds synchronization handling in start and stop driver ops
calls. This patch is mostly grab from mac80211 which was introduced by
commit ea77f12f2cc0f31168f2e0259e65a22202ac4dc2 ("mac80211: remove
tasklet enable/disable"). This is to be sure that we don't run into same
issues.

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

index bb3ee03c16691585efe7e085ba2c7db6bec04619..4b820cfeb538dac69ec1c3f493163b30578b267b 100644 (file)
@@ -30,6 +30,7 @@ static inline int drv_start(struct ieee802154_local *local)
        might_sleep();
 
        local->started = true;
+       smp_mb();
 
        return local->ops->start(&local->hw);
 }
@@ -40,6 +41,12 @@ static inline void drv_stop(struct ieee802154_local *local)
 
        local->ops->stop(&local->hw);
 
+       /* sync away all work on the tasklet before clearing started */
+       tasklet_disable(&local->tasklet);
+       tasklet_enable(&local->tasklet);
+
+       barrier();
+
        local->started = false;
 }