Commit 2fc6af5b authored by Arend van Spriel's avatar Arend van Spriel Committed by Greg Kroah-Hartman

staging: brcm80211: remove brcms_c_get_par and set_par functions

The source main.c provided an interface function that handled several
things demultiplexing on given identifier. This interface has been
replaced by separate functions to make it more straightforward.
Reported-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Reviewed-by: default avatarRoland Vossen <rvossen@broadcom.com>
Signed-off-by: default avatarRoland Vossen <rvossen@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 2e08396d
...@@ -373,14 +373,8 @@ static int brcms_ops_config(struct ieee80211_hw *hw, u32 changed) ...@@ -373,14 +373,8 @@ static int brcms_ops_config(struct ieee80211_hw *hw, u32 changed)
LOCK(wl); LOCK(wl);
if (changed & IEEE80211_CONF_CHANGE_LISTEN_INTERVAL) { if (changed & IEEE80211_CONF_CHANGE_LISTEN_INTERVAL) {
if (brcms_c_set_par(wl->wlc, IOV_BCN_LI_BCN, brcms_c_set_beacon_listen_interval(wl->wlc,
conf->listen_interval) < 0) { conf->listen_interval);
wiphy_err(wiphy, "%s: Error setting listen_interval\n",
__func__);
err = -EIO;
goto config_out;
}
brcms_c_get_par(wl->wlc, IOV_BCN_LI_BCN, &new_int);
} }
if (changed & IEEE80211_CONF_CHANGE_MONITOR) if (changed & IEEE80211_CONF_CHANGE_MONITOR)
wiphy_err(wiphy, "%s: change monitor mode: %s (implement)\n", wiphy_err(wiphy, "%s: change monitor mode: %s (implement)\n",
...@@ -392,17 +386,16 @@ static int brcms_ops_config(struct ieee80211_hw *hw, u32 changed) ...@@ -392,17 +386,16 @@ static int brcms_ops_config(struct ieee80211_hw *hw, u32 changed)
"true" : "false"); "true" : "false");
if (changed & IEEE80211_CONF_CHANGE_POWER) { if (changed & IEEE80211_CONF_CHANGE_POWER) {
if (brcms_c_set_par(wl->wlc, IOV_QTXPOWER, err = brcms_c_set_tx_power(wl->wlc, conf->power_level);
conf->power_level * 4) < 0) { if (err < 0) {
wiphy_err(wiphy, "%s: Error setting power_level\n", wiphy_err(wiphy, "%s: Error setting power_level\n",
__func__); __func__);
err = -EIO;
goto config_out; goto config_out;
} }
brcms_c_get_par(wl->wlc, IOV_QTXPOWER, &new_int); new_int = brcms_c_get_tx_power(wl->wlc);
if (new_int != (conf->power_level * 4)) if (new_int != conf->power_level)
wiphy_err(wiphy, "%s: Power level req != actual, %d %d" wiphy_err(wiphy, "%s: Power level req != actual, %d %d"
"\n", __func__, conf->power_level * 4, "\n", __func__, conf->power_level,
new_int); new_int);
} }
if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
...@@ -1177,9 +1170,8 @@ static struct brcms_info *brcms_attach(u16 vendor, u16 device, ...@@ -1177,9 +1170,8 @@ static struct brcms_info *brcms_attach(u16 vendor, u16 device,
wl->pub->ieee_hw = hw; wl->pub->ieee_hw = hw;
if (brcms_c_set_par(wl->wlc, IOV_MPC, 0) < 0) /* disable mpc */
wiphy_err(wl->wiphy, "wl%d: Error setting MPC variable to 0\n", brcms_c_set_radio_mpc(wl->wlc, false);
unit);
/* register our interrupt handler */ /* register our interrupt handler */
if (request_irq(irq, brcms_isr, IRQF_SHARED, KBUILD_MODNAME, wl)) { if (request_irq(irq, brcms_isr, IRQF_SHARED, KBUILD_MODNAME, wl)) {
......
...@@ -9375,74 +9375,37 @@ void brcms_c_wait_for_tx_completion(struct brcms_c_info *wlc, bool drop) ...@@ -9375,74 +9375,37 @@ void brcms_c_wait_for_tx_completion(struct brcms_c_info *wlc, bool drop)
brcms_msleep(wlc->wl, 1); brcms_msleep(wlc->wl, 1);
} }
int brcms_c_set_par(struct brcms_c_info *wlc, enum wlc_par_id par_id, void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc, u8 interval)
int int_val)
{ {
int err = 0; wlc->bcn_li_bcn = interval;
if (wlc->pub->up)
brcms_c_bcn_li_upd(wlc);
}
switch (par_id) { int brcms_c_set_tx_power(struct brcms_c_info *wlc, int txpwr)
case IOV_BCN_LI_BCN: {
wlc->bcn_li_bcn = (u8) int_val; uint qdbm;
if (wlc->pub->up)
brcms_c_bcn_li_upd(wlc); /* Remove override bit and clip to max qdbm value */
break; qdbm = min_t(uint, txpwr * BRCMS_TXPWR_DB_FACTOR, 0xff);
/* As long as override is false, this only sets the *user* return wlc_phy_txpower_set(wlc->band->pi, qdbm, false);
targets. User can twiddle this all he wants with no harm.
wlc_phy_txpower_set() explicitly sets override to false if
not internal or test.
*/
case IOV_QTXPOWER:{
u8 qdbm;
bool override;
/* Remove override bit and clip to max qdbm value */
qdbm = (u8)min_t(u32, (int_val & ~WL_TXPWR_OVERRIDE), 0xff);
/* Extract override setting */
override = (int_val & WL_TXPWR_OVERRIDE) ? true : false;
err =
wlc_phy_txpower_set(wlc->band->pi, qdbm, override);
break;
}
case IOV_MPC:
wlc->mpc = (bool)int_val;
brcms_c_radio_mpc_upd(wlc);
break;
default:
err = -ENOTSUPP;
}
return err;
} }
int brcms_c_get_par(struct brcms_c_info *wlc, enum wlc_par_id par_id, int brcms_c_get_tx_power(struct brcms_c_info *wlc)
int *ret_int_ptr)
{ {
int err = 0; uint qdbm;
bool override;
switch (par_id) { wlc_phy_txpower_get(wlc->band->pi, &qdbm, &override);
case IOV_BCN_LI_BCN:
*ret_int_ptr = wlc->bcn_li_bcn; /* Return qdbm units */
break; return (int)(qdbm / BRCMS_TXPWR_DB_FACTOR);
case IOV_QTXPOWER: { }
uint qdbm;
bool override; void brcms_c_set_radio_mpc(struct brcms_c_info *wlc, bool mpc)
{
err = wlc_phy_txpower_get(wlc->band->pi, &qdbm, wlc->mpc = mpc;
&override); brcms_c_radio_mpc_upd(wlc);
if (err != 0)
return err;
/* Return qdbm units */
*ret_int_ptr =
qdbm | (override ? WL_TXPWR_OVERRIDE : 0);
break;
}
case IOV_MPC:
*ret_int_ptr = (s32) wlc->mpc;
break;
default:
err = -ENOTSUPP;
}
return err;
} }
/* /*
......
...@@ -1463,7 +1463,7 @@ int wlc_phy_txpower_set(struct brcms_phy_pub *ppi, uint qdbm, bool override) ...@@ -1463,7 +1463,7 @@ int wlc_phy_txpower_set(struct brcms_phy_pub *ppi, uint qdbm, bool override)
int i; int i;
if (qdbm > 127) if (qdbm > 127)
return 5; return -EINVAL;
for (i = 0; i < TXP_NUM_RATES; i++) for (i = 0; i < TXP_NUM_RATES; i++)
pi->tx_user_target[i] = (u8) qdbm; pi->tx_user_target[i] = (u8) qdbm;
......
...@@ -350,10 +350,6 @@ extern void brcms_c_ampdu_flush(struct brcms_c_info *wlc, ...@@ -350,10 +350,6 @@ extern void brcms_c_ampdu_flush(struct brcms_c_info *wlc,
struct ieee80211_sta *sta, u16 tid); struct ieee80211_sta *sta, u16 tid);
extern void brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid, extern void brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid,
u8 ba_wsize, uint max_rx_ampdu_bytes); u8 ba_wsize, uint max_rx_ampdu_bytes);
extern int brcms_c_set_par(struct brcms_c_info *wlc, enum wlc_par_id par_id,
int val);
extern int brcms_c_get_par(struct brcms_c_info *wlc, enum wlc_par_id par_id,
int *ret_int_ptr);
extern char *getvar(char *vars, const char *name); extern char *getvar(char *vars, const char *name);
extern int getintvar(char *vars, const char *name); extern int getintvar(char *vars, const char *name);
...@@ -384,6 +380,10 @@ int brcms_c_set_beacon_period(struct brcms_c_info *wlc, u16 period); ...@@ -384,6 +380,10 @@ int brcms_c_set_beacon_period(struct brcms_c_info *wlc, u16 period);
u16 brcms_c_get_phy_type(struct brcms_c_info *wlc, int phyidx); u16 brcms_c_get_phy_type(struct brcms_c_info *wlc, int phyidx);
void brcms_c_set_shortslot_override(struct brcms_c_info *wlc, void brcms_c_set_shortslot_override(struct brcms_c_info *wlc,
s8 sslot_override); s8 sslot_override);
void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc, u8 interval);
int brcms_c_set_tx_power(struct brcms_c_info *wlc, int txpwr);
int brcms_c_get_tx_power(struct brcms_c_info *wlc);
void brcms_c_set_radio_mpc(struct brcms_c_info *wlc, bool mpc);
/* helper functions */ /* helper functions */
extern bool brcms_c_check_radio_disabled(struct brcms_c_info *wlc); extern bool brcms_c_check_radio_disabled(struct brcms_c_info *wlc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment