提交 8ea54c9f 编写于 作者: H Henry Ptasinski 提交者: Greg Kroah-Hartman

staging: brcm80211: fix for 'remove unnecessary braces' checkpatch warning

Removed unnecessary braces in single-statement blocks. Used the tools
'uncrustify' and 'coccinelle' to accomplish this.
Signed-off-by: NHenry Ptasinski <henryp@broadcom.com>
Reviewed-by: NArend van Spriel <arend@broadcom.com>
Reviewed-by: NRoland Vossen <rvossen@broadcom.com>
Signed-off-by: NArend van Spriel <arend@broadcom.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 5973f660
......@@ -218,10 +218,9 @@ static int brcmf_sdioh_enablefuncs(struct sdioh_info *sd)
sdio_claim_host(gInstance->func[1]);
err_ret = sdio_enable_func(gInstance->func[1]);
sdio_release_host(gInstance->func[1]);
if (err_ret) {
if (err_ret)
sd_err(("brcmf_sdioh_enablefuncs: Failed to enable F1 "
"Err: 0x%08x\n", err_ret));
}
return false;
}
......@@ -763,35 +762,32 @@ brcmf_sdioh_request_word(struct sdioh_info *sd, uint cmd_type, uint rw,
sdio_claim_host(gInstance->func[func]);
if (rw) { /* CMD52 Write */
if (nbytes == 4) {
if (nbytes == 4)
sdio_writel(gInstance->func[func], *word, addr,
&err_ret);
} else if (nbytes == 2) {
else if (nbytes == 2)
sdio_writew(gInstance->func[func], (*word & 0xFFFF),
addr, &err_ret);
} else {
else
sd_err(("%s: Invalid nbytes: %d\n", __func__, nbytes));
}
} else { /* CMD52 Read */
if (nbytes == 4) {
if (nbytes == 4)
*word =
sdio_readl(gInstance->func[func], addr, &err_ret);
} else if (nbytes == 2) {
else if (nbytes == 2)
*word =
sdio_readw(gInstance->func[func], addr,
&err_ret) & 0xFFFF;
} else {
else
sd_err(("%s: Invalid nbytes: %d\n", __func__, nbytes));
}
}
/* Release host controller */
sdio_release_host(gInstance->func[func]);
if (err_ret) {
if (err_ret)
sd_err(("brcmf: Failed to %s word, Err: 0x%08x\n",
rw ? "Write" : "Read", err_ret));
}
return err_ret;
}
......
......@@ -284,18 +284,17 @@ bool brcmf_c_prec_enq(struct brcmf_pub *drvr, struct pktq *q,
/* Evict packet according to discard policy */
p = discard_oldest ? brcmu_pktq_pdeq(q, eprec) :
brcmu_pktq_pdeq_tail(q, eprec);
if (p == NULL) {
if (p == NULL)
BRCMF_ERROR(("%s: brcmu_pktq_penq() failed, oldest %d.",
__func__, discard_oldest));
}
brcmu_pkt_buf_free_skb(p);
}
/* Enqueue */
p = brcmu_pktq_penq(q, prec, pkt);
if (p == NULL) {
if (p == NULL)
BRCMF_ERROR(("%s: brcmu_pktq_penq() failed.", __func__));
}
return p != NULL;
}
......@@ -542,20 +541,19 @@ brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data)
case BRCMF_E_ASSOC:
case BRCMF_E_REASSOC:
if (status == BRCMF_E_STATUS_SUCCESS) {
if (status == BRCMF_E_STATUS_SUCCESS)
BRCMF_EVENT(("MACEVENT: %s, MAC %s, SUCCESS\n",
event_name, eabuf));
} else if (status == BRCMF_E_STATUS_TIMEOUT) {
else if (status == BRCMF_E_STATUS_TIMEOUT)
BRCMF_EVENT(("MACEVENT: %s, MAC %s, TIMEOUT\n",
event_name, eabuf));
} else if (status == BRCMF_E_STATUS_FAIL) {
else if (status == BRCMF_E_STATUS_FAIL)
BRCMF_EVENT(("MACEVENT: %s, MAC %s, FAILURE,"
" reason %d\n", event_name, eabuf,
(int)reason));
} else {
else
BRCMF_EVENT(("MACEVENT: %s, MAC %s, unexpected status "
"%d\n", event_name, eabuf, (int)status));
}
break;
case BRCMF_E_DEAUTH_IND:
......@@ -574,16 +572,16 @@ brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data)
sprintf(err_msg, "AUTH unknown: %d", (int)auth_type);
auth_str = err_msg;
}
if (event_type == BRCMF_E_AUTH_IND) {
if (event_type == BRCMF_E_AUTH_IND)
BRCMF_EVENT(("MACEVENT: %s, MAC %s, %s\n", event_name,
eabuf, auth_str));
} else if (status == BRCMF_E_STATUS_SUCCESS) {
else if (status == BRCMF_E_STATUS_SUCCESS)
BRCMF_EVENT(("MACEVENT: %s, MAC %s, %s, SUCCESS\n",
event_name, eabuf, auth_str));
} else if (status == BRCMF_E_STATUS_TIMEOUT) {
else if (status == BRCMF_E_STATUS_TIMEOUT)
BRCMF_EVENT(("MACEVENT: %s, MAC %s, %s, TIMEOUT\n",
event_name, eabuf, auth_str));
} else if (status == BRCMF_E_STATUS_FAIL) {
else if (status == BRCMF_E_STATUS_FAIL) {
BRCMF_EVENT(("MACEVENT: %s, MAC %s, %s, FAILURE, "
"reason %d\n",
event_name, eabuf, auth_str, (int)reason));
......@@ -594,29 +592,27 @@ brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data)
case BRCMF_E_JOIN:
case BRCMF_E_ROAM:
case BRCMF_E_SET_SSID:
if (status == BRCMF_E_STATUS_SUCCESS) {
if (status == BRCMF_E_STATUS_SUCCESS)
BRCMF_EVENT(("MACEVENT: %s, MAC %s\n", event_name,
eabuf));
} else if (status == BRCMF_E_STATUS_FAIL) {
else if (status == BRCMF_E_STATUS_FAIL)
BRCMF_EVENT(("MACEVENT: %s, failed\n", event_name));
} else if (status == BRCMF_E_STATUS_NO_NETWORKS) {
else if (status == BRCMF_E_STATUS_NO_NETWORKS)
BRCMF_EVENT(("MACEVENT: %s, no networks found\n",
event_name));
} else {
else
BRCMF_EVENT(("MACEVENT: %s, unexpected status %d\n",
event_name, (int)status));
}
break;
case BRCMF_E_BEACON_RX:
if (status == BRCMF_E_STATUS_SUCCESS) {
if (status == BRCMF_E_STATUS_SUCCESS)
BRCMF_EVENT(("MACEVENT: %s, SUCCESS\n", event_name));
} else if (status == BRCMF_E_STATUS_FAIL) {
else if (status == BRCMF_E_STATUS_FAIL)
BRCMF_EVENT(("MACEVENT: %s, FAIL\n", event_name));
} else {
else
BRCMF_EVENT(("MACEVENT: %s, status %d\n", event_name,
status));
}
break;
case BRCMF_E_LINK:
......@@ -1111,11 +1107,10 @@ int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr)
/* Set Country code */
if (drvr->country_code[0] != 0) {
if (brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_COUNTRY,
drvr->country_code,
sizeof(drvr->country_code)) < 0) {
drvr->country_code,
sizeof(drvr->country_code)) < 0)
BRCMF_ERROR(("%s: country code setting failed\n",
__func__));
}
}
/* query for 'ver' to get version info from firmware */
......
......@@ -412,12 +412,11 @@ static int _brcmf_set_mac_address(struct brcmf_info *drvr_priv, int ifidx, u8 *a
ioc.set = true;
ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.buf, ioc.len);
if (ret < 0) {
if (ret < 0)
BRCMF_ERROR(("%s: set cur_etheraddr failed\n",
brcmf_ifname(&drvr_priv->pub, ifidx)));
} else {
else
memcpy(drvr_priv->iflist[ifidx]->net->dev_addr, addr, ETH_ALEN);
}
return ret;
}
......@@ -771,9 +770,9 @@ void brcmf_rx_frame(struct brcmf_pub *drvr, int ifidx, struct sk_buff *skb,
drvr->dstats.rx_bytes += skb->len;
drvr->rx_packets++; /* Local count */
if (in_interrupt()) {
if (in_interrupt())
netif_rx(skb);
} else {
else
/* If the receive is not processed inside an ISR,
* the softirqd must be woken explicitly to service
* the NET_RX_SOFTIRQ. In 2.6 kernels, this is handled
......@@ -781,7 +780,6 @@ void brcmf_rx_frame(struct brcmf_pub *drvr, int ifidx, struct sk_buff *skb,
* to do it manually.
*/
netif_rx_ni(skb);
}
}
}
......@@ -816,10 +814,9 @@ static struct net_device_stats *brcmf_netdev_get_stats(struct net_device *net)
ifp = drvr_priv->iflist[ifidx];
if (drvr_priv->pub.up) {
if (drvr_priv->pub.up)
/* Use the protocol to get dongle stats */
brcmf_proto_dstats(&drvr_priv->pub);
}
/* Copy dongle stats to net device stats */
ifp->stats.rx_packets = drvr_priv->pub.dstats.rx_packets;
......
......@@ -1127,10 +1127,9 @@ static int brcmf_sdbrcm_htclk(struct brcmf_bus *bus, bool on, bool pendok)
#if defined(BCMDBG)
if (bus->alp_only != true) {
if (SBSDIO_ALPONLY(clkctl)) {
if (SBSDIO_ALPONLY(clkctl))
BRCMF_ERROR(("%s: HT Clock should be on.\n",
__func__));
}
}
#endif /* defined (BCMDBG) */
......@@ -1428,9 +1427,8 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_bus *bus, struct sk_buff *pkt, uint c
}
/* Some controllers have trouble with odd bytes -- round to even */
if (forcealign && (len & (ALIGNMENT - 1))) {
if (forcealign && (len & (ALIGNMENT - 1)))
len = roundup(len, ALIGNMENT);
}
do {
ret = brcmf_sdbrcm_send_buf(bus, brcmf_sdcard_cur_sbwad(card),
......@@ -1782,10 +1780,10 @@ brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen)
}
}
if (ret == 0) {
if (ret == 0)
bus->tx_seq =
(bus->tx_seq + 1) % SDPCM_SEQUENCE_WRAP;
}
} while ((ret < 0) && retries++ < TXRETRIES);
}
......@@ -2181,10 +2179,9 @@ brcmf_sdbrcm_membytes(struct brcmf_bus *bus, bool write, u32 address, u8 *data,
xfer_done:
/* Return the window to backplane enumeration space for core access */
if (brcmf_sdbrcm_set_siaddr_window(bus,
brcmf_sdcard_cur_sbwad(bus->card))) {
brcmf_sdcard_cur_sbwad(bus->card)))
BRCMF_ERROR(("%s: FAILED to set window back to 0x%x\n",
__func__, brcmf_sdcard_cur_sbwad(bus->card)));
}
return bcmerror;
}
......@@ -2287,13 +2284,12 @@ static int brcmf_sdbrcm_checkdied(struct brcmf_bus *bus, u8 *data, uint size)
"msgtrace address : 0x%08X\nconsole address : 0x%08X\n",
sdpcm_shared.msgtrace_addr, sdpcm_shared.console_addr);
if ((sdpcm_shared.flags & SDPCM_SHARED_ASSERT_BUILT) == 0) {
if ((sdpcm_shared.flags & SDPCM_SHARED_ASSERT_BUILT) == 0)
/* NOTE: Misspelled assert is intentional - DO NOT FIX.
* (Avoids conflict with real asserts for programmatic
* parsing of output.)
*/
brcmu_bprintf(&strbuf, "Assrt not built in dongle\n");
}
if ((sdpcm_shared.flags & (SDPCM_SHARED_ASSERT | SDPCM_SHARED_TRAP)) ==
0) {
......@@ -2358,10 +2354,10 @@ static int brcmf_sdbrcm_checkdied(struct brcmf_bus *bus, u8 *data, uint size)
BRCMF_ERROR(("%s: %s\n", __func__, strbuf.origbuf));
#ifdef BCMDBG
if (sdpcm_shared.flags & SDPCM_SHARED_TRAP) {
if (sdpcm_shared.flags & SDPCM_SHARED_TRAP)
/* Mem dump to a file on device */
brcmf_sdbrcm_mem_dump(bus);
}
#endif /* BCMDBG */
done:
......@@ -2591,11 +2587,10 @@ brcmf_sdbrcm_doiovar(struct brcmf_bus *bus, const struct brcmu_iovar *vi, u32 ac
if (bus->drvr->up) {
BRCMF_INTR(("%s: %s SDIO interrupts\n", __func__,
bus->intr ? "enable" : "disable"));
if (bus->intr) {
if (bus->intr)
brcmf_sdcard_intr_enable(bus->card);
} else {
else
brcmf_sdcard_intr_disable(bus->card);
}
}
break;
......@@ -3016,10 +3011,10 @@ static int brcmf_sdbrcm_write_vars(struct brcmf_bus *bus)
varsize, varaddr));
}
/* Compare the org NVRAM with the one read from RAM */
if (memcmp(vbuffer, nvram_ularray, varsize)) {
if (memcmp(vbuffer, nvram_ularray, varsize))
BRCMF_ERROR(("%s: Downloaded NVRAM image is "
"corrupted.\n", __func__));
} else
else
BRCMF_ERROR(("%s: Download/Upload/Compare of"
" NVRAM ok.\n", __func__));
......@@ -3249,10 +3244,9 @@ void brcmf_sdbrcm_bus_stop(struct brcmf_bus *bus, bool enforce_mutex)
SBSDIO_FUNC1_CHIPCLKCSR,
(saveclk | SBSDIO_FORCE_HT), &err);
}
if (err) {
if (err)
BRCMF_ERROR(("%s: Failed to force clock for F2: err %d\n",
__func__, err));
}
/* Turn off the bus (F2), free any pending packets */
BRCMF_INTR(("%s: disable SDIO interrupts\n", __func__));
......@@ -3456,13 +3450,12 @@ static void brcmf_sdbrcm_rxfail(struct brcmf_bus *bus, bool abort, bool rtx)
lastrbc = (hi << 8) + lo;
}
if (!retries) {
if (!retries)
BRCMF_ERROR(("%s: count never zeroed: last 0x%04x\n",
__func__, lastrbc));
} else {
else
BRCMF_INFO(("%s: flush took %d iterations\n", __func__,
(0xffff - retries)));
}
if (rtx) {
bus->rxrtx++;
......@@ -3936,11 +3929,11 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_bus *bus, u8 rxseq)
if (pfirst->len == 0) {
brcmu_pkt_buf_free_skb(pfirst);
if (plast) {
if (plast)
plast->next = pnext;
} else {
else
save_pfirst = pnext;
}
continue;
} else if (brcmf_proto_hdrpull(bus->drvr, &ifidx, pfirst)
!= 0) {
......@@ -3948,11 +3941,11 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_bus *bus, u8 rxseq)
__func__));
bus->drvr->rx_errors++;
brcmu_pkt_buf_free_skb(pfirst);
if (plast) {
if (plast)
plast->next = pnext;
} else {
else
save_pfirst = pnext;
}
continue;
}
......@@ -4647,10 +4640,9 @@ static u32 brcmf_sdbrcm_hostmail(struct brcmf_bus *bus)
HMB_DATA_NAKHANDLED |
HMB_DATA_FC |
HMB_DATA_FWREADY |
HMB_DATA_FCDATA_MASK | HMB_DATA_VERSION_MASK)) {
HMB_DATA_FCDATA_MASK | HMB_DATA_VERSION_MASK))
BRCMF_ERROR(("Unknown mailbox data content: 0x%02x\n",
hmb_data));
}
return intstatus;
}
......@@ -5773,13 +5765,13 @@ static bool brcmf_sdbrcm_probe_init(struct brcmf_bus *bus, void *card)
default to use if supported */
if (brcmf_sdcard_iovar_op(card, "sd_rxchain", NULL, 0,
&bus->sd_rxchain, sizeof(s32),
false) != 0) {
false) != 0)
bus->sd_rxchain = false;
} else {
else
BRCMF_INFO(("%s: bus module (through sdiocard API) %s"
" chaining\n", __func__, bus->sd_rxchain
? "supports" : "does not support"));
}
bus->use_rxchain = (bool) bus->sd_rxchain;
return true;
......@@ -5864,9 +5856,8 @@ static void brcmf_sdbrcm_disconnect(void *ptr)
BRCMF_TRACE(("%s: Enter\n", __func__));
if (bus) {
if (bus)
brcmf_sdbrcm_release(bus);
}
BRCMF_TRACE(("%s: Disconnected\n", __func__));
}
......@@ -6085,10 +6076,9 @@ static int _brcmf_sdbrcm_download_firmware(struct brcmf_bus *bus)
}
/* External nvram takes precedence if specified */
if (brcmf_sdbrcm_download_nvram(bus)) {
if (brcmf_sdbrcm_download_nvram(bus))
BRCMF_ERROR(("%s: dongle nvram file download failed\n",
__func__));
}
/* Take arm out of reset */
if (brcmf_sdbrcm_download_state(bus, false)) {
......
......@@ -677,12 +677,12 @@ brcmf_run_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan,
err = brcmf_dev_iovar_setbuf(iscan->dev, "iscan", params, params_size,
iscan->ioctl_buf, BRCMF_C_IOCTL_SMLEN);
if (unlikely(err)) {
if (err == -EBUSY) {
if (err == -EBUSY)
WL_INFO("system busy : iscan canceled\n");
} else {
else
WL_ERR("error (%d)\n", err);
}
}
kfree(params);
return err;
}
......@@ -790,12 +790,12 @@ __brcmf_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
err = brcmf_dev_ioctl(ndev, BRCMF_C_SCAN, &sr->ssid,
sizeof(sr->ssid));
if (err) {
if (err == -EBUSY) {
if (err == -EBUSY)
WL_INFO("system busy : scan for \"%s\" canceled\n",
sr->ssid.SSID);
} else {
else
WL_ERR("WLC_SCAN error (%d)\n", err);
}
brcmf_set_mpc(ndev, 1);
goto scan_out;
}
......@@ -1049,6 +1049,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
} else {
memcpy(join_params.params.bssid, ether_bcast, ETH_ALEN);
}
brcmf_update_prof(cfg_priv, NULL,
&join_params.params.bssid, WL_PROF_BSSID);
......@@ -1430,10 +1431,9 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
memcpy(join_params.params.bssid, ether_bcast, ETH_ALEN);
if (join_params.ssid.SSID_len < IEEE80211_MAX_SSID_LEN) {
if (join_params.ssid.SSID_len < IEEE80211_MAX_SSID_LEN)
WL_CONN("ssid \"%s\", len (%d)\n",
join_params.ssid.SSID, join_params.ssid.SSID_len);
}
brcmf_ch_to_chanspec(cfg_priv->channel,
&join_params, &join_params_size);
......@@ -1946,9 +1946,9 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
scb_val.val = 0;
err = brcmf_dev_ioctl(dev, BRCMF_C_GET_RSSI, &scb_val,
sizeof(struct brcmf_scb_val));
if (unlikely(err)) {
if (unlikely(err))
WL_ERR("Could not get rssi (%d)\n", err);
}
rssi = le32_to_cpu(scb_val.val);
sinfo->filled |= STATION_INFO_SIGNAL;
sinfo->signal = rssi;
......@@ -3523,13 +3523,13 @@ static s32 brcmf_event_handler(void *data)
BUG();
}
WL_INFO("event type (%d)\n", e->etype);
if (cfg_priv->el.handler[e->etype]) {
if (cfg_priv->el.handler[e->etype])
cfg_priv->el.handler[e->etype](cfg_priv,
cfg_to_ndev(cfg_priv),
&e->emsg, e->edata);
} else {
else
WL_INFO("Unknown Event (%d): ignoring\n", e->etype);
}
brcmf_put_event(e);
}
WL_INFO("was terminated\n");
......
......@@ -387,10 +387,10 @@ get_erom_ent(struct si_pub *sih, u32 **eromptr, u32 mask, u32 match)
}
SI_VMSG(("%s: Returning ent 0x%08x\n", __func__, ent));
if (inv + nom) {
if (inv + nom)
SI_VMSG((" after %d invalid and %d non-matching entries\n",
inv, nom));
}
return ent;
}
......@@ -511,9 +511,8 @@ void ai_scan(struct si_pub *sih, void *regs)
if (cid == OOB_ROUTER_CORE_ID) {
asd = get_asd(sih, &eromptr, 0, 0, AD_ST_SLAVE,
&addrl, &addrh, &sizel, &sizeh);
if (asd != 0) {
if (asd != 0)
sii->oob_router = addrl;
}
}
continue;
}
......@@ -650,13 +649,13 @@ void *ai_setcoreidx(struct si_pub *sih, uint coreidx)
switch (sih->bustype) {
case SI_BUS:
/* map new one */
if (!sii->regs[coreidx]) {
if (!sii->regs[coreidx])
sii->regs[coreidx] = REG_MAP(addr, SI_CORE_SIZE);
}
sii->curmap = regs = sii->regs[coreidx];
if (!sii->wrappers[coreidx]) {
if (!sii->wrappers[coreidx])
sii->wrappers[coreidx] = REG_MAP(wrap, SI_CORE_SIZE);
}
sii->curwrap = sii->wrappers[coreidx];
break;
......@@ -1063,9 +1062,8 @@ static __used void ai_nvram_process(struct si_info *sii, char *pvars)
break;
}
if (sii->pub.boardtype == 0) {
if (sii->pub.boardtype == 0)
SI_ERROR(("si_doattach: unknown board type\n"));
}
sii->pub.boardflags = getintvar(pvars, "boardflags");
}
......@@ -1195,9 +1193,8 @@ static struct si_info *ai_doattach(struct si_info *sii,
ai_corereg(sih, SI_CC_IDX, offsetof(struct chipcregs, gpiotimerval),
~0, w);
if (PCIE(sii)) {
if (PCIE(sii))
pcicore_attach(sii->pch, pvars, SI_DOATTACH);
}
if (sih->chip == BCM43224_CHIP_ID) {
/*
......@@ -1435,10 +1432,10 @@ uint ai_corereg(struct si_pub *sih, uint coreidx, uint regoff, uint mask,
/* If internal bus, we can always get at everything */
fast = true;
/* map if does not exist */
if (!sii->regs[coreidx]) {
if (!sii->regs[coreidx])
sii->regs[coreidx] = REG_MAP(sii->coresba[coreidx],
SI_CORE_SIZE);
}
r = (u32 *) ((unsigned char *) sii->regs[coreidx] + regoff);
} else if (sih->bustype == PCI_BUS) {
/*
......@@ -2187,16 +2184,15 @@ void ai_chipcontrl_epa4331(struct si_pub *sih, bool on)
val = R_REG(&cc->chipcontrol);
if (on) {
if (sih->chippkg == 9 || sih->chippkg == 0xb) {
if (sih->chippkg == 9 || sih->chippkg == 0xb)
/* Ext PA Controls for 4331 12x9 Package */
W_REG(&cc->chipcontrol, val |
(CCTRL4331_EXTPA_EN |
CCTRL4331_EXTPA_ON_GPIO2_5));
} else {
else
/* Ext PA Controls for 4331 12x12 Package */
W_REG(&cc->chipcontrol,
val | (CCTRL4331_EXTPA_EN));
}
} else {
val &= ~(CCTRL4331_EXTPA_EN | CCTRL4331_EXTPA_ON_GPIO2_5);
W_REG(&cc->chipcontrol, val);
......
......@@ -161,11 +161,10 @@ struct brcms_c_info *brcms_c_attach_malloc(uint unit, uint *err, uint devid)
} else {
int i;
for (i = 1; i < MAXBANDS; i++) {
for (i = 1; i < MAXBANDS; i++)
wlc->hw->bandstate[i] = (struct brcms_hw_band *)
((unsigned long)wlc->hw->bandstate[0] +
(sizeof(struct brcms_hw_band) * i));
}
}
wlc->modulecb =
......@@ -196,11 +195,10 @@ struct brcms_c_info *brcms_c_attach_malloc(uint unit, uint *err, uint devid)
goto fail;
} else {
int i;
for (i = 1; i < BRCMS_DEFAULT_KEYS; i++) {
for (i = 1; i < BRCMS_DEFAULT_KEYS; i++)
wlc->wsec_def_keys[i] = (struct wsec_key *)
((unsigned long)wlc->wsec_def_keys[0] +
(sizeof(struct wsec_key) * i));
}
}
wlc->protection = kzalloc(sizeof(struct brcms_protection),
......@@ -224,11 +222,10 @@ struct brcms_c_info *brcms_c_attach_malloc(uint unit, uint *err, uint devid)
} else {
int i;
for (i = 1; i < MAXBANDS; i++) {
for (i = 1; i < MAXBANDS; i++)
wlc->bandstate[i] = (struct brcms_band *)
((unsigned long)wlc->bandstate[0]
+ (sizeof(struct brcms_band)*i));
}
}
wlc->corestate = kzalloc(sizeof(struct brcms_core), GFP_ATOMIC);
......
......@@ -195,9 +195,8 @@ void brcms_c_ampdu_detach(struct ampdu_info *ampdu)
return;
/* free all ini's which were to be freed on callbacks which were never called */
for (i = 0; i < AMPDU_INI_FREE; i++) {
for (i = 0; i < AMPDU_INI_FREE; i++)
kfree(ampdu->ini_free[i]);
}
brcms_c_module_unregister(ampdu->wlc->pub, "ampdu", ampdu);
kfree(ampdu);
......@@ -317,9 +316,9 @@ static int brcms_c_ffpld_check_txfunfl(struct brcms_c_info *wlc, int fid)
txunfl_ratio = current_ampdu_cnt / fifo->accum_txfunfl;
if (txunfl_ratio > ampdu->tx_max_funl) {
if (current_ampdu_cnt >= FFPLD_MAX_AMPDU_CNT) {
if (current_ampdu_cnt >= FFPLD_MAX_AMPDU_CNT)
fifo->accum_txfunfl = 0;
}
return 0;
}
max_mpdu =
......@@ -486,10 +485,9 @@ brcms_c_sendampdu(struct ampdu_info *ampdu, struct brcms_txq_info *qi,
/* Let pressure continue to build ... */
qlen = pktq_plen(&qi->q, prec);
if (ini->tx_in_transit > 0 &&
qlen < min(scb_ampdu->max_pdu, ini->ba_wsize)) {
qlen < min(scb_ampdu->max_pdu, ini->ba_wsize))
/* Collect multiple MPDU's to be sent in the next AMPDU */
return -EBUSY;
}
/* at this point we intend to transmit an AMPDU */
rr_retry_limit = ampdu->rr_retry_limit_tid[tid];
......@@ -665,9 +663,8 @@ brcms_c_sendampdu(struct ampdu_info *ampdu, struct brcms_txq_info *qi,
break;
}
if (count == scb_ampdu->max_pdu) {
if (count == scb_ampdu->max_pdu)
break;
}
/* check to see if the next pkt is a candidate for aggregation */
p = pktq_ppeek(&qi->q, prec);
......@@ -797,10 +794,10 @@ brcms_c_sendampdu(struct ampdu_info *ampdu, struct brcms_txq_info *qi,
/* inform rate_sel if it this is a rate probe pkt */
frameid = le16_to_cpu(txh->TxFrameID);
if (frameid & TXFID_RATE_PROBE_MASK) {
if (frameid & TXFID_RATE_PROBE_MASK)
wiphy_err(wiphy, "%s: XXX what to do with "
"TXFID_RATE_PROBE_MASK!?\n", __func__);
}
for (i = 0; i < count; i++)
brcms_c_txfifo(wlc, fifo, pkt[i], i == (count - 1),
ampdu->txpkt_weight);
......@@ -833,9 +830,8 @@ brcms_c_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb,
while (((s1 = R_REG(&wlc->regs->frmtxstatus)) & TXS_V) == 0) {
udelay(1);
status_delay++;
if (status_delay > 10) {
if (status_delay > 10)
return; /* error condition */
}
}
s2 = R_REG(&wlc->regs->frmtxstatus2);
......@@ -923,9 +919,8 @@ brcms_c_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb,
supr_status = txs->status & TX_STATUS_SUPR_MASK;
if (txs->status & TX_STATUS_ACK_RCV) {
if (TX_STATUS_SUPR_UF == supr_status) {
if (TX_STATUS_SUPR_UF == supr_status)
update_rate = false;
}
WARN_ON(!(txs->status & TX_STATUS_INTERMEDIATE));
start_seq = txs->sequence >> SEQNUM_SHIFT;
......@@ -973,9 +968,8 @@ brcms_c_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb,
notify rate adaptation.
*/
if (brcms_c_ffpld_check_txfunfl(wlc,
prio2fifo[tid]) > 0) {
prio2fifo[tid]) > 0)
tx_error = true;
}
}
} else if (txs->phyerr) {
update_rate = false;
......@@ -1211,9 +1205,8 @@ void brcms_c_ampdu_flush(struct brcms_c_info *wlc,
ampdu_pars.sta = sta;
ampdu_pars.tid = tid;
for (prec = 0; prec < pq->num_prec; prec++) {
for (prec = 0; prec < pq->num_prec; prec++)
brcmu_pktq_pflush(pq, prec, true, cb_del_ampdu_pkt,
(void *)&ampdu_pars);
}
brcms_c_inval_dma_pkts(wlc->hw, sta, dma_cb_fn_ampdu);
}
......@@ -110,17 +110,16 @@ struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc)
if (((u16) getintvar(asi->pub->vars, "aa2g") == 7) ||
((u16) getintvar(asi->pub->vars, "aa5g") == 7)) {
asi->antsel_avail = true;
} else
if (((u16) getintvar(asi->pub->vars, "aa2g") ==
3)
|| ((u16) getintvar(asi->pub->vars, "aa5g")
== 3)) {
} else if (
(u16) getintvar(asi->pub->vars, "aa2g") == 3 ||
(u16) getintvar(asi->pub->vars, "aa5g") == 3) {
asi->antsel_avail = false;
} else {
asi->antsel_avail = false;
wiphy_err(wlc->wiphy, "antsel_attach: 2o3 "
"board cfg invalid\n");
}
break;
default:
break;
......
......@@ -409,10 +409,9 @@ static void brcms_c_locale_get_channels(const struct locale_info *locale,
memset(channels, 0, sizeof(struct brcms_chanvec));
for (i = 0; i < ARRAY_SIZE(g_table_locale_base); i++) {
if (locale->valid_channels & (1 << i)) {
if (locale->valid_channels & (1 << i))
brcms_c_locale_add_channels(channels,
g_table_locale_base[i]);
}
}
}
......@@ -590,33 +589,33 @@ struct chan20_info chan20_info[] = {
static const struct locale_info *brcms_c_get_locale_2g(u8 locale_idx)
{
if (locale_idx >= ARRAY_SIZE(g_locale_2g_table)) {
if (locale_idx >= ARRAY_SIZE(g_locale_2g_table))
return NULL; /* error condition */
}
return g_locale_2g_table[locale_idx];
}
static const struct locale_info *brcms_c_get_locale_5g(u8 locale_idx)
{
if (locale_idx >= ARRAY_SIZE(g_locale_5g_table)) {
if (locale_idx >= ARRAY_SIZE(g_locale_5g_table))
return NULL; /* error condition */
}
return g_locale_5g_table[locale_idx];
}
static const struct locale_mimo_info *brcms_c_get_mimo_2g(u8 locale_idx)
{
if (locale_idx >= ARRAY_SIZE(g_mimo_2g_table)) {
if (locale_idx >= ARRAY_SIZE(g_mimo_2g_table))
return NULL;
}
return g_mimo_2g_table[locale_idx];
}
static const struct locale_mimo_info *brcms_c_get_mimo_5g(u8 locale_idx)
{
if (locale_idx >= ARRAY_SIZE(g_mimo_5g_table)) {
if (locale_idx >= ARRAY_SIZE(g_mimo_5g_table))
return NULL;
}
return g_mimo_5g_table[locale_idx];
}
......@@ -642,9 +641,8 @@ struct brcms_cm_info *brcms_c_channel_mgr_attach(struct brcms_c_info *wlc)
/* store the country code for passing up as a regulatory hint */
ccode = getvar(wlc->pub->vars, "ccode");
if (ccode) {
if (ccode)
strncpy(wlc->pub->srom_ccode, ccode, BRCM_CNTRY_BUF_SZ - 1);
}
/* internal country information which must match regulatory constraints in firmware */
memset(country_abbrev, 0, BRCM_CNTRY_BUF_SZ);
......@@ -759,11 +757,10 @@ brcms_c_set_country_common(struct brcms_cm_info *wlc_cm,
brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_5G_INDEX]);
/* set or restore gmode as required by regulatory */
locale = brcms_c_get_locale_2g(country->locale_2G);
if (locale && (locale->flags & BRCMS_NO_OFDM)) {
if (locale && (locale->flags & BRCMS_NO_OFDM))
brcms_c_set_gmode(wlc, GMODE_LEGACY_B, false);
} else {
else
brcms_c_set_gmode(wlc, wlc->protection->gmode_user, false);
}
brcms_c_channels_init(wlc_cm, country);
......@@ -860,9 +857,8 @@ brcms_c_country_lookup_direct(const char *ccode, uint regrev)
/* find matched table entry from country code */
size = ARRAY_SIZE(cntry_locales);
for (i = 0; i < size; i++) {
if (strcmp(ccode, cntry_locales[i].abbrev) == 0) {
if (strcmp(ccode, cntry_locales[i].abbrev) == 0)
return &cntry_locales[i].country;
}
}
return NULL;
}
......@@ -929,9 +925,8 @@ static void brcms_c_channels_commit(struct brcms_cm_info *wlc_cm)
/* search for the existence of any valid channel */
for (chan = 0; chan < MAXCHANNEL; chan++) {
if (VALID_CHANNEL20_DB(wlc, chan)) {
if (VALID_CHANNEL20_DB(wlc, chan))
break;
}
}
if (chan == MAXCHANNEL)
chan = INVCHANNEL;
......@@ -944,9 +939,8 @@ static void brcms_c_channels_commit(struct brcms_cm_info *wlc_cm)
"nbands %d bandlocked %d\n", wlc->pub->unit,
__func__, wlc_cm->country_abbrev, NBANDS(wlc),
wlc->bandlocked);
} else
if (mboolisset(wlc->pub->radio_disabled,
WL_RADIO_COUNTRY_DISABLE)) {
} else if (mboolisset(wlc->pub->radio_disabled,
WL_RADIO_COUNTRY_DISABLE)) {
/* country/locale with valid channel, clear the radio disable bit */
mboolclr(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE);
}
......@@ -954,11 +948,10 @@ static void brcms_c_channels_commit(struct brcms_cm_info *wlc_cm)
/* Now that the country abbreviation is set, if the radio supports 2G, then
* set channel 14 restrictions based on the new locale.
*/
if (NBANDS(wlc) > 1 || BAND_2G(wlc->band->bandtype)) {
if (NBANDS(wlc) > 1 || BAND_2G(wlc->band->bandtype))
wlc_phy_chanspec_ch14_widefilter_set(wlc->band->pi,
brcms_c_japan(wlc) ? true :
false);
}
if (wlc->pub->up && chan != INVCHANNEL) {
brcms_c_channel_reg_limits(wlc_cm, wlc->chanspec, &txpwr);
......@@ -1043,50 +1036,42 @@ brcms_c_channel_min_txpower_limits_with_local_constraint(
int j;
/* CCK Rates */
for (j = 0; j < WL_TX_POWER_CCK_NUM; j++) {
for (j = 0; j < WL_TX_POWER_CCK_NUM; j++)
txpwr->cck[j] = min(txpwr->cck[j], local_constraint_qdbm);
}
/* 20 MHz Legacy OFDM SISO */
for (j = 0; j < WL_TX_POWER_OFDM_NUM; j++) {
for (j = 0; j < WL_TX_POWER_OFDM_NUM; j++)
txpwr->ofdm[j] = min(txpwr->ofdm[j], local_constraint_qdbm);
}
/* 20 MHz Legacy OFDM CDD */
for (j = 0; j < BRCMS_NUM_RATES_OFDM; j++) {
for (j = 0; j < BRCMS_NUM_RATES_OFDM; j++)
txpwr->ofdm_cdd[j] =
min(txpwr->ofdm_cdd[j], local_constraint_qdbm);
}
/* 40 MHz Legacy OFDM SISO */
for (j = 0; j < BRCMS_NUM_RATES_OFDM; j++) {
for (j = 0; j < BRCMS_NUM_RATES_OFDM; j++)
txpwr->ofdm_40_siso[j] =
min(txpwr->ofdm_40_siso[j], local_constraint_qdbm);
}
/* 40 MHz Legacy OFDM CDD */
for (j = 0; j < BRCMS_NUM_RATES_OFDM; j++) {
for (j = 0; j < BRCMS_NUM_RATES_OFDM; j++)
txpwr->ofdm_40_cdd[j] =
min(txpwr->ofdm_40_cdd[j], local_constraint_qdbm);
}
/* 20MHz MCS 0-7 SISO */
for (j = 0; j < BRCMS_NUM_RATES_MCS_1_STREAM; j++) {
for (j = 0; j < BRCMS_NUM_RATES_MCS_1_STREAM; j++)
txpwr->mcs_20_siso[j] =
min(txpwr->mcs_20_siso[j], local_constraint_qdbm);
}
/* 20MHz MCS 0-7 CDD */
for (j = 0; j < BRCMS_NUM_RATES_MCS_1_STREAM; j++) {
for (j = 0; j < BRCMS_NUM_RATES_MCS_1_STREAM; j++)
txpwr->mcs_20_cdd[j] =
min(txpwr->mcs_20_cdd[j], local_constraint_qdbm);
}
/* 20MHz MCS 0-7 STBC */
for (j = 0; j < BRCMS_NUM_RATES_MCS_1_STREAM; j++) {
for (j = 0; j < BRCMS_NUM_RATES_MCS_1_STREAM; j++)
txpwr->mcs_20_stbc[j] =
min(txpwr->mcs_20_stbc[j], local_constraint_qdbm);
}
/* 20MHz MCS 8-15 MIMO */
for (j = 0; j < BRCMS_NUM_RATES_MCS_2_STREAM; j++)
......@@ -1094,22 +1079,19 @@ brcms_c_channel_min_txpower_limits_with_local_constraint(
min(txpwr->mcs_20_mimo[j], local_constraint_qdbm);
/* 40MHz MCS 0-7 SISO */
for (j = 0; j < BRCMS_NUM_RATES_MCS_1_STREAM; j++) {
for (j = 0; j < BRCMS_NUM_RATES_MCS_1_STREAM; j++)
txpwr->mcs_40_siso[j] =
min(txpwr->mcs_40_siso[j], local_constraint_qdbm);
}
/* 40MHz MCS 0-7 CDD */
for (j = 0; j < BRCMS_NUM_RATES_MCS_1_STREAM; j++) {
for (j = 0; j < BRCMS_NUM_RATES_MCS_1_STREAM; j++)
txpwr->mcs_40_cdd[j] =
min(txpwr->mcs_40_cdd[j], local_constraint_qdbm);
}
/* 40MHz MCS 0-7 STBC */
for (j = 0; j < BRCMS_NUM_RATES_MCS_1_STREAM; j++) {
for (j = 0; j < BRCMS_NUM_RATES_MCS_1_STREAM; j++)
txpwr->mcs_40_stbc[j] =
min(txpwr->mcs_40_stbc[j], local_constraint_qdbm);
}
/* 40MHz MCS 8-15 MIMO */
for (j = 0; j < BRCMS_NUM_RATES_MCS_2_STREAM; j++)
......@@ -1146,112 +1128,100 @@ static void wlc_phy_txpower_limits_dump(struct txpwr_limits *txpwr)
char fraction[4][4] = { " ", ".25", ".5 ", ".75" };
sprintf(buf, "CCK ");
for (i = 0; i < BRCMS_NUM_RATES_CCK; i++) {
for (i = 0; i < BRCMS_NUM_RATES_CCK; i++)
sprintf(buf[strlen(buf)], " %2d%s",
txpwr->cck[i] / BRCMS_TXPWR_DB_FACTOR,
fraction[txpwr->cck[i] % BRCMS_TXPWR_DB_FACTOR]);
}
printk(KERN_DEBUG "%s\n", buf);
sprintf(buf, "20 MHz OFDM SISO ");
for (i = 0; i < BRCMS_NUM_RATES_OFDM; i++) {
for (i = 0; i < BRCMS_NUM_RATES_OFDM; i++)
sprintf(buf[strlen(buf)], " %2d%s",
txpwr->ofdm[i] / BRCMS_TXPWR_DB_FACTOR,
fraction[txpwr->ofdm[i] % BRCMS_TXPWR_DB_FACTOR]);
}
printk(KERN_DEBUG "%s\n", buf);
sprintf(buf, "20 MHz OFDM CDD ");
for (i = 0; i < BRCMS_NUM_RATES_OFDM; i++) {
for (i = 0; i < BRCMS_NUM_RATES_OFDM; i++)
sprintf(buf[strlen(buf)], " %2d%s",
txpwr->ofdm_cdd[i] / BRCMS_TXPWR_DB_FACTOR,
fraction[txpwr->ofdm_cdd[i] % BRCMS_TXPWR_DB_FACTOR]);
}
printk(KERN_DEBUG "%s\n", buf);
sprintf(buf, "40 MHz OFDM SISO ");
for (i = 0; i < BRCMS_NUM_RATES_OFDM; i++) {
for (i = 0; i < BRCMS_NUM_RATES_OFDM; i++)
sprintf(buf[strlen(buf)], " %2d%s",
txpwr->ofdm_40_siso[i] / BRCMS_TXPWR_DB_FACTOR,
fraction[txpwr->ofdm_40_siso[i] %
BRCMS_TXPWR_DB_FACTOR]);
}
printk(KERN_DEBUG "%s\n", buf);
sprintf(buf, "40 MHz OFDM CDD ");
for (i = 0; i < BRCMS_NUM_RATES_OFDM; i++) {
for (i = 0; i < BRCMS_NUM_RATES_OFDM; i++)
sprintf(buf[strlen(buf)], " %2d%s",
txpwr->ofdm_40_cdd[i] / BRCMS_TXPWR_DB_FACTOR,
fraction[txpwr->ofdm_40_cdd[i] %
BRCMS_TXPWR_DB_FACTOR]);
}
printk(KERN_DEBUG "%s\n", buf);
sprintf(buf, "20 MHz MCS0-7 SISO ");
for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) {
for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++)
sprintf(buf[strlen(buf)], " %2d%s",
txpwr->mcs_20_siso[i] / BRCMS_TXPWR_DB_FACTOR,
fraction[txpwr->mcs_20_siso[i] %
BRCMS_TXPWR_DB_FACTOR]);
}
printk(KERN_DEBUG "%s\n", buf);
sprintf(buf, "20 MHz MCS0-7 CDD ");
for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) {
for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++)
sprintf(buf[strlen(buf)], " %2d%s",
txpwr->mcs_20_cdd[i] / BRCMS_TXPWR_DB_FACTOR,
fraction[txpwr->mcs_20_cdd[i] %
BRCMS_TXPWR_DB_FACTOR]);
}
printk(KERN_DEBUG "%s\n", buf);
sprintf(buf, "20 MHz MCS0-7 STBC ");
for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) {
for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++)
sprintf(buf[strlen(buf)], " %2d%s",
txpwr->mcs_20_stbc[i] / BRCMS_TXPWR_DB_FACTOR,
fraction[txpwr->mcs_20_stbc[i] %
BRCMS_TXPWR_DB_FACTOR]);
}
printk(KERN_DEBUG "%s\n", buf);
sprintf(buf, "20 MHz MCS8-15 SDM ");
for (i = 0; i < BRCMS_NUM_RATES_MCS_2_STREAM; i++) {
for (i = 0; i < BRCMS_NUM_RATES_MCS_2_STREAM; i++)
sprintf(buf[strlen(buf)], " %2d%s",
txpwr->mcs_20_mimo[i] / BRCMS_TXPWR_DB_FACTOR,
fraction[txpwr->mcs_20_mimo[i] %
BRCMS_TXPWR_DB_FACTOR]);
}
printk(KERN_DEBUG "%s\n", buf);
sprintf(buf, "40 MHz MCS0-7 SISO ");
for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) {
for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++)
sprintf(buf[strlen(buf)], " %2d%s",
txpwr->mcs_40_siso[i] / BRCMS_TXPWR_DB_FACTOR,
fraction[txpwr->mcs_40_siso[i] %
BRCMS_TXPWR_DB_FACTOR]);
}
printk(KERN_DEBUG "%s\n", buf);
sprintf(buf, "40 MHz MCS0-7 CDD ");
for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) {
for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++)
sprintf(buf[strlen(buf)], " %2d%s",
txpwr->mcs_40_cdd[i] / BRCMS_TXPWR_DB_FACTOR,
fraction[txpwr->mcs_40_cdd[i] %
BRCMS_TXPWR_DB_FACTOR]);
}
printk(KERN_DEBUG "%s\n", buf);
sprintf(buf, "40 MHz MCS0-7 STBC ");
for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) {
for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++)
sprintf(buf[strlen(buf)], " %2d%s",
txpwr->mcs_40_stbc[i] / BRCMS_TXPWR_DB_FACTOR,
fraction[txpwr->mcs_40_stbc[i] %
BRCMS_TXPWR_DB_FACTOR]);
}
printk(KERN_DEBUG "%s\n", buf);
sprintf(buf, "40 MHz MCS8-15 SDM ");
for (i = 0; i < BRCMS_NUM_RATES_MCS_2_STREAM; i++) {
for (i = 0; i < BRCMS_NUM_RATES_MCS_2_STREAM; i++)
sprintf(buf[strlen(buf)], " %2d%s",
txpwr->mcs_40_mimo[i] / BRCMS_TXPWR_DB_FACTOR,
fraction[txpwr->mcs_40_mimo[i] %
......@@ -1330,12 +1300,10 @@ brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, u16 chanspec,
}
/* OFDM txpwr limits for 2.4G or 5G bands */
if (BAND_2G(band->bandtype)) {
if (BAND_2G(band->bandtype))
maxpwr = li->maxpwr[CHANNEL_POWER_IDX_2G_OFDM(chan)];
} else {
else
maxpwr = li->maxpwr[CHANNEL_POWER_IDX_5G(chan)];
}
maxpwr = maxpwr - delta;
maxpwr = max(maxpwr, 0);
......@@ -1405,9 +1373,8 @@ brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, u16 chanspec,
maxpwr20 = QDB(16);
maxpwr40 = 0;
if (chan >= 3 && chan <= 11) {
if (chan >= 3 && chan <= 11)
maxpwr40 = QDB(16);
}
}
for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) {
......
......@@ -533,12 +533,12 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,
di->aligndesc_4k = _dma_descriptor_align(di);
if (di->aligndesc_4k) {
di->dmadesc_align = D64RINGALIGN_BITS;
if ((ntxd < D64MAXDD / 2) && (nrxd < D64MAXDD / 2)) {
if ((ntxd < D64MAXDD / 2) && (nrxd < D64MAXDD / 2))
/* for smaller dd table, HW relax alignment reqmnt */
di->dmadesc_align = D64RINGALIGN_BITS - 1;
}
} else
} else {
di->dmadesc_align = 4; /* 16 byte alignment */
}
DMA_NONE(("DMA descriptor align_needed %d, align %d\n",
di->aligndesc_4k, di->dmadesc_align));
......@@ -662,10 +662,9 @@ dma64_dd_upd(struct dma_info *di, struct dma64desc *ddring,
W_SM(&ddring[outidx].ctrl2, BUS_SWAP32(ctrl2));
}
if (di->dma.dmactrlflags & DMA_CTRL_PEN) {
if (DMA64_DD_PARITY(&ddring[outidx])) {
if (DMA64_DD_PARITY(&ddring[outidx]))
W_SM(&ddring[outidx].ctrl2,
BUS_SWAP32(ctrl2 | D64_CTRL2_PARITY));
}
}
}
......@@ -743,18 +742,17 @@ static bool _dma_isaddrext(struct dma_info *di)
/* not all tx or rx channel are available */
if (di->d64txregs != NULL) {
if (!_dma64_addrext(di->d64txregs)) {
if (!_dma64_addrext(di->d64txregs))
DMA_ERROR(("%s: _dma_isaddrext: DMA64 tx doesn't have "
"AE set\n", di->name));
}
return true;
} else if (di->d64rxregs != NULL) {
if (!_dma64_addrext(di->d64rxregs)) {
if (!_dma64_addrext(di->d64rxregs))
DMA_ERROR(("%s: _dma_isaddrext: DMA64 rx doesn't have "
"AE set\n", di->name));
}
return true;
}
return false;
}
......@@ -1157,16 +1155,15 @@ static uint _dma_ctrlflags(struct dma_info *di, uint mask, uint flags)
control = R_REG(&di->d64txregs->control);
W_REG(&di->d64txregs->control,
control | D64_XC_PD);
if (R_REG(&di->d64txregs->control) & D64_XC_PD) {
if (R_REG(&di->d64txregs->control) & D64_XC_PD)
/* We *can* disable it so it is supported,
* restore control register
*/
W_REG(&di->d64txregs->control,
control);
} else {
else
/* Not supported, don't allow it to be enabled */
dmactrlflags &= ~DMA_CTRL_PEN;
}
}
di->dma.dmactrlflags = dmactrlflags;
......@@ -1186,9 +1183,8 @@ static
u8 dma_align_sizetobits(uint size)
{
u8 bitpos = 0;
while (size >>= 1) {
while (size >>= 1)
bitpos++;
}
return bitpos;
}
......@@ -1521,10 +1517,9 @@ dma64_txunframed(struct dma_info *di, void *buf, uint len, bool commit)
di->txout = txout;
/* kick the chip */
if (commit) {
if (commit)
W_REG(&di->d64txregs->ptr,
di->xmtptrbase + I2B(txout, struct dma64desc));
}
/* tx flow control */
di->dma.txavail = di->ntxd - NTXDACTIVE(di->txin, di->txout) - 1;
......
......@@ -217,10 +217,10 @@ brcms_ops_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
err = brcms_up(wl);
UNLOCK(wl);
if (err != 0) {
if (err != 0)
wiphy_err(hw->wiphy, "%s: brcms_up() returned %d\n", __func__,
err);
}
return err;
}
......@@ -307,9 +307,9 @@ static int brcms_ops_config(struct ieee80211_hw *hw, u32 changed)
"\n", __func__, conf->power_level * 4,
new_int);
}
if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
if (changed & IEEE80211_CONF_CHANGE_CHANNEL)
err = ieee_set_channel(hw, conf->channel, conf->channel_type);
}
if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) {
if (brcms_c_set
(wl->wlc, BRCM_SET_SRL,
......@@ -420,32 +420,36 @@ brcms_ops_bss_info_changed(struct ieee80211_hw *hw,
info->bssid);
UNLOCK(wl);
}
if (changed & BSS_CHANGED_BEACON) {
if (changed & BSS_CHANGED_BEACON)
/* Beacon data changed, retrieve new beacon (beaconing modes) */
wiphy_err(wiphy, "%s: beacon changed\n", __func__);
}
if (changed & BSS_CHANGED_BEACON_ENABLED) {
/* Beaconing should be enabled/disabled (beaconing modes) */
wiphy_err(wiphy, "%s: Beacon enabled: %s\n", __func__,
info->enable_beacon ? "true" : "false");
}
if (changed & BSS_CHANGED_CQM) {
/* Connection quality monitor config changed */
wiphy_err(wiphy, "%s: cqm change: threshold %d, hys %d "
" (implement)\n", __func__, info->cqm_rssi_thold,
info->cqm_rssi_hyst);
}
if (changed & BSS_CHANGED_IBSS) {
/* IBSS join status changed */
wiphy_err(wiphy, "%s: IBSS joined: %s (implement)\n", __func__,
info->ibss_joined ? "true" : "false");
}
if (changed & BSS_CHANGED_ARP_FILTER) {
/* Hardware ARP filter address list or state changed */
wiphy_err(wiphy, "%s: arp filtering: enabled %s, count %d"
" (implement)\n", __func__, info->arp_filter_enabled ?
"true" : "false", info->arp_addr_cnt);
}
if (changed & BSS_CHANGED_QOS) {
/*
* QoS for this association was enabled/disabled.
......@@ -757,9 +761,8 @@ static struct brcms_info *brcms_attach(u16 vendor, u16 device,
unit = n_adapters_found;
err = 0;
if (unit < 0) {
if (unit < 0)
return NULL;
}
/* allocate private info */
hw = pci_get_drvdata(btparam); /* btparam == pdev */
......@@ -816,10 +819,9 @@ static struct brcms_info *brcms_attach(u16 vendor, u16 device,
wl->pub->ieee_hw = hw;
if (brcms_c_set_par(wl->wlc, IOV_MPC, 0) < 0) {
if (brcms_c_set_par(wl->wlc, IOV_MPC, 0) < 0)
wiphy_err(wl->wiphy, "wl%d: Error setting MPC variable to 0\n",
unit);
}
/* register our interrupt handler */
if (request_irq(irq, brcms_isr, IRQF_SHARED, KBUILD_MODNAME, wl)) {
......@@ -843,19 +845,17 @@ static struct brcms_info *brcms_attach(u16 vendor, u16 device,
SET_IEEE80211_PERM_ADDR(hw, perm);
err = ieee80211_register_hw(hw);
if (err) {
if (err)
wiphy_err(wl->wiphy, "%s: ieee80211_register_hw failed, status"
"%d\n", __func__, err);
}
if (wl->pub->srom_ccode[0])
err = brcms_set_hint(wl, wl->pub->srom_ccode);
else
err = brcms_set_hint(wl, "US");
if (err) {
if (err)
wiphy_err(wl->wiphy, "%s: regulatory_hint failed, status %d\n",
__func__, err);
}
n_adapters_found++;
return wl;
......@@ -1064,12 +1064,11 @@ static int ieee_hw_rate_init(struct ieee80211_hw *hw)
/* Assume all bands use the same phy. True for 11n devices. */
if (NBANDS_PUB(wl->pub) > 1) {
has_5g++;
if (phy_list[0] == 'n' || phy_list[0] == 'c') {
if (phy_list[0] == 'n' || phy_list[0] == 'c')
hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
&brcms_band_5GHz_nphy;
} else {
else
return -EPERM;
}
}
return 0;
}
......@@ -1337,9 +1336,8 @@ static void brcms_free(struct brcms_info *wl)
/* kill dpc */
tasklet_kill(&wl->tasklet);
if (wl->pub) {
if (wl->pub)
brcms_c_module_unregister(wl->pub, "linux", wl);
}
/* free common resources */
if (wl->wlc) {
......@@ -1368,9 +1366,9 @@ static void brcms_free(struct brcms_info *wl)
* so we cannot unmap the chip registers until after calling unregister_netdev() .
*/
if (wl->regsva && wl->bcm_bustype != SDIO_BUS &&
wl->bcm_bustype != JTAG_BUS) {
wl->bcm_bustype != JTAG_BUS)
iounmap((void *)wl->regsva);
}
wl->regsva = NULL;
}
......@@ -1558,10 +1556,9 @@ static void brcms_dpc(unsigned long data)
/* re-schedule dpc */
if (wl->resched)
tasklet_schedule(&wl->tasklet);
else {
else
/* re-enable interrupts */
brcms_intrson(wl);
}
done:
UNLOCK(wl);
......@@ -1645,10 +1642,10 @@ void brcms_add_timer(struct brcms_info *wl, struct brcms_timer *t, uint ms,
int periodic)
{
#ifdef BCMDBG
if (t->set) {
if (t->set)
wiphy_err(wl->wiphy, "%s: Already set. Name: %s, per %d\n",
__func__, t->name, periodic);
}
#endif
t->ms = ms;
t->periodic = (bool) periodic;
......@@ -1668,9 +1665,9 @@ bool brcms_del_timer(struct brcms_info *wl, struct brcms_timer *t)
{
if (t->set) {
t->set = false;
if (!del_timer(&t->timer)) {
if (!del_timer(&t->timer))
return false;
}
atomic_dec(&wl->callbacks);
}
......
......@@ -399,6 +399,7 @@ static bool pcie_mdiosetblock(struct pcicore_info *pi, uint blk)
while (i < pcie_serdes_spinwait) {
if (R_REG(&pcieregs->mdiocontrol) & MDIOCTL_ACCESS_DONE)
break;
udelay(1000);
i++;
}
......@@ -823,6 +824,7 @@ void pcicore_fixcfg(void *pch, void *regs)
reg16 = &pcieregs->sprom[SRSH_PI_OFFSET];
else if (sii->pub.buscoretype == PCI_CORE_ID)
reg16 = &pciregs->sprom[SRSH_PI_OFFSET];
pciidx = ai_coreidx(&sii->pub);
val16 = R_REG(reg16);
if (((val16 & SRSH_PI_MASK) >> SRSH_PI_SHIFT) != (u16)pciidx) {
......
......@@ -184,12 +184,12 @@ static u16 ipxotp_read_bit(void *oh, struct chipcregs *cc, uint off)
((st = R_REG(&cc->otpprog)) & OTPP_START_BUSY)
&& (k < OTPP_TRIES); k++)
;
if (k >= OTPP_TRIES) {
if (k >= OTPP_TRIES)
return 0xffff;
}
if (st & OTPP_READERR) {
if (st & OTPP_READERR)
return 0xffff;
}
st = (st & OTPP_VALUE_MASK) >> OTPP_VALUE_SHIFT;
return (int)st;
......@@ -245,9 +245,8 @@ static void _ipxotp_init(struct otpinfo *oi, struct chipcregs *cc)
((st = R_REG(&cc->otpprog)) & OTPP_START_BUSY)
&& (k < OTPP_TRIES); k++)
;
if (k >= OTPP_TRIES) {
if (k >= OTPP_TRIES)
return;
}
/* Read OTP lock bits and subregion programmed indication bits */
oi->status = R_REG(&cc->otpstatus);
......@@ -493,9 +492,8 @@ void *otp_init(struct si_pub *sih)
if (OTPTYPE_IPX(oi->ccrev))
oi->fn = &ipxotp_fn;
if (oi->fn == NULL) {
if (oi->fn == NULL)
return NULL;
}
oi->sih = sih;
......
......@@ -466,9 +466,8 @@ static void wlc_set_phy_uninitted(struct brcms_phy *pi)
}
pi->radiopwr = 0xffff;
for (i = 0; i < STATIC_NUM_RF; i++) {
for (j = 0; j < STATIC_NUM_BB; j++) {
for (j = 0; j < STATIC_NUM_BB; j++)
pi->stats_11b_txpower[i][j] = -1;
}
}
}
......@@ -477,9 +476,8 @@ struct shared_phy *wlc_phy_shared_attach(struct shared_phy_params *shp)
struct shared_phy *sh;
sh = kzalloc(sizeof(struct shared_phy), GFP_ATOMIC);
if (sh == NULL) {
if (sh == NULL)
return NULL;
}
sh->sih = shp->sih;
sh->physhim = shp->physhim;
......@@ -525,23 +523,20 @@ wlc_phy_attach(struct shared_phy *sh, void *regs, int bandtype,
sflags = ai_core_sflags(sh->sih, 0, 0);
if (BAND_5G(bandtype)) {
if ((sflags & (SISF_5G_PHY | SISF_DB_PHY)) == 0) {
if ((sflags & (SISF_5G_PHY | SISF_DB_PHY)) == 0)
return NULL;
}
}
pi = sh->phy_head;
if ((sflags & SISF_DB_PHY) && pi) {
wlapi_bmac_corereset(pi->sh->physhim, pi->pubpi.coreflags);
pi->refcnt++;
return &pi->pubpi_ro;
}
pi = kzalloc(sizeof(struct brcms_phy), GFP_ATOMIC);
if (pi == NULL) {
if (pi == NULL)
return NULL;
}
pi->wiphy = wiphy;
pi->regs = (struct d11regs *) regs;
pi->sh = sh;
......@@ -556,10 +551,8 @@ wlc_phy_attach(struct shared_phy *sh, void *regs, int bandtype,
pi->phycal_tempdelta = 0;
if (BAND_2G(bandtype) && (sflags & SISF_2G_PHY)) {
if (BAND_2G(bandtype) && (sflags & SISF_2G_PHY))
pi->pubpi.coreflags = SICF_GMODE;
}
wlapi_bmac_corereset(pi->sh->physhim, pi->pubpi.coreflags);
phyversion = R_REG(&pi->regs->phyversion);
......@@ -574,17 +567,14 @@ wlc_phy_attach(struct shared_phy *sh, void *regs, int bandtype,
pi->pubpi.phy_corenum = PHY_CORE_NUM_2;
pi->pubpi.ana_rev = (phyversion & PV_AV_MASK) >> PV_AV_SHIFT;
if (!VALID_PHYTYPE(pi->pubpi.phy_type)) {
if (!VALID_PHYTYPE(pi->pubpi.phy_type))
goto err;
}
if (BAND_5G(bandtype)) {
if (!ISNPHY(pi)) {
goto err;
}
} else {
if (!ISNPHY(pi) && !ISLCNPHY(pi)) {
if (!ISNPHY(pi))
goto err;
}
} else if (!ISNPHY(pi) && !ISLCNPHY(pi)) {
goto err;
}
wlc_phy_anacore((struct brcms_phy_pub *) pi, ON);
......@@ -652,9 +642,8 @@ wlc_phy_attach(struct shared_phy *sh, void *regs, int bandtype,
pi->phycal_timer = wlapi_init_timer(pi->sh->physhim,
wlc_phy_timercb_phycal,
pi, "phycal");
if (!pi->phycal_timer) {
if (!pi->phycal_timer)
goto err;
}
if (!wlc_phy_attach_nphy(pi))
goto err;
......@@ -663,8 +652,6 @@ wlc_phy_attach(struct shared_phy *sh, void *regs, int bandtype,
if (!wlc_phy_attach_lcnphy(pi))
goto err;
} else {
}
pi->refcnt++;
......@@ -687,9 +674,8 @@ void wlc_phy_detach(struct brcms_phy_pub *pih)
struct brcms_phy *pi = (struct brcms_phy *) pih;
if (pih) {
if (--pi->refcnt) {
if (--pi->refcnt)
return;
}
if (pi->phycal_timer) {
wlapi_free_timer(pi->sh->physhim, pi->phycal_timer);
......@@ -881,9 +867,8 @@ void wlc_phy_init(struct brcms_phy_pub *pih, u16 chanspec)
if (WARN(mc & MCTL_EN_MAC, "HW error MAC running on init"))
return;
if (!(pi->measure_hold & PHY_HOLD_FOR_SCAN)) {
if (!(pi->measure_hold & PHY_HOLD_FOR_SCAN))
pi->measure_hold |= PHY_HOLD_FOR_NOT_ASSOC;
}
if (WARN(!(ai_core_sflags(pi->sh->sih, 0, 0) & SISF_FCLKA),
"HW error SISF_FCLKA\n"))
......@@ -891,9 +876,8 @@ void wlc_phy_init(struct brcms_phy_pub *pih, u16 chanspec)
phy_init = pi->pi_fptr.init;
if (phy_init == NULL) {
if (phy_init == NULL)
return;
}
wlc_phy_anacore(pih, ON);
......@@ -992,11 +976,9 @@ void wlc_phy_table_data_write(struct brcms_phy *pi, uint width, u32 val)
}
if (width == 32) {
write_phy_reg(pi, pi->tbl_data_hi, (u16) (val >> 16));
write_phy_reg(pi, pi->tbl_data_lo, (u16) val);
} else {
write_phy_reg(pi, pi->tbl_data_lo, (u16) val);
}
}
......@@ -1027,15 +1009,12 @@ wlc_phy_write_table(struct brcms_phy *pi, const struct phytbl_info *ptbl_info,
}
if (tbl_width == 32) {
write_phy_reg(pi, tblDataHi,
(u16) (ptbl_32b[idx] >> 16));
write_phy_reg(pi, tblDataLo, (u16) ptbl_32b[idx]);
} else if (tbl_width == 16) {
write_phy_reg(pi, tblDataLo, ptbl_16b[idx]);
} else {
write_phy_reg(pi, tblDataLo, ptbl_8b[idx]);
}
}
......@@ -1066,14 +1045,11 @@ wlc_phy_read_table(struct brcms_phy *pi, const struct phytbl_info *ptbl_info,
}
if (tbl_width == 32) {
ptbl_32b[idx] = read_phy_reg(pi, tblDataLo);
ptbl_32b[idx] |= (read_phy_reg(pi, tblDataHi) << 16);
} else if (tbl_width == 16) {
ptbl_16b[idx] = read_phy_reg(pi, tblDataLo);
} else {
ptbl_8b[idx] = (u8) read_phy_reg(pi, tblDataLo);
}
}
......@@ -1086,10 +1062,9 @@ wlc_phy_init_radio_regs_allbands(struct brcms_phy *pi,
uint i = 0;
do {
if (radioregs[i].do_init) {
if (radioregs[i].do_init)
write_radio_reg(pi, radioregs[i].address,
(u16) radioregs[i].init);
}
i++;
} while (radioregs[i].address != 0xffff);
......@@ -1158,9 +1133,8 @@ void wlc_phy_do_dummy_tx(struct brcms_phy *pi, bool ofdm, bool pa_on)
W_REG(&regs->wepctl, 0);
W_REG(&regs->txe_phyctl, (ofdm ? 1 : 0) | PHY_TXC_ANT_0);
if (ISNPHY(pi) || ISLCNPHY(pi)) {
if (ISNPHY(pi) || ISLCNPHY(pi))
W_REG(&regs->txe_phyctl1, 0x1A02);
}
W_REG(&regs->txe_wm_0, 0);
W_REG(&regs->txe_wm_1, 0);
......@@ -1187,16 +1161,14 @@ void wlc_phy_do_dummy_tx(struct brcms_phy *pi, bool ofdm, bool pa_on)
i = 0;
count = ofdm ? 30 : 250;
while ((i++ < count)
&& (R_REG(&regs->txe_status) & (1 << 7))) {
&& (R_REG(&regs->txe_status) & (1 << 7)))
udelay(10);
}
i = 0;
while ((i++ < 10)
&& ((R_REG(&regs->txe_status) & (1 << 10)) == 0)) {
&& ((R_REG(&regs->txe_status) & (1 << 10)) == 0))
udelay(10);
}
i = 0;
......@@ -1213,11 +1185,10 @@ void wlc_phy_hold_upd(struct brcms_phy_pub *pih, u32 id, bool set)
{
struct brcms_phy *pi = (struct brcms_phy *) pih;
if (set) {
if (set)
mboolset(pi->measure_hold, id);
} else {
else
mboolclr(pi->measure_hold, id);
}
return;
}
......@@ -1226,11 +1197,10 @@ void wlc_phy_mute_upd(struct brcms_phy_pub *pih, bool mute, u32 flags)
{
struct brcms_phy *pi = (struct brcms_phy *) pih;
if (mute) {
if (mute)
mboolset(pi->measure_hold, PHY_HOLD_FOR_MUTE);
} else {
else
mboolclr(pi->measure_hold, PHY_HOLD_FOR_MUTE);
}
if (!mute && (flags & PHY_MUTE_FOR_PREISM))
pi->nphy_perical_last = pi->sh->now - pi->sh->glacial_timer;
......@@ -1271,7 +1241,6 @@ void wlc_phy_switch_radio(struct brcms_phy_pub *pih, bool on)
if (ISNPHY(pi)) {
wlc_phy_switch_radio_nphy(pi, on);
} else if (ISLCNPHY(pi)) {
if (on) {
and_phy_reg(pi, 0x44c,
......@@ -1367,11 +1336,10 @@ int wlc_phy_chanspec_bandrange_get(struct brcms_phy *pi, u16 chanspec)
uint channel = CHSPEC_CHANNEL(chanspec);
uint freq = wlc_phy_channel2freq(channel);
if (ISNPHY(pi)) {
if (ISNPHY(pi))
range = wlc_phy_get_chan_freq_range_nphy(pi, channel);
} else if (ISLCNPHY(pi)) {
else if (ISLCNPHY(pi))
range = wlc_phy_chanspec_freq2bandrange_lpssn(freq);
}
return range;
}
......@@ -1585,9 +1553,8 @@ wlc_phy_txpower_sromlimit(struct brcms_phy_pub *ppi, uint channel, u8 *min_pwr,
txp_rate_idx = TXP_FIRST_OFDM;
for (i = 0; i < ARRAY_SIZE(chan_info_all); i++) {
if (channel == chan_info_all[i].chan) {
if (channel == chan_info_all[i].chan)
break;
}
}
if (pi->hwtxpwr) {
......@@ -1720,11 +1687,10 @@ void wlc_phy_txpower_recalc_target(struct brcms_phy *pi)
tx_pwr_target[rate] = pi->tx_user_target[rate];
if (pi->user_txpwr_at_rfport) {
if (pi->user_txpwr_at_rfport)
tx_pwr_target[rate] +=
wlc_user_txpwr_antport_to_rfport(pi, target_chan,
band, rate);
}
{
......@@ -1765,13 +1731,12 @@ void wlc_phy_txpower_recalc_target(struct brcms_phy *pi)
pi->tx_power_target[rate] = tx_pwr_target[rate];
if (!pi->hwpwrctrl || ISNPHY(pi)) {
if (!pi->hwpwrctrl || ISNPHY(pi))
pi->tx_power_offset[rate] =
pi->tx_power_max - pi->tx_power_target[rate];
} else {
else
pi->tx_power_offset[rate] =
pi->tx_power_target[rate] - pi->tx_power_min;
}
}
txpwr_recalc_fn = pi->pi_fptr.txpwrrecalc;
......@@ -2017,9 +1982,8 @@ void wlc_phy_bf_preempt_enable(struct brcms_phy_pub *pih, bool bf_preempt)
void wlc_phy_txpower_update_shm(struct brcms_phy *pi)
{
int j;
if (ISNPHY(pi)) {
if (ISNPHY(pi))
return;
}
if (!pi->sh->clk)
return;
......@@ -2069,22 +2033,19 @@ bool wlc_phy_txpower_hw_ctrl_get(struct brcms_phy_pub *ppi)
{
struct brcms_phy *pi = (struct brcms_phy *) ppi;
if (ISNPHY(pi)) {
if (ISNPHY(pi))
return pi->nphy_txpwrctrl;
} else {
else
return pi->hwpwrctrl;
}
}
void wlc_phy_txpower_hw_ctrl_set(struct brcms_phy_pub *ppi, bool hwpwrctrl)
{
struct brcms_phy *pi = (struct brcms_phy *) ppi;
bool cur_hwpwrctrl = pi->hwpwrctrl;
bool suspend;
if (!pi->hwpwrctrl_capable) {
if (!pi->hwpwrctrl_capable)
return;
}
pi->hwpwrctrl = hwpwrctrl;
pi->nphy_txpwrctrl = hwpwrctrl;
......@@ -2098,19 +2059,14 @@ void wlc_phy_txpower_hw_ctrl_set(struct brcms_phy_pub *ppi, bool hwpwrctrl)
wlapi_suspend_mac_and_wait(pi->sh->physhim);
wlc_phy_txpwrctrl_enable_nphy(pi, pi->nphy_txpwrctrl);
if (pi->nphy_txpwrctrl == PHY_TPC_HW_OFF) {
if (pi->nphy_txpwrctrl == PHY_TPC_HW_OFF)
wlc_phy_txpwr_fixpower_nphy(pi);
} else {
else
mod_phy_reg(pi, 0x1e7, (0x7f << 0),
pi->saved_txpwr_idx);
}
if (!suspend)
wlapi_enable_mac(pi->sh->physhim);
} else if (hwpwrctrl != cur_hwpwrctrl) {
return;
}
}
......@@ -2126,8 +2082,6 @@ void wlc_phy_txpower_ipa_upd(struct brcms_phy *pi)
}
}
static u32 wlc_phy_txpower_est_power_nphy(struct brcms_phy *pi);
static u32 wlc_phy_txpower_est_power_nphy(struct brcms_phy *pi)
{
s16 tx0_status, tx1_status;
......@@ -2139,38 +2093,34 @@ static u32 wlc_phy_txpower_est_power_nphy(struct brcms_phy *pi)
estPower2 = read_phy_reg(pi, 0x119);
if ((estPower1 & (0x1 << 8))
== (0x1 << 8)) {
== (0x1 << 8))
pwr0 = (u8) (estPower1 & (0xff << 0))
>> 0;
} else {
else
pwr0 = 0x80;
}
if ((estPower2 & (0x1 << 8))
== (0x1 << 8)) {
== (0x1 << 8))
pwr1 = (u8) (estPower2 & (0xff << 0))
>> 0;
} else {
else
pwr1 = 0x80;
}
tx0_status = read_phy_reg(pi, 0x1ed);
tx1_status = read_phy_reg(pi, 0x1ee);
if ((tx0_status & (0x1 << 15))
== (0x1 << 15)) {
== (0x1 << 15))
adj_pwr0 = (u8) (tx0_status & (0xff << 0))
>> 0;
} else {
else
adj_pwr0 = 0x80;
}
if ((tx1_status & (0x1 << 15))
== (0x1 << 15)) {
== (0x1 << 15))
adj_pwr1 = (u8) (tx1_status & (0xff << 0))
>> 0;
} else {
else
adj_pwr1 = 0x80;
}
est_pwr =
(u32) ((pwr0 << 24) | (pwr1 << 16) | (adj_pwr0 << 8) | adj_pwr1);
......@@ -2305,10 +2255,8 @@ void wlc_phy_ant_rxdiv_set(struct brcms_phy_pub *ppi, u8 val)
BRCM_BAND_ALL);
}
if (ISNPHY(pi)) {
if (ISNPHY(pi))
return;
}
if (!pi->sh->clk)
return;
......@@ -2370,20 +2318,16 @@ wlc_phy_noise_sample_request(struct brcms_phy_pub *pih, u8 reason, u8 ch)
bool sampling_in_progress = (pi->phynoise_state != 0);
bool wait_for_intr = true;
if (NORADIO_ENAB(pi->pubpi)) {
if (NORADIO_ENAB(pi->pubpi))
return;
}
switch (reason) {
case PHY_NOISE_SAMPLE_MON:
pi->phynoise_chan_watchdog = ch;
pi->phynoise_state |= PHY_NOISE_STATE_MON;
break;
case PHY_NOISE_SAMPLE_EXTERNAL:
pi->phynoise_state |= PHY_NOISE_STATE_EXTERNAL;
break;
......@@ -2407,7 +2351,6 @@ wlc_phy_noise_sample_request(struct brcms_phy_pub *pih, u8 reason, u8 ch)
noise_dbm = PHY_NOISE_FIXED_VAL_NPHY;
} else {
noise_dbm = PHY_NOISE_FIXED_VAL;
}
......@@ -2521,9 +2464,8 @@ static void wlc_phy_noise_cb(struct brcms_phy *pi, u8 channel, s8 noise_dbm)
pi->phynoise_state &= ~PHY_NOISE_STATE_MON;
}
if (pi->phynoise_state & PHY_NOISE_STATE_EXTERNAL) {
if (pi->phynoise_state & PHY_NOISE_STATE_EXTERNAL)
pi->phynoise_state &= ~PHY_NOISE_STATE_EXTERNAL;
}
}
......@@ -2545,9 +2487,9 @@ static s8 wlc_phy_noise_read_shmem(struct brcms_phy *pi)
M_PWRIND_MAP(idx + 1));
cmplx_pwr[core] = (hi << 16) + lo;
cmplx_pwr_tot += cmplx_pwr[core];
if (cmplx_pwr[core] == 0) {
if (cmplx_pwr[core] == 0)
noise_dbm_ant[core] = PHY_NOISE_FIXED_VAL_NPHY;
} else
else
cmplx_pwr[core] >>= PHY_NOISE_SAMPLE_LOG_NUM_UCODE;
}
......@@ -2716,7 +2658,6 @@ void wlc_phy_rssi_compute(struct brcms_phy_pub *pih, void *ctx)
}
if (ISLCNPHY(pi)) {
if (rssi > 127)
rssi -= 256;
} else if (radioid == BCM2055_ID || radioid == BCM2056_ID
......@@ -2758,23 +2699,20 @@ void wlc_phy_watchdog(struct brcms_phy_pub *pih)
if (!pi->watchdog_override)
return;
if (!(SCAN_RM_IN_PROGRESS(pi) || PLT_INPROG_PHY(pi))) {
if (!(SCAN_RM_IN_PROGRESS(pi) || PLT_INPROG_PHY(pi)))
wlc_phy_noise_sample_request((struct brcms_phy_pub *) pi,
PHY_NOISE_SAMPLE_MON,
CHSPEC_CHANNEL(pi->
radio_chanspec));
}
if (pi->phynoise_state && (pi->sh->now - pi->phynoise_now) > 5) {
if (pi->phynoise_state && (pi->sh->now - pi->phynoise_now) > 5)
pi->phynoise_state = 0;
}
if ((!pi->phycal_txpower) ||
((pi->sh->now - pi->phycal_txpower) >= pi->sh->fast_timer)) {
if (!SCAN_INPROG_PHY(pi) && wlc_phy_cal_txpower_recalc_sw(pi)) {
if (!SCAN_INPROG_PHY(pi) && wlc_phy_cal_txpower_recalc_sw(pi))
pi->phycal_txpower = pi->sh->now;
}
}
if (NORADIO_ENAB(pi->pubpi))
......@@ -2820,9 +2758,8 @@ void wlc_phy_BSSinit(struct brcms_phy_pub *pih, bool bonlyap, int rssi)
uint i;
uint k;
for (i = 0; i < MA_WINDOW_SZ; i++) {
for (i = 0; i < MA_WINDOW_SZ; i++)
pi->sh->phy_noise_window[i] = (s8) (rssi & 0xff);
}
if (ISLCNPHY(pi)) {
for (i = 0; i < MA_WINDOW_SZ; i++)
pi->sh->phy_noise_window[i] =
......@@ -2955,9 +2892,9 @@ void wlc_phy_cal_perical(struct brcms_phy_pub *pih, u8 reason)
case PHY_PERICAL_PHYINIT:
if (pi->nphy_perical == PHY_PERICAL_MPHASE) {
if (PHY_PERICAL_MPHASE_PENDING(pi)) {
if (PHY_PERICAL_MPHASE_PENDING(pi))
wlc_phy_cal_perical_mphase_reset(pi);
}
wlc_phy_cal_perical_mphase_schedule(pi,
PHY_PERICAL_INIT_DELAY);
}
......@@ -2967,17 +2904,16 @@ void wlc_phy_cal_perical(struct brcms_phy_pub *pih, u8 reason)
case PHY_PERICAL_START_IBSS:
case PHY_PERICAL_UP_BSS:
if ((pi->nphy_perical == PHY_PERICAL_MPHASE) &&
PHY_PERICAL_MPHASE_PENDING(pi)) {
PHY_PERICAL_MPHASE_PENDING(pi))
wlc_phy_cal_perical_mphase_reset(pi);
}
pi->first_cal_after_assoc = true;
pi->cal_type_override = PHY_PERICAL_FULL;
if (pi->phycal_tempdelta) {
if (pi->phycal_tempdelta)
pi->nphy_lastcal_temp = wlc_phy_tempsense_nphy(pi);
}
wlc_phy_cal_perical_nphy_run(pi, PHY_PERICAL_FULL);
break;
......@@ -2991,17 +2927,14 @@ void wlc_phy_cal_perical(struct brcms_phy_pub *pih, u8 reason)
if ((delta_temp < (s16) pi->phycal_tempdelta) &&
(pi->nphy_txiqlocal_chanspec ==
pi->radio_chanspec)) {
pi->radio_chanspec))
do_periodic_cal = false;
} else {
else
pi->nphy_lastcal_temp = nphy_currtemp;
}
}
if (do_periodic_cal) {
if (pi->nphy_perical == PHY_PERICAL_MPHASE) {
if (!PHY_PERICAL_MPHASE_PENDING(pi))
wlc_phy_cal_perical_mphase_schedule(pi,
PHY_PERICAL_WDOG_DELAY);
......@@ -3050,9 +2983,9 @@ void wlc_phy_stf_chain_set(struct brcms_phy_pub *pih, u8 txchain, u8 rxchain)
pi->sh->phytxchain = txchain;
if (ISNPHY(pi)) {
if (ISNPHY(pi))
wlc_phy_rxcore_setstate_nphy(pih, rxchain);
}
pi->pubpi.phy_corenum = (u8) PHY_BITSCNT(pi->sh->phyrxchain);
}
......
......@@ -246,7 +246,7 @@ enum phy_cal_mode {
#define MOD_PHY_REG(pi, phy_type, reg_name, field, value) \
mod_phy_reg(pi, phy_type##_##reg_name, phy_type##_##reg_name##_##field##_MASK, \
(value) << phy_type##_##reg_name##_##field##_##SHIFT);
(value) << phy_type##_##reg_name##_##field##_##SHIFT)
#define READ_PHY_REG(pi, phy_type, reg_name, field) \
((read_phy_reg(pi, phy_type##_##reg_name) & phy_type##_##reg_name##_##field##_##MASK)\
>> phy_type##_##reg_name##_##field##_##SHIFT)
......
......@@ -1092,12 +1092,12 @@ static int wlc_lcnphy_calc_floor(s16 coeff_x, int type)
int k;
k = 0;
if (type == 0) {
if (coeff_x < 0) {
if (coeff_x < 0)
k = (coeff_x - 1) / 2;
} else {
else
k = coeff_x / 2;
}
}
if (type == 1) {
if ((coeff_x + 1) < 0)
k = (coeff_x) / 2;
......@@ -1531,10 +1531,9 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi)
mod_radio_reg(pi, RADIO_2064_REG005, 0x8, 1 << 3);
if (!wlc_lcnphy_tempsense_based_pwr_ctrl_enabled(pi)) {
if (!wlc_lcnphy_tempsense_based_pwr_ctrl_enabled(pi))
mod_phy_reg(pi, 0x4d7,
(0x1 << 3) | (0x7 << 12), 0 << 3 | 2 << 12);
}
rfseq = wlc_lcnphy_rfseq_tbl_adc_pwrup(pi);
tab.tbl_id = LCNPHY_TBL_ID_RFSEQ;
......@@ -1697,24 +1696,21 @@ static s8 wlc_lcnphy_tempcompensated_txpwrctrl(struct brcms_phy *pi)
if (NORADIO_ENAB(pi->pubpi))
return index;
if (pi_lcn->lcnphy_tempsense_slope == 0) {
if (pi_lcn->lcnphy_tempsense_slope == 0)
return index;
}
temp = (u16) wlc_lcnphy_tempsense(pi, 0);
meas_temp = LCNPHY_TEMPSENSE(temp);
if (pi->tx_power_min != 0) {
if (pi->tx_power_min != 0)
delta_brd = (pi_lcn->lcnphy_measPower - pi->tx_power_min);
} else {
else
delta_brd = 0;
}
manp = LCNPHY_TEMPSENSE(pi_lcn->lcnphy_rawtempsense);
temp_diff = manp - meas_temp;
if (temp_diff < 0) {
neg = 1;
temp_diff = -temp_diff;
}
......@@ -1740,9 +1736,10 @@ static s8 wlc_lcnphy_tempcompensated_txpwrctrl(struct brcms_phy *pi)
if (LCNREV_IS(pi->pubpi.phy_rev, 1))
index = 127;
if (new_index < 0 || new_index > 126) {
if (new_index < 0 || new_index > 126)
return index;
}
return new_index;
}
......@@ -1866,9 +1863,8 @@ wlc_lcnphy_tx_iqlo_cal(struct brcms_phy *pi,
return;
values_to_save = kmalloc(sizeof(u16) * 20, GFP_ATOMIC);
if (NULL == values_to_save) {
if (NULL == values_to_save)
return;
}
save_sslpnRxFeClkEnCtrl = read_phy_reg(pi, 0x6db);
save_sslpnCalibClkEnCtrl = read_phy_reg(pi, 0x6da);
......@@ -1991,7 +1987,6 @@ wlc_lcnphy_tx_iqlo_cal(struct brcms_phy *pi,
write_phy_reg(pi, 0x452, command_num);
if ((cal_type == 3) || (cal_type == 4)) {
wlc_lcnphy_common_read_table(pi, LCNPHY_TBL_ID_IQLOCAL,
&diq_start, 1, 16, 69);
......@@ -2001,10 +1996,8 @@ wlc_lcnphy_tx_iqlo_cal(struct brcms_phy *pi,
write_phy_reg(pi, 0x451, cal_cmds[i]);
if (!wlc_lcnphy_iqcal_wait(pi)) {
if (!wlc_lcnphy_iqcal_wait(pi))
goto cleanup;
}
wlc_lcnphy_common_read_table(pi, LCNPHY_TBL_ID_IQLOCAL,
best_coeffs,
......@@ -2013,10 +2006,9 @@ wlc_lcnphy_tx_iqlo_cal(struct brcms_phy *pi,
best_coeffs,
ARRAY_SIZE(best_coeffs), 16, 64);
if ((cal_type == 3) || (cal_type == 4)) {
if ((cal_type == 3) || (cal_type == 4))
wlc_lcnphy_common_write_table(pi, LCNPHY_TBL_ID_IQLOCAL,
&diq_start, 1, 16, 69);
}
wlc_lcnphy_common_read_table(pi, LCNPHY_TBL_ID_IQLOCAL,
pi_lcn->lcnphy_cal_results.
txiqlocal_bestcoeffs,
......@@ -2878,7 +2870,6 @@ static void wlc_lcnphy_txpwrtbl_iqlo_cal(struct brcms_phy *pi)
lcnphy_recal ? LCNPHY_CAL_RECAL :
LCNPHY_CAL_FULL), false);
} else {
wlc_lcnphy_tx_iqlo_soft_cal_full(pi);
}
......@@ -2905,10 +2896,8 @@ static void wlc_lcnphy_txpwrtbl_iqlo_cal(struct brcms_phy *pi)
wlc_lcnphy_tx_iqlo_cal(pi, &target_gains,
LCNPHY_CAL_FULL, false);
} else {
wlc_lcnphy_tx_iqlo_soft_cal_full(pi);
}
}
wlc_lcnphy_get_tx_iqcc(pi, &a, &b);
......@@ -3205,30 +3194,26 @@ static bool wlc_lcnphy_calc_rx_iq_comp(struct brcms_phy *pi, u16 num_samps)
if (arsh >= 0) {
a = (-(iq << (30 - iq_nbits)) + (ii >> (1 + arsh)));
temp = (s32) (ii >> arsh);
if (temp == 0) {
if (temp == 0)
return false;
}
} else {
a = (-(iq << (30 - iq_nbits)) + (ii << (-1 - arsh)));
temp = (s32) (ii << -arsh);
if (temp == 0) {
if (temp == 0)
return false;
}
}
a /= temp;
brsh = qq_nbits - 31 + 20;
if (brsh >= 0) {
b = (qq << (31 - qq_nbits));
temp = (s32) (ii >> brsh);
if (temp == 0) {
if (temp == 0)
return false;
}
} else {
b = (qq << (31 - qq_nbits));
temp = (s32) (ii << -brsh);
if (temp == 0) {
if (temp == 0)
return false;
}
}
b /= temp;
b -= a * a;
......@@ -3272,14 +3257,12 @@ wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi,
struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy;
ptr = kmalloc(sizeof(s16) * 131, GFP_ATOMIC);
if (NULL == ptr) {
if (NULL == ptr)
return false;
}
if (module == 2) {
while (iqcomp_sz--) {
if (iqcomp[iqcomp_sz].chan ==
CHSPEC_CHANNEL(pi->radio_chanspec)) {
wlc_lcnphy_set_rx_iq_comp(pi,
(u16)
iqcomp[iqcomp_sz].a,
......@@ -3297,10 +3280,9 @@ wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi,
tx_pwr_ctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi);
wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF);
for (i = 0; i < 11; i++) {
for (i = 0; i < 11; i++)
values_to_save[i] =
read_radio_reg(pi, rxiq_cal_rf_reg[i]);
}
Core1TxControl_old = read_phy_reg(pi, 0x631);
or_phy_reg(pi, 0x631, 0x0015);
......@@ -3401,17 +3383,16 @@ wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi,
mod_phy_reg(pi, 0x44c, (0x1 << 2), 0 << 2);
for (i = 0; i < 11; i++) {
for (i = 0; i < 11; i++)
write_radio_reg(pi, rxiq_cal_rf_reg[i],
values_to_save[i]);
}
if (tx_gain_override_old) {
if (tx_gain_override_old)
wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_index_old);
} else
else
wlc_lcnphy_disable_tx_gain_override(pi);
wlc_lcnphy_set_tx_pwr_ctrl(pi, tx_pwr_ctrl);
wlc_lcnphy_set_tx_pwr_ctrl(pi, tx_pwr_ctrl);
wlc_lcnphy_rx_gain_override_enable(pi, false);
}
......@@ -3477,10 +3458,10 @@ static void wlc_lcnphy_periodic_cal(struct brcms_phy *pi)
suspend =
(0 == (R_REG(&pi->regs->maccontrol) & MCTL_EN_MAC));
if (!suspend) {
wlapi_bmac_write_shm(pi->sh->physhim, M_CTS_DURATION, 10000);
wlapi_suspend_mac_and_wait(pi->sh->physhim);
}
wlc_lcnphy_deaf_mode(pi, true);
wlc_lcnphy_txpwrtbl_iqlo_cal(pi);
......@@ -3531,7 +3512,6 @@ void wlc_lcnphy_calib_modes(struct brcms_phy *pi, uint mode)
switch (mode) {
case PHY_PERICAL_CHAN:
break;
case PHY_FULLCAL:
wlc_lcnphy_periodic_cal(pi);
......@@ -3600,13 +3580,11 @@ wlc_lcnphy_set_chanspec_tweaks(struct brcms_phy *pi, u16 chanspec)
if (NORADIO_ENAB(pi->pubpi))
return;
if (channel == 14) {
if (channel == 14)
mod_phy_reg(pi, 0x448, (0x3 << 8), (2) << 8);
} else {
else
mod_phy_reg(pi, 0x448, (0x3 << 8), (1) << 8);
}
pi_lcn->lcnphy_bandedge_corr = 2;
if (channel == 1)
pi_lcn->lcnphy_bandedge_corr = 4;
......@@ -3731,10 +3709,9 @@ wlc_lcnphy_tx_iqlo_loopback(struct brcms_phy *pi, u16 *values_to_save)
{
u16 vmid;
int i;
for (i = 0; i < 20; i++) {
for (i = 0; i < 20; i++)
values_to_save[i] =
read_radio_reg(pi, iqlo_loopback_rf_regs[i]);
}
mod_phy_reg(pi, 0x44c, (0x1 << 12), 1 << 12);
mod_phy_reg(pi, 0x44d, (0x1 << 14), 1 << 14);
......@@ -3872,22 +3849,24 @@ wlc_lcnphy_samp_cap(struct brcms_phy *pi, int clip_detect_algo, u16 thresh,
val = R_REG(&pi->regs->tplatewrdata);
imag = ((val >> 16) & 0x3ff);
real = ((val) & 0x3ff);
if (imag > 511) {
if (imag > 511)
imag -= 1024;
}
if (real > 511) {
if (real > 511)
real -= 1024;
}
if (pi_lcn->lcnphy_iqcal_swp_dis)
ptr[(strptr - 0x7E00) / 4] = real;
else
ptr[(strptr - 0x7E00) / 4] = imag;
if (clip_detect_algo) {
if (imag > thresh || imag < -thresh) {
strptr = 0x8000;
ptr[130] = 1;
}
}
strptr += 4;
}
......@@ -4019,9 +3998,8 @@ wlc_lcnphy_a1(struct brcms_phy *pi, int cal_type, int num_levels,
phy_c21 = 0;
phy_c10 = phy_c13 = phy_c14 = phy_c8 = 0;
ptr = kmalloc(sizeof(s16) * 131, GFP_ATOMIC);
if (NULL == ptr) {
if (NULL == ptr)
return;
}
phy_c32 = kmalloc(sizeof(u16) * 20, GFP_ATOMIC);
if (NULL == phy_c32) {
......@@ -4054,18 +4032,16 @@ wlc_lcnphy_a1(struct brcms_phy *pi, int cal_type, int num_levels,
phy_c4 = 32;
if (num_levels == 0) {
if (cal_type != 0) {
if (cal_type != 0)
num_levels = 4;
} else {
else
num_levels = 9;
}
}
if (step_size_lg2 == 0) {
if (cal_type != 0) {
if (cal_type != 0)
step_size_lg2 = 3;
} else {
else
step_size_lg2 = 8;
}
}
phy_c7 = (1 << step_size_lg2);
......@@ -4150,11 +4126,11 @@ wlc_lcnphy_a1(struct brcms_phy *pi, int cal_type, int num_levels,
phy_c18 = 0;
phy_c19 = 0;
for (j = 0; j < 128; j++) {
if (cal_type != 0) {
if (cal_type != 0)
phy_c6 = j % phy_c4;
} else {
else
phy_c6 = (2 * j) % phy_c4;
}
phy_c2.re = phy_c1[phy_c6].re;
phy_c2.im = phy_c1[phy_c6].im;
phy_c17 = ptr[j];
......@@ -4206,10 +4182,9 @@ wlc_lcnphy_tx_iqlo_loopback_cleanup(struct brcms_phy *pi, u16 *values_to_save)
and_phy_reg(pi, 0x43b, 0xC);
for (i = 0; i < 20; i++) {
for (i = 0; i < 20; i++)
write_radio_reg(pi, iqlo_loopback_rf_regs[i],
values_to_save[i]);
}
}
static void
......@@ -4306,9 +4281,8 @@ static void wlc_lcnphy_tbl_init(struct brcms_phy *pi)
phybw40 = CHSPEC_IS40(pi->radio_chanspec);
for (idx = 0; idx < dot11lcnphytbl_info_sz_rev0; idx++) {
for (idx = 0; idx < dot11lcnphytbl_info_sz_rev0; idx++)
wlc_lcnphy_write_table(pi, &dot11lcnphytbl_info_rev0[idx]);
}
if (pi->sh->boardflags & BFL_FEM_BT) {
tab.tbl_id = LCNPHY_TBL_ID_RFSEQ;
......@@ -4443,7 +4417,6 @@ static void wlc_lcnphy_rev2_baseband_init(struct brcms_phy *pi)
{
if (CHSPEC_IS5G(pi->radio_chanspec)) {
mod_phy_reg(pi, 0x416, (0xff << 0), 80 << 0);
mod_phy_reg(pi, 0x416, (0xff << 8), 80 << 8);
}
}
......@@ -4763,9 +4736,8 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
opo = (u8) PHY_GETINTVAR(pi, "opo");
for (i = TXP_FIRST_CCK; i <= TXP_LAST_CCK; i++) {
for (i = TXP_FIRST_CCK; i <= TXP_LAST_CCK; i++)
pi->tx_srom_max_rate_2g[i] = txpwr;
}
offset_ofdm = (u32) PHY_GETINTVAR(pi, "ofdm2gpo");
......@@ -4811,9 +4783,8 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
if (PHY_GETVAR(pi, "cckdigfilttype")) {
s16 temp;
temp = (s16) PHY_GETINTVAR(pi, "cckdigfilttype");
if (temp >= 0) {
if (temp >= 0)
pi_lcn->lcnphy_cck_dig_filt_type = temp;
}
}
return true;
......@@ -4866,9 +4837,8 @@ wlc_lcnphy_radio_2064_channel_tune_4313(struct brcms_phy *pi, u8 channel)
if (chan_info_2064_lcnphy[i].chan == channel)
break;
if (i >= ARRAY_SIZE(chan_info_2064_lcnphy)) {
if (i >= ARRAY_SIZE(chan_info_2064_lcnphy))
return;
}
ci = &chan_info_2064_lcnphy[i];
}
......@@ -5015,14 +4985,11 @@ void wlc_phy_txpower_recalc_target_lcnphy(struct brcms_phy *pi)
if (wlc_lcnphy_tempsense_based_pwr_ctrl_enabled(pi)) {
wlc_lcnphy_calib_modes(pi, LCNPHY_PERICAL_TEMPBASED_TXPWRCTRL);
} else if (wlc_lcnphy_tssi_based_pwr_ctrl_enabled(pi)) {
pwr_ctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi);
wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF);
wlc_lcnphy_txpower_recalc_target(pi);
wlc_lcnphy_set_tx_pwr_ctrl(pi, pwr_ctrl);
} else
return;
}
}
void wlc_phy_detach_lcnphy(struct brcms_phy *pi)
......@@ -5035,9 +5002,8 @@ bool wlc_phy_attach_lcnphy(struct brcms_phy *pi)
struct brcms_phy_lcnphy *pi_lcn;
pi->u.pi_lcnphy = kzalloc(sizeof(struct brcms_phy_lcnphy), GFP_ATOMIC);
if (pi->u.pi_lcnphy == NULL) {
if (pi->u.pi_lcnphy == NULL)
return false;
}
pi_lcn = pi->u.pi_lcnphy;
......@@ -5196,18 +5162,17 @@ s32 wlc_lcnphy_rx_signal_power(struct brcms_phy *pi, s32 gain_index)
temperature = pi_lcn->lcnphy_lastsensed_temperature;
if ((temperature - 15) < -30) {
if ((temperature - 15) < -30)
input_power_db =
input_power_db + (((temperature - 10 - 25) * 286) >> 12) -
7;
} else if ((temperature - 15) < 4) {
else if ((temperature - 15) < 4)
input_power_db =
input_power_db + (((temperature - 10 - 25) * 286) >> 12) -
3;
} else {
else
input_power_db =
input_power_db + (((temperature - 10 - 25) * 286) >> 12);
}
wlc_lcnphy_rx_gain_override_enable(pi, 0);
......@@ -5267,11 +5232,10 @@ wlc_lcnphy_load_tx_iir_filter(struct brcms_phy *pi, bool is_ofdm, s16 filt_type)
}
if (filt_index != -1) {
for (j = 0; j < LCNPHY_NUM_DIG_FILT_COEFFS; j++) {
for (j = 0; j < LCNPHY_NUM_DIG_FILT_COEFFS; j++)
write_phy_reg(pi, addr[j],
LCNPHY_txdigfiltcoeffs_cck
[filt_index][j + 1]);
}
}
} else {
for (j = 0; j < LCNPHY_NUM_TX_DIG_FILTERS_OFDM; j++) {
......@@ -5282,11 +5246,10 @@ wlc_lcnphy_load_tx_iir_filter(struct brcms_phy *pi, bool is_ofdm, s16 filt_type)
}
if (filt_index != -1) {
for (j = 0; j < LCNPHY_NUM_DIG_FILT_COEFFS; j++) {
for (j = 0; j < LCNPHY_NUM_DIG_FILT_COEFFS; j++)
write_phy_reg(pi, addr_ofdm[j],
LCNPHY_txdigfiltcoeffs_ofdm
[filt_index][j + 1]);
}
}
}
......
......@@ -35,11 +35,11 @@ When both the 16bit inputs are 0x8000 then the output is saturated to 0x7fffffff
s16 qm_muls16(s16 op1, s16 op2)
{
s32 result;
if (op1 == (s16) 0x8000 && op2 == (s16) 0x8000) {
if (op1 == (s16) 0x8000 && op2 == (s16) 0x8000)
result = 0x7fffffff;
} else {
else
result = ((s32) (op1) * (s32) (op2));
}
return (s16) (result >> 15);
}
......@@ -51,11 +51,11 @@ s32 qm_add32(s32 op1, s32 op2)
{
s32 result;
result = op1 + op2;
if (op1 < 0 && op2 < 0 && result > 0) {
if (op1 < 0 && op2 < 0 && result > 0)
result = 0x80000000;
} else if (op1 > 0 && op2 > 0 && result < 0) {
else if (op1 > 0 && op2 > 0 && result < 0)
result = 0x7fffffff;
}
return result;
}
......@@ -67,13 +67,13 @@ s16 qm_add16(s16 op1, s16 op2)
{
s16 result;
s32 temp = (s32) op1 + (s32) op2;
if (temp > (s32) 0x7fff) {
if (temp > (s32) 0x7fff)
result = (s16) 0x7fff;
} else if (temp < (s32) 0xffff8000) {
else if (temp < (s32) 0xffff8000)
result = (s16) 0xffff8000;
} else {
else
result = (s16) temp;
}
return result;
}
......@@ -85,13 +85,13 @@ s16 qm_sub16(s16 op1, s16 op2)
{
s16 result;
s32 temp = (s32) op1 - (s32) op2;
if (temp > (s32) 0x7fff) {
if (temp > (s32) 0x7fff)
result = (s16) 0x7fff;
} else if (temp < (s32) 0xffff8000) {
else if (temp < (s32) 0xffff8000)
result = (s16) 0xffff8000;
} else {
else
result = (s16) temp;
}
return result;
}
......@@ -110,12 +110,12 @@ s32 qm_shl32(s32 op, int shift)
else if (shift < -31)
shift = -31;
if (shift >= 0) {
for (i = 0; i < shift; i++) {
for (i = 0; i < shift; i++)
result = qm_add32(result, result);
}
} else {
result = result >> (-shift);
}
return result;
}
......@@ -134,12 +134,12 @@ s16 qm_shl16(s16 op, int shift)
else if (shift < -15)
shift = -15;
if (shift > 0) {
for (i = 0; i < shift; i++) {
for (i = 0; i < shift; i++)
result = qm_add16(result, result);
}
} else {
result = result >> (-shift);
}
return result;
}
......
......@@ -435,14 +435,13 @@ brcms_c_rateset_default(struct brcms_c_rateset *rs_tgt,
(PHYTYPE_IS(phy_type, PHY_TYPE_N)) ||
(PHYTYPE_IS(phy_type, PHY_TYPE_LCN)) ||
(PHYTYPE_IS(phy_type, PHY_TYPE_SSN))) {
if (BAND_5G(bandtype)) {
if (BAND_5G(bandtype))
rs_dflt = (bw == BRCMS_20_MHZ ?
&ofdm_mimo_rates : &ofdm_40bw_mimo_rates);
} else {
else
rs_dflt = (bw == BRCMS_20_MHZ ?
&cck_ofdm_mimo_rates :
&cck_ofdm_40bw_mimo_rates);
}
} else if (PHYTYPE_IS(phy_type, PHY_TYPE_LP)) {
rs_dflt = (BAND_5G(bandtype)) ? &ofdm_rates : &cck_ofdm_rates;
} else if (PHYTYPE_IS(phy_type, PHY_TYPE_A)) {
......
......@@ -901,21 +901,20 @@ sprom_read_pci(struct si_pub *sih, u16 *sprom, uint wordoff,
if (check_crc) {
if (buf[0] == 0xffff) {
if (buf[0] == 0xffff)
/* The hardware thinks that an srom that starts with 0xffff
* is blank, regardless of the rest of the content, so declare
* it bad.
*/
return -ENODATA;
}
/* fixup the endianness so crc8 will pass */
htol16_buf(buf, nwords * 2);
if (brcmu_crc8((u8 *) buf, nwords * 2, CRC8_INIT_VALUE) !=
CRC8_GOOD_VALUE) {
CRC8_GOOD_VALUE)
/* DBG only pci always read srom4 first, then srom8/9 */
err = -EIO;
}
/* now correct the endianness of the byte array */
ltoh16_buf(buf, nwords * 2);
}
......@@ -930,9 +929,8 @@ static int otp_read_pci(struct si_pub *sih, u16 *buf, uint bufsz)
int err = 0;
otp = kzalloc(OTP_SZ_MAX, GFP_ATOMIC);
if (otp == NULL) {
if (otp == NULL)
return -ENOMEM;
}
err = otp_read_region(sih, OTP_HW_RGN, (u16 *) otp, &sz);
......@@ -941,20 +939,19 @@ static int otp_read_pci(struct si_pub *sih, u16 *buf, uint bufsz)
kfree(otp);
/* Check CRC */
if (buf[0] == 0xffff) {
if (buf[0] == 0xffff)
/* The hardware thinks that an srom that starts with 0xffff
* is blank, regardless of the rest of the content, so declare
* it bad.
*/
return -ENODATA;
}
/* fixup the endianness so crc8 will pass */
htol16_buf(buf, bufsz);
if (brcmu_crc8((u8 *) buf, SROM4_WORDS * 2, CRC8_INIT_VALUE) !=
CRC8_GOOD_VALUE) {
CRC8_GOOD_VALUE)
err = -EIO;
}
/* now correct the endianness of the byte array */
ltoh16_buf(buf, bufsz);
......
......@@ -80,15 +80,13 @@ void brcms_c_tempsense_upd(struct brcms_c_info *wlc)
txchain = active_chains & 0xf;
if (wlc->stf->txchain == wlc->stf->hw_txchain) {
if (txchain && (txchain < wlc->stf->hw_txchain)) {
if (txchain && (txchain < wlc->stf->hw_txchain))
/* turn off 1 tx chain */
brcms_c_stf_txchain_set(wlc, txchain, true);
}
} else if (wlc->stf->txchain < wlc->stf->hw_txchain) {
if (txchain == wlc->stf->hw_txchain) {
if (txchain == wlc->stf->hw_txchain)
/* turn back on txchain */
brcms_c_stf_txchain_set(wlc, txchain, true);
}
}
}
......@@ -136,9 +134,8 @@ brcms_c_stf_ss_algo_channel_get(struct brcms_c_info *wlc, u16 *ss_algo_channel,
static bool brcms_c_stf_stbc_tx_set(struct brcms_c_info *wlc, s32 int_val)
{
if ((int_val != AUTO) && (int_val != OFF) && (int_val != ON)) {
if ((int_val != AUTO) && (int_val != OFF) && (int_val != ON))
return false;
}
if ((int_val == ON) && (wlc->stf->txstreams == 1))
return false;
......@@ -158,9 +155,8 @@ static bool brcms_c_stf_stbc_tx_set(struct brcms_c_info *wlc, s32 int_val)
bool brcms_c_stf_stbc_rx_set(struct brcms_c_info *wlc, s32 int_val)
{
if ((int_val != HT_CAP_RX_STBC_NO)
&& (int_val != HT_CAP_RX_STBC_ONE_STREAM)) {
&& (int_val != HT_CAP_RX_STBC_ONE_STREAM))
return false;
}
if (BRCMS_STF_SS_STBC_RX(wlc)) {
if ((int_val != HT_CAP_RX_STBC_NO)
......@@ -178,15 +174,13 @@ static int brcms_c_stf_txcore_set(struct brcms_c_info *wlc, u8 Nsts,
BCMMSG(wlc->wiphy, "wl%d: Nsts %d core_mask %x\n",
wlc->pub->unit, Nsts, core_mask);
if (BRCMS_BITSCNT(core_mask) > wlc->stf->txstreams) {
if (BRCMS_BITSCNT(core_mask) > wlc->stf->txstreams)
core_mask = 0;
}
if ((BRCMS_BITSCNT(core_mask) == wlc->stf->txstreams) &&
((core_mask & ~wlc->stf->txchain)
|| !(core_mask & wlc->stf->txchain))) {
|| !(core_mask & wlc->stf->txchain)))
core_mask = wlc->stf->txchain;
}
wlc->stf->txcore[Nsts] = core_mask;
/* Nsts = 1..4, txcore index = 1..4 */
......@@ -375,9 +369,8 @@ static void _brcms_c_stf_phy_txant_upd(struct brcms_c_info *wlc)
if (BRCMS_ISNPHY(wlc->band) &&
NREV_GE(wlc->band->phyrev, 3)
&& NREV_LT(wlc->band->phyrev, 7)) {
&& NREV_LT(wlc->band->phyrev, 7))
wlc->stf->phytxant = PHY_TXC_ANT_2;
}
} else {
if (BRCMS_ISLCNPHY(wlc->band) ||
BRCMS_ISSSLPNPHY(wlc->band))
......@@ -414,22 +407,20 @@ void brcms_c_stf_phy_chain_calc(struct brcms_c_info *wlc)
/* these parameter are intended to be used for all PHY types */
if (wlc->stf->hw_txchain == 0 || wlc->stf->hw_txchain == 0xf) {
if (BRCMS_ISNPHY(wlc->band)) {
if (BRCMS_ISNPHY(wlc->band))
wlc->stf->hw_txchain = TXCHAIN_DEF_NPHY;
} else {
else
wlc->stf->hw_txchain = TXCHAIN_DEF;
}
}
wlc->stf->txchain = wlc->stf->hw_txchain;
wlc->stf->txstreams = (u8) BRCMS_BITSCNT(wlc->stf->hw_txchain);
if (wlc->stf->hw_rxchain == 0 || wlc->stf->hw_rxchain == 0xf) {
if (BRCMS_ISNPHY(wlc->band)) {
if (BRCMS_ISNPHY(wlc->band))
wlc->stf->hw_rxchain = RXCHAIN_DEF_NPHY;
} else {
else
wlc->stf->hw_rxchain = RXCHAIN_DEF;
}
}
wlc->stf->rxchain = wlc->stf->hw_rxchain;
......@@ -448,9 +439,9 @@ static u16 _brcms_c_stf_phytxchain_sel(struct brcms_c_info *wlc,
{
u16 phytxant = wlc->stf->phytxant;
if (RSPEC_STF(rspec) != PHY_TXC1_MODE_SISO) {
if (RSPEC_STF(rspec) != PHY_TXC1_MODE_SISO)
phytxant = wlc->stf->txchain << PHY_TXC_ANT_SHIFT;
} else if (wlc->stf->txant == ANT_TX_DEF)
else if (wlc->stf->txant == ANT_TX_DEF)
phytxant = wlc->stf->txchain << PHY_TXC_ANT_SHIFT;
phytxant &= PHY_TXC_ANT_MASK;
return phytxant;
......
......@@ -244,9 +244,8 @@ brcmu_pktq_pflush(struct pktq *pq, int prec, bool dir,
}
}
if (q->head == NULL) {
if (q->head == NULL)
q->tail = NULL;
}
}
EXPORT_SYMBOL(brcmu_pktq_pflush);
......@@ -404,26 +403,23 @@ int brcmu_iovar_lencheck(const struct brcmu_iovar *vi, void *arg, int len,
case IOVT_UINT16:
case IOVT_UINT32:
/* all integers are s32 sized args at the ioctl interface */
if (len < (int)sizeof(int)) {
if (len < (int)sizeof(int))
bcmerror = -EOVERFLOW;
}
break;
case IOVT_BUFFER:
/* buffer must meet minimum length requirement */
if (len < vi->minlen) {
if (len < vi->minlen)
bcmerror = -EOVERFLOW;
}
break;
case IOVT_VOID:
if (!set) {
if (!set)
/* Cannot return nil... */
bcmerror = -ENOTSUPP;
} else if (len) {
else if (len)
/* Set is an action w/o parameters */
bcmerror = -ENOBUFS;
}
break;
default:
......@@ -670,10 +666,9 @@ u16 brcmu_qdbm_to_mw(u8 qdbm)
uint factor = 1;
int idx = qdbm - QDBM_OFFSET;
if (idx >= QDBM_TABLE_LEN) {
if (idx >= QDBM_TABLE_LEN)
/* clamp to max u16 mW value */
return 0xFFFF;
}
/* scale the qdBm index up to the range of the table 0-40
* where an offset of 40 qdBm equals a factor of 10 mW.
......
......@@ -34,9 +34,8 @@ bool brcmu_chspec_malformed(u16 chanspec)
if (CHSPEC_IS20(chanspec)) {
if (!CHSPEC_SB_NONE(chanspec))
return true;
} else {
if (!CHSPEC_SB_UPPER(chanspec) && !CHSPEC_SB_LOWER(chanspec))
return true;
} else if (!CHSPEC_SB_UPPER(chanspec) && !CHSPEC_SB_LOWER(chanspec)) {
return true;
}
return false;
......@@ -60,13 +59,12 @@ u8 brcmu_chspec_ctlchan(u16 chspec)
/* chanspec channel holds the centre frequency, use that and the
* side band information to reconstruct the control channel number
*/
if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_UPPER) {
if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_UPPER)
/* control chan is the upper 20 MHZ SB of the 40MHZ channel */
ctl_chan = UPPER_20_SB(CHSPEC_CHANNEL(chspec));
} else {
else
/* control chan is the lower 20 MHZ SB of the 40MHZ channel */
ctl_chan = LOWER_20_SB(CHSPEC_CHANNEL(chspec));
}
}
return ctl_chan;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册