]> git.karo-electronics.de Git - linux-beck.git/commitdiff
wireless: make TU conversion macros available
authorJohannes Berg <johannes.berg@intel.com>
Thu, 25 Jul 2013 19:45:17 +0000 (21:45 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 6 Aug 2013 09:00:59 +0000 (11:00 +0200)
A few places in the code (mac80211 and iwlmvm) use the same
TU_TO_JIFFIES() macro and could use TU_TO_EXP_TIME() that
mac80211 has. Make these available to everyone and use them.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/iwlwifi/mvm/time-event.c
include/linux/ieee80211.h
net/mac80211/ieee80211_i.h

index ad9bbca992133cc096ff0b90c5048ae248b635c9..9f100363b17753ad711df0db9e089fffa0553ee9 100644 (file)
@@ -73,7 +73,6 @@
 #include "iwl-prph.h"
 
 /* A TimeUnit is 1024 microsecond */
-#define TU_TO_JIFFIES(_tu)     (usecs_to_jiffies((_tu) * 1024))
 #define MSEC_TO_TU(_msec)      (_msec*1000/1024)
 
 /*
@@ -191,8 +190,7 @@ static void iwl_mvm_te_handle_notif(struct iwl_mvm *mvm,
                iwl_mvm_te_clear_data(mvm, te_data);
        } else if (le32_to_cpu(notif->action) & TE_NOTIF_HOST_EVENT_START) {
                te_data->running = true;
-               te_data->end_jiffies = jiffies +
-                       TU_TO_JIFFIES(te_data->duration);
+               te_data->end_jiffies = TU_TO_EXP_TIME(te_data->duration);
 
                if (te_data->vif->type == NL80211_IFTYPE_P2P_DEVICE) {
                        set_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status);
@@ -329,8 +327,7 @@ void iwl_mvm_protect_session(struct iwl_mvm *mvm,
        lockdep_assert_held(&mvm->mutex);
 
        if (te_data->running &&
-           time_after(te_data->end_jiffies,
-                      jiffies + TU_TO_JIFFIES(min_duration))) {
+           time_after(te_data->end_jiffies, TU_TO_EXP_TIME(min_duration))) {
                IWL_DEBUG_TE(mvm, "We have enough time in the current TE: %u\n",
                             jiffies_to_msecs(te_data->end_jiffies - jiffies));
                return;
index b3ce299782afa70f29983a79367c79a2ace521cf..23a8877f4ded09298346170666af052cfe2c0328 100644 (file)
@@ -2288,4 +2288,8 @@ static inline bool ieee80211_check_tim(const struct ieee80211_tim_ie *tim,
        return !!(tim->virtual_map[index] & mask);
 }
 
+/* convert time units */
+#define TU_TO_JIFFIES(x)       (usecs_to_jiffies((x) * 1024))
+#define TU_TO_EXP_TIME(x)      (jiffies + TU_TO_JIFFIES(x))
+
 #endif /* LINUX_IEEE80211_H */
index e94c84050e9c214c3959088423f75ef444824dcd..b6186517ec567e85eb986d77dd6ff72c36a4379d 100644 (file)
@@ -53,9 +53,6 @@ struct ieee80211_local;
  * increased memory use (about 2 kB of RAM per entry). */
 #define IEEE80211_FRAGMENT_MAX 4
 
-#define TU_TO_JIFFIES(x)       (usecs_to_jiffies((x) * 1024))
-#define TU_TO_EXP_TIME(x)      (jiffies + TU_TO_JIFFIES(x))
-
 /* power level hasn't been configured (or set to automatic) */
 #define IEEE80211_UNSET_POWER_LEVEL    INT_MIN