]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
staging: brcm80211: remove brcms_c_get_par and set_par functions
authorArend van Spriel <arend@broadcom.com>
Tue, 13 Sep 2011 07:49:51 +0000 (09:49 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 16 Sep 2011 18:41:53 +0000 (20:41 +0200)
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: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/brcm80211/brcmsmac/mac80211_if.c
drivers/staging/brcm80211/brcmsmac/main.c
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
drivers/staging/brcm80211/brcmsmac/pub.h

index 3ec72f1a38f1cd53e9af4fc9f781c061cf909644..65d30b58469ab89b995b2e620b0653ec9aa37044 100644 (file)
@@ -373,14 +373,8 @@ static int brcms_ops_config(struct ieee80211_hw *hw, u32 changed)
 
        LOCK(wl);
        if (changed & IEEE80211_CONF_CHANGE_LISTEN_INTERVAL) {
-               if (brcms_c_set_par(wl->wlc, IOV_BCN_LI_BCN,
-                                   conf->listen_interval) < 0) {
-                       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);
+               brcms_c_set_beacon_listen_interval(wl->wlc,
+                                                  conf->listen_interval);
        }
        if (changed & IEEE80211_CONF_CHANGE_MONITOR)
                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)
                          "true" : "false");
 
        if (changed & IEEE80211_CONF_CHANGE_POWER) {
-               if (brcms_c_set_par(wl->wlc, IOV_QTXPOWER,
-                                   conf->power_level * 4) < 0) {
+               err = brcms_c_set_tx_power(wl->wlc, conf->power_level);
+               if (err < 0) {
                        wiphy_err(wiphy, "%s: Error setting power_level\n",
                                  __func__);
-                       err = -EIO;
                        goto config_out;
                }
-               brcms_c_get_par(wl->wlc, IOV_QTXPOWER, &new_int);
-               if (new_int != (conf->power_level * 4))
+               new_int = brcms_c_get_tx_power(wl->wlc);
+               if (new_int != conf->power_level)
                        wiphy_err(wiphy, "%s: Power level req != actual, %d %d"
-                                 "\n", __func__, conf->power_level * 4,
+                                 "\n", __func__, conf->power_level,
                                  new_int);
        }
        if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
@@ -1177,9 +1170,8 @@ 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)
-               wiphy_err(wl->wiphy, "wl%d: Error setting MPC variable to 0\n",
-                         unit);
+       /* disable mpc */
+       brcms_c_set_radio_mpc(wl->wlc, false);
 
        /* register our interrupt handler */
        if (request_irq(irq, brcms_isr, IRQF_SHARED, KBUILD_MODNAME, wl)) {
index a40fcba38157cce0eb889ee95fc60f43ea0bda96..ec7de38069e5f6073dd9663f1b2bbfcb237be288 100644 (file)
@@ -9375,74 +9375,37 @@ void brcms_c_wait_for_tx_completion(struct brcms_c_info *wlc, bool drop)
                brcms_msleep(wlc->wl, 1);
 }
 
-int brcms_c_set_par(struct brcms_c_info *wlc, enum wlc_par_id par_id,
-                   int int_val)
+void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc, u8 interval)
 {
-       int err = 0;
+       wlc->bcn_li_bcn = interval;
+       if (wlc->pub->up)
+               brcms_c_bcn_li_upd(wlc);
+}
 
-       switch (par_id) {
-       case IOV_BCN_LI_BCN:
-               wlc->bcn_li_bcn = (u8) int_val;
-               if (wlc->pub->up)
-                       brcms_c_bcn_li_upd(wlc);
-               break;
-               /* As long as override is false, this only sets the *user*
-                  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_set_tx_power(struct brcms_c_info *wlc, int txpwr)
+{
+       uint qdbm;
+
+       /* Remove override bit and clip to max qdbm value */
+       qdbm = min_t(uint, txpwr * BRCMS_TXPWR_DB_FACTOR, 0xff);
+       return wlc_phy_txpower_set(wlc->band->pi, qdbm, false);
 }
 
-int brcms_c_get_par(struct brcms_c_info *wlc, enum wlc_par_id par_id,
-                   int *ret_int_ptr)
+int brcms_c_get_tx_power(struct brcms_c_info *wlc)
 {
-       int err = 0;
+       uint qdbm;
+       bool override;
 
-       switch (par_id) {
-       case IOV_BCN_LI_BCN:
-               *ret_int_ptr = wlc->bcn_li_bcn;
-               break;
-       case IOV_QTXPOWER: {
-               uint qdbm;
-               bool override;
-
-               err = wlc_phy_txpower_get(wlc->band->pi, &qdbm,
-                       &override);
-               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;
+       wlc_phy_txpower_get(wlc->band->pi, &qdbm, &override);
+
+       /* Return qdbm units */
+       return (int)(qdbm / BRCMS_TXPWR_DB_FACTOR);
+}
+
+void brcms_c_set_radio_mpc(struct brcms_c_info *wlc, bool mpc)
+{
+       wlc->mpc = mpc;
+       brcms_c_radio_mpc_upd(wlc);
 }
 
 /*
index eb171f0269c6c6bf58024a9ed40b982498ebb78d..196a595f73e0f9e4d1c34a1abfad1e0d1a28ead0 100644 (file)
@@ -1463,7 +1463,7 @@ int wlc_phy_txpower_set(struct brcms_phy_pub *ppi, uint qdbm, bool override)
        int i;
 
        if (qdbm > 127)
-               return 5;
+               return -EINVAL;
 
        for (i = 0; i < TXP_NUM_RATES; i++)
                pi->tx_user_target[i] = (u8) qdbm;
index 62303509f8a49f84771c6cab5cf9b9e6f251e709..c72f7b581b9f07ef241bdb3a7ee846d064818906 100644 (file)
@@ -350,10 +350,6 @@ extern void brcms_c_ampdu_flush(struct brcms_c_info *wlc,
                            struct ieee80211_sta *sta, u16 tid);
 extern void brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid,
                                         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 int getintvar(char *vars, const char *name);
 
@@ -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);
 void brcms_c_set_shortslot_override(struct brcms_c_info *wlc,
                                    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 */
 extern bool brcms_c_check_radio_disabled(struct brcms_c_info *wlc);