Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Oct 2015 15:22:01 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r288501 - head/sys/dev/usb/wlan
Message-ID:  <201510021522.t92FM1rt053435@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Fri Oct  2 15:22:00 2015
New Revision: 288501
URL: https://svnweb.freebsd.org/changeset/base/288501

Log:
  rum(4): reduce code duplication.
  
  Tested:
  
  rum0: <Belkin Belkin 54g USB Network Adapter, class 0/0, rev 2.00/0.01, addr 21> on usbus0
  rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528
  
  Submitted by:	<s3erios@gmail.com>
  Differential Revision:	https://reviews.freebsd.org/D3606

Modified:
  head/sys/dev/usb/wlan/if_rum.c

Modified: head/sys/dev/usb/wlan/if_rum.c
==============================================================================
--- head/sys/dev/usb/wlan/if_rum.c	Fri Oct  2 15:07:02 2015	(r288500)
+++ head/sys/dev/usb/wlan/if_rum.c	Fri Oct  2 15:22:00 2015	(r288501)
@@ -199,6 +199,7 @@ static void		rum_set_chan(struct rum_sof
 			    struct ieee80211_channel *);
 static void		rum_enable_tsf_sync(struct rum_softc *);
 static void		rum_enable_tsf(struct rum_softc *);
+static void		rum_abort_tsf_sync(struct rum_softc *);
 static void		rum_update_slot(struct rum_softc *);
 static void		rum_set_bssid(struct rum_softc *, const uint8_t *);
 static void		rum_set_macaddr(struct rum_softc *, const uint8_t *);
@@ -687,7 +688,6 @@ rum_newstate(struct ieee80211vap *vap, e
 	const struct ieee80211_txparam *tp;
 	enum ieee80211_state ostate;
 	struct ieee80211_node *ni;
-	uint32_t tmp;
 
 	ostate = vap->iv_state;
 	DPRINTF("%s -> %s\n",
@@ -700,11 +700,9 @@ rum_newstate(struct ieee80211vap *vap, e
 
 	switch (nstate) {
 	case IEEE80211_S_INIT:
-		if (ostate == IEEE80211_S_RUN) {
-			/* abort TSF synchronization */
-			tmp = rum_read(sc, RT2573_TXRX_CSR9);
-			rum_write(sc, RT2573_TXRX_CSR9, tmp & ~0x00ffffff);
-		}
+		if (ostate == IEEE80211_S_RUN)
+			rum_abort_tsf_sync(sc);
+
 		break;
 
 	case IEEE80211_S_RUN:
@@ -1731,6 +1729,15 @@ rum_enable_tsf(struct rum_softc *sc)
 }
 
 static void
+rum_abort_tsf_sync(struct rum_softc *sc)
+{
+	uint32_t tmp;
+
+	tmp = rum_read(sc, RT2573_TXRX_CSR9);
+	rum_write(sc, RT2573_TXRX_CSR9, tmp & ~0x00ffffff);
+}
+
+static void
 rum_update_slot(struct rum_softc *sc)
 {
 	struct ieee80211com *ic = &sc->sc_ic;
@@ -2217,12 +2224,9 @@ static void
 rum_scan_start(struct ieee80211com *ic)
 {
 	struct rum_softc *sc = ic->ic_softc;
-	uint32_t tmp;
 
 	RUM_LOCK(sc);
-	/* abort TSF synchronization */
-	tmp = rum_read(sc, RT2573_TXRX_CSR9);
-	rum_write(sc, RT2573_TXRX_CSR9, tmp & ~0x00ffffff);
+	rum_abort_tsf_sync(sc);
 	rum_set_bssid(sc, ieee80211broadcastaddr);
 	RUM_UNLOCK(sc);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201510021522.t92FM1rt053435>