svn commit: r215485 - stable/8/sys/dev/usb/wlan
Andrew Thompson
thompsa at FreeBSD.org
Fri Nov 19 01:32:24 UTC 2010
Author: thompsa
Date: Fri Nov 19 01:32:23 2010
New Revision: 215485
URL: http://svn.freebsd.org/changeset/base/215485
Log:
MFC r209917
Update for style(9).
Submitted by: Akinori Furukoshi (author)
Modified:
stable/8/sys/dev/usb/wlan/if_run.c
Directory Properties:
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/cddl/contrib/opensolaris/ (props changed)
stable/8/sys/contrib/dev/acpica/ (props changed)
stable/8/sys/contrib/pf/ (props changed)
stable/8/sys/dev/xen/xenpci/ (props changed)
Modified: stable/8/sys/dev/usb/wlan/if_run.c
==============================================================================
--- stable/8/sys/dev/usb/wlan/if_run.c Fri Nov 19 01:30:59 2010 (r215484)
+++ stable/8/sys/dev/usb/wlan/if_run.c Fri Nov 19 01:32:23 2010 (r215485)
@@ -569,7 +569,7 @@ run_attach(device_t self)
/* wait for the chip to settle */
for (ntries = 0; ntries < 100; ntries++) {
- if (run_read(sc, RT2860_ASIC_VER_ID, &ver) != 0){
+ if (run_read(sc, RT2860_ASIC_VER_ID, &ver) != 0) {
RUN_UNLOCK(sc);
goto detach;
}
@@ -699,11 +699,11 @@ run_attach(device_t self)
if (bootverbose)
ieee80211_announce(ic);
- return 0;
+ return (0);
detach:
run_detach(self);
- return(ENXIO);
+ return (ENXIO);
}
static int
@@ -754,9 +754,9 @@ run_vap_create(struct ieee80211com *ic,
struct ieee80211vap *vap;
int i;
- if(sc->rvp_cnt >= RUN_VAP_MAX){
+ if (sc->rvp_cnt >= RUN_VAP_MAX) {
if_printf(ifp, "number of VAPs maxed out\n");
- return NULL;
+ return (NULL);
}
switch (opmode) {
@@ -770,7 +770,7 @@ run_vap_create(struct ieee80211com *ic,
case IEEE80211_M_MBSS:
/* other than WDS vaps, only one at a time */
if (!TAILQ_EMPTY(&ic->ic_vaps))
- return NULL;
+ return (NULL);
break;
case IEEE80211_M_WDS:
TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next){
@@ -780,20 +780,20 @@ run_vap_create(struct ieee80211com *ic,
flags &= ~IEEE80211_CLONE_BSSID;
break;
}
- if(vap == NULL){
+ if (vap == NULL) {
if_printf(ifp, "wds only supported in ap mode\n");
- return NULL;
+ return (NULL);
}
break;
default:
if_printf(ifp, "unknown opmode %d\n", opmode);
- return NULL;
+ return (NULL);
}
rvp = (struct run_vap *) malloc(sizeof(struct run_vap),
M_80211_VAP, M_NOWAIT | M_ZERO);
if (rvp == NULL)
- return NULL;
+ return (NULL);
vap = &rvp->vap;
ieee80211_vap_setup(ic, vap, name, unit, opmode, flags, bssid, mac);
@@ -821,23 +821,23 @@ run_vap_create(struct ieee80211com *ic,
ieee80211_vap_attach(vap, run_media_change, ieee80211_media_status);
/* make sure id is always unique */
- for(i = 0; i < RUN_VAP_MAX; i++){
+ for (i = 0; i < RUN_VAP_MAX; i++) {
if((sc->rvp_bmap & 1 << i) == 0){
sc->rvp_bmap |= 1 << i;
rvp->rvp_id = i;
break;
}
}
- if(sc->rvp_cnt++ == 0)
+ if (sc->rvp_cnt++ == 0)
ic->ic_opmode = opmode;
- if(opmode == IEEE80211_M_HOSTAP)
+ if (opmode == IEEE80211_M_HOSTAP)
sc->cmdq_run = RUN_CMDQ_GO;
DPRINTF("rvp_id=%d bmap=%x rvp_cnt=%d\n",
rvp->rvp_id, sc->rvp_bmap, sc->rvp_cnt);
- return vap;
+ return (vap);
}
static void
@@ -849,7 +849,7 @@ run_vap_delete(struct ieee80211vap *vap)
struct run_softc *sc;
uint8_t rvp_id;
- if(vap == NULL)
+ if (vap == NULL)
return;
ic = vap->iv_ic;
@@ -892,15 +892,15 @@ run_cmdq_cb(void *arg, int pending)
/* call cmdq[].func locked */
RUN_LOCK(sc);
- for(i = sc->cmdq_exec; sc->cmdq[i].func && pending;
- i = sc->cmdq_exec, pending--){
+ for (i = sc->cmdq_exec; sc->cmdq[i].func && pending;
+ i = sc->cmdq_exec, pending--) {
DPRINTFN(6, "cmdq_exec=%d pending=%d\n", i, pending);
- if(sc->cmdq_run == RUN_CMDQ_GO){
+ if (sc->cmdq_run == RUN_CMDQ_GO) {
/*
* If arg0 is NULL, callback func needs more
* than one arg. So, pass ptr to cmdq struct.
*/
- if(sc->cmdq[i].arg0)
+ if (sc->cmdq[i].arg0)
sc->cmdq[i].func(sc->cmdq[i].arg0);
else
sc->cmdq[i].func(&sc->cmdq[i]);
@@ -943,7 +943,7 @@ run_unsetup_tx_list(struct run_softc *sc
/* free up all node references and mbufs */
for (data = &pq->tx_data[0];
- data < &pq->tx_data[RUN_TX_RING_COUNT]; data++){
+ data < &pq->tx_data[RUN_TX_RING_COUNT]; data++) {
if (data->m != NULL) {
m_freem(data->m);
data->m = NULL;
@@ -969,7 +969,7 @@ run_load_microcode(struct run_softc *sc)
RUN_UNLOCK(sc);
fw = firmware_get("runfw");
RUN_LOCK(sc);
- if(fw == NULL){
+ if (fw == NULL) {
device_printf(sc->sc_dev,
"failed loadfirmware of file %s\n", "runfw");
return ENOENT;
@@ -991,14 +991,14 @@ run_load_microcode(struct run_softc *sc)
base = fw->data;
if ((sc->mac_ver) != 0x2860 &&
(sc->mac_ver) != 0x2872 &&
- (sc->mac_ver) != 0x3070){
+ (sc->mac_ver) != 0x3070) {
base += 4096;
}
/* cheap sanity check */
temp = fw->data;
bytes = *temp;
- if(bytes != be64toh(0xffffff0210280210)) {
+ if (bytes != be64toh(0xffffff0210280210)) {
device_printf(sc->sc_dev, "firmware checksum failed\n");
error = EINVAL;
goto fail;
@@ -1059,7 +1059,7 @@ run_reset(struct run_softc *sc)
USETW(req.wValue, 1);
USETW(req.wIndex, 0);
USETW(req.wLength, 0);
- return usbd_do_request(sc->sc_udev, &sc->sc_mtx, &req, NULL);
+ return (usbd_do_request(sc->sc_udev, &sc->sc_mtx, &req, NULL));
}
static usb_error_t
@@ -1094,7 +1094,7 @@ run_read(struct run_softc *sc, uint16_t
*val = le32toh(tmp);
else
*val = 0xffffffff;
- return error;
+ return (error);
}
static int
@@ -1108,7 +1108,7 @@ run_read_region_1(struct run_softc *sc,
USETW(req.wIndex, reg);
USETW(req.wLength, len);
- return run_do_request(sc, &req, buf);
+ return (run_do_request(sc, &req, buf));
}
static int
@@ -1122,7 +1122,7 @@ run_write_2(struct run_softc *sc, uint16
USETW(req.wIndex, reg);
USETW(req.wLength, 0);
- return run_do_request(sc, &req, NULL);
+ return (run_do_request(sc, &req, NULL));
}
static int
@@ -1132,7 +1132,7 @@ run_write(struct run_softc *sc, uint16_t
if ((error = run_write_2(sc, reg, val & 0xffff)) == 0)
error = run_write_2(sc, reg + 2, val >> 16);
- return error;
+ return (error);
}
static int
@@ -1148,7 +1148,7 @@ run_write_region_1(struct run_softc *sc,
KASSERT((len & 1) == 0, ("run_write_region_1: Data too long.\n"));
for (i = 0; i < len && error == 0; i += 2)
error = run_write_2(sc, reg + i, buf[i] | buf[i + 1] << 8);
- return error;
+ return (error);
#else
usb_device_request_t req;
@@ -1157,7 +1157,7 @@ run_write_region_1(struct run_softc *sc,
USETW(req.wValue, 0);
USETW(req.wIndex, reg);
USETW(req.wLength, len);
- return run_do_request(sc, &req, buf);
+ return (run_do_request(sc, &req, buf));
#endif
}
@@ -1169,7 +1169,7 @@ run_set_region_4(struct run_softc *sc, u
KASSERT((len & 3) == 0, ("run_set_region_4: Invalid data length.\n"));
for (i = 0; i < len && error == 0; i += 4)
error = run_write(sc, reg + i, val);
- return error;
+ return (error);
}
/* Read 16-bit from eFUSE ROM (RT3070 only.) */
@@ -1181,7 +1181,7 @@ run_efuse_read_2(struct run_softc *sc, u
int error, ntries;
if ((error = run_read(sc, RT3070_EFUSE_CTRL, &tmp)) != 0)
- return error;
+ return (error);
addr *= 2;
/*-
@@ -1196,25 +1196,25 @@ run_efuse_read_2(struct run_softc *sc, u
run_write(sc, RT3070_EFUSE_CTRL, tmp);
for (ntries = 0; ntries < 100; ntries++) {
if ((error = run_read(sc, RT3070_EFUSE_CTRL, &tmp)) != 0)
- return error;
+ return (error);
if (!(tmp & RT3070_EFSROM_KICK))
break;
run_delay(sc, 2);
}
if (ntries == 100)
- return ETIMEDOUT;
+ return (ETIMEDOUT);
if ((tmp & RT3070_EFUSE_AOUT_MASK) == RT3070_EFUSE_AOUT_MASK) {
*val = 0xffff; /* address not found */
- return 0;
+ return (0);
}
/* determine to which 32-bit register our 16-bit word belongs */
reg = RT3070_EFUSE_DATA3 - (addr & 0xc);
if ((error = run_read(sc, reg, &tmp)) != 0)
- return error;
+ return (error);
*val = (addr & 2) ? tmp >> 16 : tmp & 0xffff;
- return 0;
+ return (0);
}
static int
@@ -1236,7 +1236,7 @@ run_eeprom_read_2(struct run_softc *sc,
*val = le16toh(tmp);
else
*val = 0xffff;
- return error;
+ return (error);
}
static __inline int
@@ -1254,17 +1254,17 @@ run_rt2870_rf_write(struct run_softc *sc
for (ntries = 0; ntries < 10; ntries++) {
if ((error = run_read(sc, RT2860_RF_CSR_CFG0, &tmp)) != 0)
- return error;
+ return (error);
if (!(tmp & RT2860_RF_REG_CTRL))
break;
}
if (ntries == 10)
- return ETIMEDOUT;
+ return (ETIMEDOUT);
/* RF registers are 24-bit on the RT2860 */
tmp = RT2860_RF_REG_CTRL | 24 << RT2860_RF_REG_WIDTH_SHIFT |
(val & 0x3fffff) << 2 | (reg & 3);
- return run_write(sc, RT2860_RF_CSR_CFG0, tmp);
+ return (run_write(sc, RT2860_RF_CSR_CFG0, tmp));
}
static int
@@ -1275,28 +1275,28 @@ run_rt3070_rf_read(struct run_softc *sc,
for (ntries = 0; ntries < 100; ntries++) {
if ((error = run_read(sc, RT3070_RF_CSR_CFG, &tmp)) != 0)
- return error;
+ return (error);
if (!(tmp & RT3070_RF_KICK))
break;
}
if (ntries == 100)
- return ETIMEDOUT;
+ return (ETIMEDOUT);
tmp = RT3070_RF_KICK | reg << 8;
if ((error = run_write(sc, RT3070_RF_CSR_CFG, tmp)) != 0)
- return error;
+ return (error);
for (ntries = 0; ntries < 100; ntries++) {
if ((error = run_read(sc, RT3070_RF_CSR_CFG, &tmp)) != 0)
- return error;
+ return (error);
if (!(tmp & RT3070_RF_KICK))
break;
}
if (ntries == 100)
- return ETIMEDOUT;
+ return (ETIMEDOUT);
*val = tmp & 0xff;
- return 0;
+ return (0);
}
static int
@@ -1307,15 +1307,15 @@ run_rt3070_rf_write(struct run_softc *sc
for (ntries = 0; ntries < 10; ntries++) {
if ((error = run_read(sc, RT3070_RF_CSR_CFG, &tmp)) != 0)
- return error;
+ return (error);
if (!(tmp & RT3070_RF_KICK))
break;
}
if (ntries == 10)
- return ETIMEDOUT;
+ return (ETIMEDOUT);
tmp = RT3070_RF_WRITE | RT3070_RF_KICK | reg << 8 | val;
- return run_write(sc, RT3070_RF_CSR_CFG, tmp);
+ return (run_write(sc, RT3070_RF_CSR_CFG, tmp));
}
static int
@@ -1326,28 +1326,28 @@ run_bbp_read(struct run_softc *sc, uint8
for (ntries = 0; ntries < 10; ntries++) {
if ((error = run_read(sc, RT2860_BBP_CSR_CFG, &tmp)) != 0)
- return error;
+ return (error);
if (!(tmp & RT2860_BBP_CSR_KICK))
break;
}
if (ntries == 10)
- return ETIMEDOUT;
+ return (ETIMEDOUT);
tmp = RT2860_BBP_CSR_READ | RT2860_BBP_CSR_KICK | reg << 8;
if ((error = run_write(sc, RT2860_BBP_CSR_CFG, tmp)) != 0)
- return error;
+ return (error);
for (ntries = 0; ntries < 10; ntries++) {
if ((error = run_read(sc, RT2860_BBP_CSR_CFG, &tmp)) != 0)
- return error;
+ return (error);
if (!(tmp & RT2860_BBP_CSR_KICK))
break;
}
if (ntries == 10)
- return ETIMEDOUT;
+ return (ETIMEDOUT);
*val = tmp & 0xff;
- return 0;
+ return (0);
}
static int
@@ -1358,15 +1358,15 @@ run_bbp_write(struct run_softc *sc, uint
for (ntries = 0; ntries < 10; ntries++) {
if ((error = run_read(sc, RT2860_BBP_CSR_CFG, &tmp)) != 0)
- return error;
+ return (error);
if (!(tmp & RT2860_BBP_CSR_KICK))
break;
}
if (ntries == 10)
- return ETIMEDOUT;
+ return (ETIMEDOUT);
tmp = RT2860_BBP_CSR_KICK | reg << 8 | val;
- return run_write(sc, RT2860_BBP_CSR_CFG, tmp);
+ return (run_write(sc, RT2860_BBP_CSR_CFG, tmp));
}
/*
@@ -1390,7 +1390,7 @@ run_mcu_cmd(struct run_softc *sc, uint8_
tmp = RT2860_H2M_BUSY | RT2860_TOKEN_NO_INTR << 16 | arg;
if ((error = run_write(sc, RT2860_H2M_MAILBOX, tmp)) == 0)
error = run_write(sc, RT2860_HOST_CMD, cmd);
- return error;
+ return (error);
}
/*
@@ -1411,7 +1411,7 @@ b4inc(uint32_t b32, int8_t delta)
b4 = 0xf;
b32 = b32 >> 4 | b4 << 28;
}
- return b32;
+ return (b32);
}
static const char *
@@ -1428,7 +1428,7 @@ run_get_rf(int rev)
case RT3070_RF_3022: return "RT3022";
case RT3070_RF_3052: return "RT3052";
}
- return "unknown";
+ return ("unknown");
}
int
@@ -1679,7 +1679,7 @@ run_read_eeprom(struct run_softc *sc)
sc->rssi_5ghz[ant] = 0;
}
}
- return 0;
+ return (0);
}
struct ieee80211_node *
@@ -1702,9 +1702,9 @@ run_media_change(struct ifnet *ifp)
RUN_LOCK(sc);
error = ieee80211_media_change(ifp);
- if (error != ENETRESET){
+ if (error != ENETRESET) {
RUN_UNLOCK(sc);
- return error;
+ return (error);
}
tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)];
@@ -1727,7 +1727,7 @@ run_media_change(struct ifnet *ifp)
RUN_UNLOCK(sc);
- return 0;
+ return (0);
}
static int
@@ -1773,7 +1773,7 @@ run_newstate(struct ieee80211vap *vap, e
sc->runbmap &= ~bid;
/* abort TSF synchronization if there is no vap running */
- if(--sc->running == 0){
+ if (--sc->running == 0) {
run_read(sc, RT2860_BCN_TIME_CFG, &tmp);
run_write(sc, RT2860_BCN_TIME_CFG,
tmp & ~(RT2860_BCN_TX_EN | RT2860_TSF_TIMER_EN |
@@ -1784,13 +1784,13 @@ run_newstate(struct ieee80211vap *vap, e
case IEEE80211_S_RUN:
ni = vap->iv_bss;
- if(!(sc->runbmap & bid)){
+ if (!(sc->runbmap & bid)) {
if(sc->running++)
restart_ratectl = 1;
sc->runbmap |= bid;
}
- switch(vap->iv_opmode){
+ switch (vap->iv_opmode) {
case IEEE80211_M_HOSTAP:
case IEEE80211_M_MBSS:
sc->ap_running |= bid;
@@ -1799,13 +1799,13 @@ run_newstate(struct ieee80211vap *vap, e
break;
case IEEE80211_M_IBSS:
sc->adhoc_running |= bid;
- if(!sc->ap_running)
+ if (!sc->ap_running)
ic->ic_opmode = vap->iv_opmode;
run_update_beacon_cb(vap);
break;
case IEEE80211_M_STA:
sc->sta_running |= bid;
- if(!sc->ap_running && !sc->adhoc_running)
+ if (!sc->ap_running && !sc->adhoc_running)
ic->ic_opmode = vap->iv_opmode;
/* read statistic counters (clear on read) */
@@ -1845,7 +1845,7 @@ run_newstate(struct ieee80211vap *vap, e
}
/* restart amrr for running VAPs */
- if((sc->ratectl_run = ratectl) && restart_ratectl)
+ if ((sc->ratectl_run = ratectl) && restart_ratectl)
usb_callout_reset(&sc->ratectl_ch, hz, run_ratectl_to, sc);
RUN_UNLOCK(sc);
@@ -1872,7 +1872,7 @@ run_wme_update_cb(void *arg)
wmesp->wme_params[aci].wmep_logcwmin << 12 |
wmesp->wme_params[aci].wmep_aifsn << 8 |
wmesp->wme_params[aci].wmep_txopLimit);
- if(error) goto err;
+ if (error) goto err;
}
/* update SCH/DMA registers too */
@@ -1881,29 +1881,29 @@ run_wme_update_cb(void *arg)
wmesp->wme_params[WME_AC_VI].wmep_aifsn << 8 |
wmesp->wme_params[WME_AC_BK].wmep_aifsn << 4 |
wmesp->wme_params[WME_AC_BE].wmep_aifsn);
- if(error) goto err;
+ if (error) goto err;
error = run_write(sc, RT2860_WMM_CWMIN_CFG,
wmesp->wme_params[WME_AC_VO].wmep_logcwmin << 12 |
wmesp->wme_params[WME_AC_VI].wmep_logcwmin << 8 |
wmesp->wme_params[WME_AC_BK].wmep_logcwmin << 4 |
wmesp->wme_params[WME_AC_BE].wmep_logcwmin);
- if(error) goto err;
+ if (error) goto err;
error = run_write(sc, RT2860_WMM_CWMAX_CFG,
wmesp->wme_params[WME_AC_VO].wmep_logcwmax << 12 |
wmesp->wme_params[WME_AC_VI].wmep_logcwmax << 8 |
wmesp->wme_params[WME_AC_BK].wmep_logcwmax << 4 |
wmesp->wme_params[WME_AC_BE].wmep_logcwmax);
- if(error) goto err;
+ if (error) goto err;
error = run_write(sc, RT2860_WMM_TXOP0_CFG,
wmesp->wme_params[WME_AC_BK].wmep_txopLimit << 16 |
wmesp->wme_params[WME_AC_BE].wmep_txopLimit);
- if(error) goto err;
+ if (error) goto err;
error = run_write(sc, RT2860_WMM_TXOP1_CFG,
wmesp->wme_params[WME_AC_VO].wmep_txopLimit << 16 |
wmesp->wme_params[WME_AC_VI].wmep_txopLimit);
err:
- if(error)
+ if (error)
DPRINTF("WME update failed\n");
return;
@@ -1915,13 +1915,13 @@ run_wme_update(struct ieee80211com *ic)
struct run_softc *sc = ic->ic_ifp->if_softc;
/* sometime called wothout lock */
- if(mtx_owned(&ic->ic_comlock.mtx)){
+ if (mtx_owned(&ic->ic_comlock.mtx)) {
uint32_t i = RUN_CMDQ_GET(&sc->cmdq_store);
DPRINTF("cmdq_store=%d\n", i);
sc->cmdq[i].func = run_wme_update_cb;
sc->cmdq[i].arg0 = ic;
ieee80211_runtask(ic, &sc->cmdq_task);
- return (0);
+ return 0;
}
RUN_LOCK(sc);
@@ -1963,7 +1963,7 @@ run_key_set_cb(void *arg)
RUN_LOCK_ASSERT(sc, MA_OWNED);
- if(vap->iv_opmode == IEEE80211_M_HOSTAP)
+ if (vap->iv_opmode == IEEE80211_M_HOSTAP)
ni = ieee80211_find_vap_node(&ic->ic_sta, vap, cmdq->mac);
else
ni = vap->iv_bss;
@@ -2018,7 +2018,7 @@ run_key_set_cb(void *arg)
if (!(k->wk_flags & IEEE80211_KEY_GROUP) ||
(k->wk_flags & (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV))) {
/* set initial packet number in IV+EIV */
- if (k->wk_cipher == IEEE80211_CIPHER_WEP){
+ if (k->wk_cipher == IEEE80211_CIPHER_WEP) {
memset(iv, 0, sizeof iv);
iv[3] = vap->iv_def_txkey << 6;
} else {
@@ -2037,24 +2037,24 @@ run_key_set_cb(void *arg)
iv[6] = k->wk_keytsc >> 32;
iv[7] = k->wk_keytsc >> 40;
}
- if(run_write_region_1(sc, RT2860_IVEIV(wcid), iv, 8))
+ if (run_write_region_1(sc, RT2860_IVEIV(wcid), iv, 8))
return;
}
if (k->wk_flags & IEEE80211_KEY_GROUP) {
/* install group key */
- if(run_read(sc, RT2860_SKEY_MODE_0_7, &attr))
+ if (run_read(sc, RT2860_SKEY_MODE_0_7, &attr))
return;
attr &= ~(0xf << (k->wk_keyix * 4));
attr |= mode << (k->wk_keyix * 4);
- if(run_write(sc, RT2860_SKEY_MODE_0_7, attr))
+ if (run_write(sc, RT2860_SKEY_MODE_0_7, attr))
return;
} else {
/* install pairwise key */
- if(run_read(sc, RT2860_WCID_ATTR(wcid), &attr))
+ if (run_read(sc, RT2860_WCID_ATTR(wcid), &attr))
return;
attr = (attr & ~0xf) | (mode << 1) | RT2860_RX_PKEY_EN;
- if(run_write(sc, RT2860_WCID_ATTR(wcid), attr))
+ if (run_write(sc, RT2860_WCID_ATTR(wcid), attr))
return;
}
@@ -2092,13 +2092,13 @@ run_key_set(struct ieee80211vap *vap, st
* To make sure key will be set when hostapd
* calls iv_key_set() before if_init().
*/
- if(vap->iv_opmode == IEEE80211_M_HOSTAP){
+ if (vap->iv_opmode == IEEE80211_M_HOSTAP) {
RUN_LOCK(sc);
sc->cmdq_key_set = RUN_CMDQ_GO;
RUN_UNLOCK(sc);
}
- return(1);
+ return (1);
}
/*
@@ -2187,10 +2187,10 @@ run_ratectl_cb(void *arg, int pending)
struct ieee80211com *ic = sc->sc_ifp->if_l2com;
struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
- if(vap == NULL)
+ if (vap == NULL)
return;
- if(sc->rvp_cnt <= 1 && vap->iv_opmode == IEEE80211_M_STA)
+ if (sc->rvp_cnt <= 1 && vap->iv_opmode == IEEE80211_M_STA)
run_iter_func(sc, vap->iv_bss);
else {
/*
@@ -2228,7 +2228,7 @@ run_drain_fifo(void *arg)
/* drain Tx status FIFO (maxsize = 16) */
run_read(sc, RT2860_TX_STAT_FIFO, &stat);
DPRINTFN(4, "tx stat 0x%08x\n", stat);
- if(!(stat & RT2860_TXQ_VLD))
+ if (!(stat & RT2860_TXQ_VLD))
break;
wcid = (stat >> RT2860_TXQ_WCID_SHIFT) & 0xff;
@@ -2239,7 +2239,7 @@ run_drain_fifo(void *arg)
continue;
ni = sc->sc_ni[wcid];
- if(ni->ni_rctls == NULL)
+ if (ni->ni_rctls == NULL)
continue;
/* update per-STA AMRR stats */
@@ -2282,8 +2282,8 @@ run_iter_func(void *arg, struct ieee8021
int txcnt = 0, success = 0, retrycnt = 0;
int error;
- if(sc->rvp_cnt <= 1 && (vap->iv_opmode == IEEE80211_M_IBSS ||
- vap->iv_opmode == IEEE80211_M_STA)){
+ if (sc->rvp_cnt <= 1 && (vap->iv_opmode == IEEE80211_M_IBSS ||
+ vap->iv_opmode == IEEE80211_M_STA)) {
RUN_LOCK(sc);
/* read statistic counters (clear on read) and update AMRR state */
@@ -2348,13 +2348,13 @@ run_newassoc(struct ieee80211_node *ni,
uint8_t wcid = RUN_AID2WCID(ni->ni_associd);
int i, j;
- if(wcid > RT2870_WCID_MAX){
+ if (wcid > RT2870_WCID_MAX) {
device_printf(sc->sc_dev, "wcid=%d out of range\n", wcid);
return;
}
/* only interested in true associations */
- if (isnew && ni->ni_associd != 0){
+ if (isnew && ni->ni_associd != 0) {
/*
* This function could is called though timeout function.
@@ -2423,7 +2423,7 @@ run_maxrssi_chain(struct run_softc *sc,
if (rxwi->rssi[2] > rxwi->rssi[rxchain])
rxchain = 2;
}
- return rxchain;
+ return (rxchain);
}
static void
@@ -2464,12 +2464,12 @@ run_rx_frame(struct run_softc *sc, struc
wh = mtod(m, struct ieee80211_frame *);
- if (wh->i_fc[1] & IEEE80211_FC1_WEP){
+ if (wh->i_fc[1] & IEEE80211_FC1_WEP) {
wh->i_fc[1] &= ~IEEE80211_FC1_WEP;
m->m_flags |= M_WEP;
}
- if (flags & RT2860_RX_L2PAD){
+ if (flags & RT2860_RX_L2PAD) {
DPRINTFN(8, "received RT2860_RX_L2PAD frame\n");
len += 2;
}
@@ -2479,7 +2479,7 @@ run_rx_frame(struct run_softc *sc, struc
if (__predict_false(flags & RT2860_RX_MICERR)) {
/* report MIC failures to net80211 for TKIP */
- if(ni != NULL)
+ if (ni != NULL)
ieee80211_notify_michael_failure(ni->ni_vap, wh, rxwi->keyidx);
m_freem(m);
ifp->if_ierrors++;
@@ -2501,7 +2501,7 @@ run_rx_frame(struct run_softc *sc, struc
(void)ieee80211_input_all(ic, m, rssi, nf);
}
- if(__predict_false(ieee80211_radiotap_active(ic))){
+ if (__predict_false(ieee80211_radiotap_active(ic))) {
struct run_rx_radiotap_header *tap = &sc->sc_rxtap;
tap->wr_flags = 0;
@@ -2602,7 +2602,7 @@ tr_setup:
goto tr_setup;
}
- if(sc->rx_m != NULL){
+ if (sc->rx_m != NULL) {
m_freem(sc->rx_m);
sc->rx_m = NULL;
}
@@ -2633,7 +2633,7 @@ tr_setup:
}
/* If it is the last one or a single frame, we won't copy. */
- if((xferlen -= dmalen + 8) <= 8){
+ if ((xferlen -= dmalen + 8) <= 8) {
/* trim 32-bit DMA-len header */
m->m_data += 4;
m->m_pkthdr.len = m->m_len -= 4;
@@ -2673,7 +2673,7 @@ run_tx_free(struct run_endpoint_queue *p
m_freem(data->m);
data->m = NULL;
- if(data->ni == NULL) {
+ if (data->ni == NULL) {
DPRINTF("no node\n");
} else {
ieee80211_free_node(data->ni);
@@ -2703,7 +2703,7 @@ run_bulk_tx_callbackN(struct usb_xfer *x
usbd_xfer_status(xfer, &actlen, &sumlen, NULL, NULL);
- switch (USB_GET_STATE(xfer)){
+ switch (USB_GET_STATE(xfer)) {
case USB_ST_TRANSFERRED:
DPRINTFN(11, "transfer complete: %d "
"bytes @ index %d\n", actlen, index);
@@ -2721,7 +2721,7 @@ run_bulk_tx_callbackN(struct usb_xfer *x
case USB_ST_SETUP:
tr_setup:
data = STAILQ_FIRST(&pq->tx_qh);
- if(data == NULL)
+ if (data == NULL)
break;
STAILQ_REMOVE_HEAD(&pq->tx_qh, next);
@@ -2791,7 +2791,7 @@ tr_setup:
run_tx_free(pq, data, error);
usbd_xfer_set_priv(xfer, NULL);
}
- if(vap == NULL)
+ if (vap == NULL)
vap = TAILQ_FIRST(&ic->ic_vaps);
if (error != USB_ERR_CANCELLED) {
@@ -2909,7 +2909,7 @@ run_set_tx_desc(struct run_softc *sc, st
else
txwi->txop |= RT2860_TX_TXOP_BACKOFF;
- if(vap->iv_opmode != IEEE80211_M_STA && !IEEE80211_QOS_HAS_SEQ(wh))
+ if (vap->iv_opmode != IEEE80211_M_STA && !IEEE80211_QOS_HAS_SEQ(wh))
txwi->xflags |= RT2860_TX_NSEQ;
}
@@ -3037,8 +3037,8 @@ run_tx(struct run_softc *sc, struct mbuf
*
* FIFO stats doesn't count Tx with WCID 0xff, so we do this in run_tx().
*/
- if(sc->rvp_cnt > 1 || vap->iv_opmode == IEEE80211_M_HOSTAP ||
- vap->iv_opmode == IEEE80211_M_MBSS){
+ if (sc->rvp_cnt > 1 || vap->iv_opmode == IEEE80211_M_HOSTAP ||
+ vap->iv_opmode == IEEE80211_M_MBSS) {
uint16_t pid = (rt2860_rates[ridx].mcs + 1) & 0xf;
txwi->len |= htole16(pid << RT2860_TX_PID_SHIFT);
@@ -3054,7 +3054,7 @@ run_tx(struct run_softc *sc, struct mbuf
* run_ratectl_cb() via callout.
* Call it early. Otherwise overflow.
*/
- if(sc->fifo_cnt++ == 10){
+ if (sc->fifo_cnt++ == 10) {
/*
* With multiple vaps or if_bridge, if_start() is called
* with a non-sleepable lock, tcpinp. So, need to defer.
@@ -3275,7 +3275,7 @@ run_tx_param(struct run_softc *sc, struc
rate);
if (error) {
/* let caller free mbuf */
- return (error);
+ return error;
}
opflags |= /*XXX RT2573_TX_LONG_RETRY |*/ RT2860_TX_TXOP_SIFS;
}
@@ -3314,7 +3314,7 @@ run_tx_param(struct run_softc *sc, struc
usbd_transfer_start(sc->sc_xfer[0]);
- return (0);
+ return (0);
}
static int
@@ -3335,14 +3335,14 @@ run_raw_xmit(struct ieee80211_node *ni,
if (params == NULL) {
/* tx mgt packet */
- if ((error = run_tx_mgt(sc, m, ni)) != 0){
+ if ((error = run_tx_mgt(sc, m, ni)) != 0) {
ifp->if_oerrors++;
DPRINTF("mgt tx failed\n");
goto done;
}
} else {
/* tx raw packet with param */
- if ((error = run_tx_param(sc, m, ni, params)) != 0){
+ if ((error = run_tx_param(sc, m, ni, params)) != 0) {
ifp->if_oerrors++;
DPRINTF("tx with param failed\n");
goto done;
@@ -3354,7 +3354,7 @@ run_raw_xmit(struct ieee80211_node *ni,
done:
RUN_UNLOCK(sc);
- if(error != 0){
+ if (error != 0) {
if(m != NULL)
m_freem(m);
ieee80211_free_node(ni);
@@ -3413,13 +3413,13 @@ run_ioctl(struct ifnet *ifp, u_long cmd,
} else
run_update_promisc_locked(ifp);
} else {
- if(ifp->if_drv_flags & IFF_DRV_RUNNING &&
- (ic->ic_nrunning == 0 || sc->rvp_cnt <= 1)){
+ if (ifp->if_drv_flags & IFF_DRV_RUNNING &&
+ (ic->ic_nrunning == 0 || sc->rvp_cnt <= 1)) {
run_stop(sc);
}
}
RUN_UNLOCK(sc);
- if(startall)
+ if (startall)
ieee80211_start_all(ic);
break;
case SIOCGIFMEDIA:
@@ -3814,7 +3814,7 @@ run_set_chan(struct run_softc *sc, struc
chan = ieee80211_chan2ieee(ic, c);
if (chan == 0 || chan == IEEE80211_CHAN_ANY)
- return EINVAL;
+ return (EINVAL);
if (sc->mac_ver == 0x3572)
run_rt3572_set_chan(sc, chan);
@@ -3838,7 +3838,7 @@ run_set_chan(struct run_softc *sc, struc
run_delay(sc, 10);
- return 0;
+ return (0);
}
static void
@@ -3919,7 +3919,7 @@ run_update_beacon_cb(void *arg)
struct mbuf *m;
uint8_t ridx;
- if(vap->iv_bss->ni_chan == IEEE80211_CHAN_ANYC)
+ if (vap->iv_bss->ni_chan == IEEE80211_CHAN_ANYC)
return;
if ((m = ieee80211_beacon_alloc(vap->iv_bss, &RUN_VAP(vap)->bo)) == NULL)
@@ -3982,7 +3982,7 @@ run_usb_timeout_cb(void *arg)
if(vap->iv_state == IEEE80211_S_RUN &&
vap->iv_opmode != IEEE80211_M_STA)
run_reset_livelock(sc);
- else if(vap->iv_state == IEEE80211_S_SCAN){
+ else if (vap->iv_state == IEEE80211_S_SCAN) {
DPRINTF("timeout caused by scan\n");
/* cancel bgscan */
ieee80211_cancel_scan(vap);
@@ -4004,7 +4004,7 @@ run_reset_livelock(struct run_softc *sc)
*/
run_read(sc, RT2860_DEBUG, &tmp);
DPRINTFN(3, "debug reg %08x\n", tmp);
- if((tmp & (1 << 29)) && (tmp & (1 << 7 | 1 << 5))){
+ if ((tmp & (1 << 29)) && (tmp & (1 << 7 | 1 << 5))) {
DPRINTF("CTS-to-self livelock detected\n");
run_write(sc, RT2860_MAC_SYS_CTRL, RT2860_MAC_SRST);
run_delay(sc, 1);
@@ -4203,7 +4203,7 @@ run_rssi2dbm(struct run_softc *sc, uint8
} else
delta = sc->rssi_2ghz[rxchain] - sc->lna[0];
- return -12 - delta - rssi;
+ return (-12 - delta - rssi);
}
static int
@@ -4220,7 +4220,7 @@ run_bbp_init(struct run_softc *sc)
break;
}
if (ntries == 20)
- return ETIMEDOUT;
+ return (ETIMEDOUT);
/* initialize BBP registers to default values */
for (i = 0; i < nitems(rt2860_def_bbp); i++) {
@@ -4240,7 +4240,7 @@ run_bbp_init(struct run_softc *sc)
run_bbp_write(sc, 69, 0x16);
run_bbp_write(sc, 73, 0x12);
}
- return 0;
+ return (0);
}
static int
@@ -4292,7 +4292,7 @@ run_rt3070_rf_init(struct run_softc *sc)
run_read(sc, RT3070_GPIO_SWITCH, &tmp);
run_write(sc, RT3070_GPIO_SWITCH, tmp & ~0x20);
- } else if(sc->mac_ver == 0x3572){
+ } else if (sc->mac_ver == 0x3572) {
run_rt3070_rf_read(sc, 6, &rf);
run_rt3070_rf_write(sc, 6, rf | 0x40);
@@ -4301,7 +4301,7 @@ run_rt3070_rf_init(struct run_softc *sc)
tmp = (tmp & ~0x1f000000) | 0x0d000000;
run_write(sc, RT3070_LDO_CFG0, tmp);
- if (sc->mac_rev < 0x0211 || !sc->patch_dac){
+ if (sc->mac_rev < 0x0211 || !sc->patch_dac) {
run_delay(sc, 1); /* wait for 1msec */
/* decrease voltage back to 1.2V */
tmp = (tmp & ~0x1f000000) | 0x01000000;
@@ -4379,7 +4379,7 @@ run_rt3070_rf_init(struct run_softc *sc)
rf |= 0x03;
run_rt3070_rf_write(sc, 27, rf);
}
- return 0;
+ return (0);
}
static int
@@ -4444,7 +4444,7 @@ run_rt3070_filter_calib(struct run_softc
run_rt3070_rf_read(sc, 22, &rf22);
run_rt3070_rf_write(sc, 22, rf22 & ~0x01);
- return 0;
+ return (0);
}
static void
@@ -4570,7 +4570,7 @@ run_txrx_enable(struct run_softc *sc)
run_write(sc, RT2860_MAC_SYS_CTRL,
RT2860_MAC_RX_EN | RT2860_MAC_TX_EN);
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-stable
mailing list