linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Janusz Dziedzic <janusz.dziedzic@tieto.com>
To: linux-wireless@vger.kernel.org
Cc: ath9k-devel@lists.ath9k.org, nbd@openwrt.org,
	Janusz Dziedzic <janusz.dziedzic@tieto.com>
Subject: [PATCH v2 13/13] ath9k: remove ath9k_mod_tsf64_tu
Date: Fri, 27 Nov 2015 09:37:18 +0100	[thread overview]
Message-ID: <1448613438-5173-13-git-send-email-janusz.dziedzic@tieto.com> (raw)
In-Reply-To: <1448613438-5173-1-git-send-email-janusz.dziedzic@tieto.com>

Remove ath9k_mod_tsf64_tu() function while we could
use div_u64_rem() function.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath9k/common-beacon.c | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/common-beacon.c b/drivers/net/wireless/ath/ath9k/common-beacon.c
index 6ad4447..01d6d32 100644
--- a/drivers/net/wireless/ath/ath9k/common-beacon.c
+++ b/drivers/net/wireless/ath/ath9k/common-beacon.c
@@ -18,30 +18,16 @@
 
 #define FUDGE 2
 
-/* Calculate the modulo of a 64 bit TSF snapshot with a TU divisor */
-static u32 ath9k_mod_tsf64_tu(u64 tsf, u32 div_tu)
-{
-	u32 tsf_mod, tsf_hi, tsf_lo, mod_hi, mod_lo;
-
-	tsf_mod = tsf & (BIT(10) - 1);
-	tsf_hi = tsf >> 32;
-	tsf_lo = ((u32) tsf) >> 10;
-
-	mod_hi = tsf_hi % div_tu;
-	mod_lo = ((mod_hi << 22) + tsf_lo) % div_tu;
-
-	return (mod_lo << 10) | tsf_mod;
-}
-
 static u32 ath9k_get_next_tbtt(struct ath_hw *ah, u64 tsf,
 			       unsigned int interval)
 {
-	unsigned int offset;
+	unsigned int offset, divisor;
 
 	tsf += TU_TO_USEC(FUDGE + ah->config.sw_beacon_response_time);
-	offset = ath9k_mod_tsf64_tu(tsf, interval);
+	divisor = TU_TO_USEC(interval);
+	div_u64_rem(tsf, divisor, &offset);
 
-	return (u32) tsf + TU_TO_USEC(interval) - offset;
+	return (u32) tsf + divisor - offset;
 }
 
 /*
-- 
1.9.1


  parent reply	other threads:[~2015-11-27  8:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-27  8:37 [PATCH v2 01/13] ath9k: add debug messages to aggr/chanctx funcs Janusz Dziedzic
2015-11-27  8:37 ` [PATCH v2 02/13] ath9k: print real timer value Janusz Dziedzic
2015-11-27  8:37 ` [PATCH v2 03/13] ath9k: queue null frames in case of MCC Janusz Dziedzic
2015-11-27  8:37 ` [PATCH v2 04/13] ath9k: P2P_CLIENT, send frames after 1ms AP/GO will aprear Janusz Dziedzic
2015-11-27  8:37 ` [PATCH v2 05/13] ath9k: use u32 when calculate tsf Janusz Dziedzic
2015-11-27  8:37 ` [PATCH v2 06/13] ath9k: setup correct skb priority for nullfunc Janusz Dziedzic
2015-11-27  8:37 ` [PATCH v2 07/13] ath9k: MCC enable Opportunistic Power Save Janusz Dziedzic
2015-11-27  8:37 ` [PATCH v2 08/13] ath9k: P2P_CLIENT, get/set NOA correctly Janusz Dziedzic
2015-11-27  8:37 ` [PATCH v2 09/13] ath9k: request NOA update when chanctx active Janusz Dziedzic
2015-12-01 13:13   ` Kalle Valo
2016-01-28  8:21   ` Kalle Valo
2015-11-27  8:37 ` [PATCH v2 10/13] ath9k: MCC, add NOA also in case of an AP Janusz Dziedzic
2015-11-27  8:37 ` [PATCH v2 11/13] ath9k: MCC add sta_ap_ratio module param Janusz Dziedzic
2015-12-11  8:19   ` Kalle Valo
2015-12-17  9:44     ` Janusz Dziedzic
2015-11-27  8:37 ` [PATCH v2 12/13] ath9k: MCC, print time elapsed between events Janusz Dziedzic
2015-11-27  8:37 ` Janusz Dziedzic [this message]
2015-12-08 15:03 ` [PATCH v2 01/13] ath9k: add debug messages to aggr/chanctx funcs Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1448613438-5173-13-git-send-email-janusz.dziedzic@tieto.com \
    --to=janusz.dziedzic@tieto.com \
    --cc=ath9k-devel@lists.ath9k.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@openwrt.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).