diff options
author | Roland Vossen | 2011-08-08 15:58:48 +0200 |
---|---|---|
committer | Greg Kroah-Hartman | 2011-08-23 22:00:08 +0200 |
commit | d89a4c80601db2e565b89b1f13fdbd9a987324dd (patch) | |
tree | d856cc7eeaec0840fb039527504ce735f0d09509 /drivers/staging/brcm80211/brcmsmac/phy | |
parent | staging: brcm80211: cleaned up softmac DMA layer (diff) | |
download | kernel-qcow2-linux-d89a4c80601db2e565b89b1f13fdbd9a987324dd.tar.gz kernel-qcow2-linux-d89a4c80601db2e565b89b1f13fdbd9a987324dd.tar.xz kernel-qcow2-linux-d89a4c80601db2e565b89b1f13fdbd9a987324dd.zip |
staging: brcm80211: removed void * from softmac phy
Code cleanup. Replacing void * by other pointer types improves code
readability and enforces stronger type checking.
Reported-by: Julian Calaby <julian.calaby@gmail.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/brcm80211/brcmsmac/phy')
-rw-r--r-- | drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 13 | ||||
-rw-r--r-- | drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h | 11 | ||||
-rw-r--r-- | drivers/staging/brcm80211/brcmsmac/phy/phy_int.h | 5 | ||||
-rw-r--r-- | drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c | 7 | ||||
-rw-r--r-- | drivers/staging/brcm80211/brcmsmac/phy/phy_n.c | 47 |
5 files changed, 38 insertions, 45 deletions
diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c index 22f7bfc79dde..831c2fe35ee7 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c @@ -123,7 +123,7 @@ const u8 ofdm_rate_lookup[] = { static void wlc_set_phy_uninitted(struct brcms_phy *pi); static u32 wlc_phy_get_radio_ver(struct brcms_phy *pi); -static void wlc_phy_timercb_phycal(void *arg); +static void wlc_phy_timercb_phycal(struct brcms_phy *pi); static bool wlc_phy_noise_calc_phy(struct brcms_phy *pi, u32 *cmplx_pwr, s8 *pwr_ant); @@ -509,7 +509,7 @@ struct shared_phy *wlc_phy_shared_attach(struct shared_phy_params *shp) } struct brcms_phy_pub * -wlc_phy_attach(struct shared_phy *sh, void *regs, int bandtype, +wlc_phy_attach(struct shared_phy *sh, struct d11regs *regs, int bandtype, char *vars, struct wiphy *wiphy) { struct brcms_phy *pi; @@ -539,7 +539,7 @@ wlc_phy_attach(struct shared_phy *sh, void *regs, int bandtype, if (pi == NULL) return NULL; pi->wiphy = wiphy; - pi->regs = (struct d11regs *) regs; + pi->regs = regs; pi->sh = sh; pi->phy_init_por = true; pi->phy_wreg_limit = PHY_WREG_LIMIT; @@ -720,9 +720,8 @@ u32 wlc_phy_get_coreflags(struct brcms_phy_pub *pih) return pi->pubpi.coreflags; } -static void wlc_phy_timercb_phycal(void *arg) +static void wlc_phy_timercb_phycal(struct brcms_phy *pi) { - struct brcms_phy *pi = (struct brcms_phy *) arg; uint delay = 5; if (PHY_PERICAL_MPHASE_PENDING(pi)) { @@ -2619,9 +2618,9 @@ void wlc_phy_compute_dB(u32 *cmplx_pwr, s8 *p_cmplx_pwr_dB, u8 core) } } -void wlc_phy_rssi_compute(struct brcms_phy_pub *pih, void *ctx) +void wlc_phy_rssi_compute(struct brcms_phy_pub *pih, + struct brcms_d11rxhdr *wlc_rxhdr) { - struct brcms_d11rxhdr *wlc_rxhdr = (struct brcms_d11rxhdr *) ctx; struct d11rxhdr *rxh = &wlc_rxhdr->rxhdr; int rssi = le16_to_cpu(rxh->PhyRxStatus_1) & PRXS1_JSSI_MASK; uint radioid = pih->radioid; diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h b/drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h index d2faba2e522a..42e0cf044a5b 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h +++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h @@ -103,6 +103,9 @@ #define BRCMS_RSSI_INVALID 0 /* invalid RSSI value */ +struct d11regs; +struct phy_shim_info; + struct txpwr_limits { u8 cck[BRCMS_NUM_RATES_CCK]; u8 ofdm[BRCMS_NUM_RATES_OFDM]; @@ -160,7 +163,7 @@ struct brcms_chanvec { struct shared_phy_params { struct si_pub *sih; - void *physhim; + struct phy_shim_info *physhim; uint unit; uint corerev; uint bustype; @@ -181,7 +184,8 @@ struct shared_phy_params { extern struct shared_phy *wlc_phy_shared_attach(struct shared_phy_params *shp); -extern struct brcms_phy_pub *wlc_phy_attach(struct shared_phy *sh, void *regs, +extern struct brcms_phy_pub *wlc_phy_attach(struct shared_phy *sh, + struct d11regs *regs, int bandtype, char *vars, struct wiphy *wiphy); extern void wlc_phy_detach(struct brcms_phy_pub *ppi); @@ -209,7 +213,8 @@ extern void wlc_phy_chanspec_radio_set(struct brcms_phy_pub *ppi, extern u16 wlc_phy_bw_state_get(struct brcms_phy_pub *ppi); extern void wlc_phy_bw_state_set(struct brcms_phy_pub *ppi, u16 bw); -extern void wlc_phy_rssi_compute(struct brcms_phy_pub *pih, void *ctx); +extern void wlc_phy_rssi_compute(struct brcms_phy_pub *pih, + struct brcms_d11rxhdr *wlc_rxhdr); extern void wlc_phy_por_inform(struct brcms_phy_pub *ppi); extern void wlc_phy_noise_sample_intr(struct brcms_phy_pub *ppi); extern bool wlc_phy_bist_check_phy(struct brcms_phy_pub *ppi); diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h b/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h index 25ea00342f52..bcc6d8312f3d 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h +++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h @@ -41,6 +41,8 @@ extern u32 phyhal_msg_level; #define LCNXN_BASEREV 16 +struct phy_shim_info; + struct brcms_phy_srom_fem { /* TSSI positive slope, 1: positive, 0: negative */ u8 tssipos; @@ -546,7 +548,7 @@ struct shared_phy { struct brcms_phy *phy_head; uint unit; struct si_pub *sih; - void *physhim; + struct phy_shim_info *physhim; uint corerev; u32 machwcap; bool up; @@ -611,7 +613,6 @@ struct brcms_phy { struct brcms_phy_pub pubpi_ro; struct shared_phy *sh; struct phy_func_ptr pi_fptr; - void *pi_ptr; union { struct brcms_phy_lcnphy *pi_lcnphy; diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c index 3d140eb0bc50..dcf626e574c3 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c +++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c @@ -1041,7 +1041,7 @@ void wlc_lcnphy_read_table(struct brcms_phy *pi, struct phytbl_info *pti) static void wlc_lcnphy_common_read_table(struct brcms_phy *pi, u32 tbl_id, - const void *tbl_ptr, u32 tbl_len, + const u16 *tbl_ptr, u32 tbl_len, u32 tbl_width, u32 tbl_offset) { struct phytbl_info tab; @@ -1055,7 +1055,7 @@ wlc_lcnphy_common_read_table(struct brcms_phy *pi, u32 tbl_id, static void wlc_lcnphy_common_write_table(struct brcms_phy *pi, u32 tbl_id, - const void *tbl_ptr, u32 tbl_len, + const u16 *tbl_ptr, u32 tbl_len, u32 tbl_width, u32 tbl_offset) { @@ -1965,13 +1965,12 @@ wlc_lcnphy_tx_iqlo_cal(struct brcms_phy *pi, write_phy_reg(pi, 0x93d, 0xc0); wlc_lcnphy_common_write_table(pi, LCNPHY_TBL_ID_IQLOCAL, - (const void *) lcnphy_iqcal_loft_gainladder, ARRAY_SIZE(lcnphy_iqcal_loft_gainladder), 16, 0); wlc_lcnphy_common_write_table(pi, LCNPHY_TBL_ID_IQLOCAL, - (const void *)lcnphy_iqcal_ir_gainladder, + lcnphy_iqcal_ir_gainladder, ARRAY_SIZE( lcnphy_iqcal_ir_gainladder), 16, 32); diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c index fb64597df430..2e8aa64979c3 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c +++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c @@ -18627,11 +18627,10 @@ wlc_phy_adjust_min_noisevar_nphy(struct brcms_phy *pi, int ntones, offset = (tone_id >= 0) ? ((tone_id * 2) + 1) : (tbllen + (tone_id * 2) + 1); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_NOISEVAR, 1, - offset, 32, - (void *)&pi-> - nphy_saved_noisevars. - min_noise_vars[i]); + wlc_phy_table_write_nphy( + pi, NPHY_TBL_ID_NOISEVAR, 1, + offset, 32, + &pi->nphy_saved_noisevars.min_noise_vars[i]); } pi->nphy_saved_noisevars.bufcount = 0; @@ -18652,8 +18651,7 @@ wlc_phy_adjust_min_noisevar_nphy(struct brcms_phy *pi, int ntones, &pi->nphy_saved_noisevars. min_noise_vars[i]); wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_NOISEVAR, 1, - offset, 32, - (void *)&noise_var_buf[i]); + offset, 32, &noise_var_buf[i]); pi->nphy_saved_noisevars.bufcount++; } @@ -19296,8 +19294,7 @@ static void wlc_phy_restorecal_nphy(struct brcms_phy *pi) loft_comp = &pi->calibration_cache.txcal_coeffs_5G[5]; } - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 4, 80, 16, - (void *)tbl_ptr); + wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 4, 80, 16, tbl_ptr); if (NREV_GE(pi->pubpi.phy_rev, 3)) { txcal_coeffs_bphy[0] = tbl_ptr[0]; @@ -24307,7 +24304,7 @@ static void wlc_phy_tx_iq_war_nphy(struct brcms_phy *pi) { struct nphy_iq_comp tx_comp; - wlc_phy_table_read_nphy(pi, 15, 4, 0x50, 16, (void *)&tx_comp); + wlc_phy_table_read_nphy(pi, 15, 4, 0x50, 16, &tx_comp); wlapi_bmac_write_shm(pi->sh->physhim, M_20IN40_IQ, tx_comp.a0); wlapi_bmac_write_shm(pi->sh->physhim, M_20IN40_IQ + 2, tx_comp.b0); @@ -28684,23 +28681,15 @@ wlc_phy_txpwr_index_nphy(struct brcms_phy *pi, u8 core_mask, s8 txpwrindex, wlc_phy_table_write_nphy(pi, 15, 1, 87, 16, &m1m2); if (restore_cals) { - - wlc_phy_table_write_nphy(pi, 15, 2, - (80 + 2 * core), 16, - (void *)&pi-> - nphy_txpwrindex[core]. - iqcomp_a); - - wlc_phy_table_write_nphy(pi, 15, 1, (85 + core), - 16, - &pi-> - nphy_txpwrindex[core]. - locomp); - wlc_phy_table_write_nphy(pi, 15, 1, (93 + core), - 16, - (void *)&pi-> - nphy_txpwrindex[core]. - locomp); + wlc_phy_table_write_nphy( + pi, 15, 2, (80 + 2 * core), 16, + &pi->nphy_txpwrindex[core].iqcomp_a); + wlc_phy_table_write_nphy( + pi, 15, 1, (85 + core), 16, + &pi->nphy_txpwrindex[core].locomp); + wlc_phy_table_write_nphy( + pi, 15, 1, (93 + core), 16, + &pi->nphy_txpwrindex[core].locomp); } wlc_phy_txpwrctrl_enable_nphy(pi, pi->nphy_txpwrctrl); @@ -28743,13 +28732,13 @@ wlc_phy_txpwr_index_nphy(struct brcms_phy *pi, u8 core_mask, s8 txpwrindex, wlc_phy_table_read_nphy(pi, 15, 2, (80 + 2 * core), 16, - (void *)&pi-> + &pi-> nphy_txpwrindex[core]. iqcomp_a); wlc_phy_table_read_nphy(pi, 15, 1, (85 + core), 16, - (void *)&pi-> + &pi-> nphy_txpwrindex[core]. locomp); |