mac80211: correct legacy rates check in ieee80211_calc_rx_airtime
[platform/kernel/linux-rpi.git] / lib / once.c
index 59149bf..351f66a 100644 (file)
@@ -66,3 +66,33 @@ void __do_once_done(bool *done, struct static_key_true *once_key,
        once_disable_jump(once_key, mod);
 }
 EXPORT_SYMBOL(__do_once_done);
+
+static DEFINE_MUTEX(once_mutex);
+
+bool __do_once_slow_start(bool *done)
+       __acquires(once_mutex)
+{
+       mutex_lock(&once_mutex);
+       if (*done) {
+               mutex_unlock(&once_mutex);
+               /* Keep sparse happy by restoring an even lock count on
+                * this mutex. In case we return here, we don't call into
+                * __do_once_done but return early in the DO_ONCE_SLOW() macro.
+                */
+               __acquire(once_mutex);
+               return false;
+       }
+
+       return true;
+}
+EXPORT_SYMBOL(__do_once_slow_start);
+
+void __do_once_slow_done(bool *done, struct static_key_true *once_key,
+                        struct module *mod)
+       __releases(once_mutex)
+{
+       *done = true;
+       mutex_unlock(&once_mutex);
+       once_disable_jump(once_key, mod);
+}
+EXPORT_SYMBOL(__do_once_slow_done);