Instead of passing a flag bitmask to mwl8k_cmd_802_11_radio_control,
pass the 'enable' and 'force' arguments as separate parameters, and
introduce wrappers for the common cases of enabling and disabling
without forcing.
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
struct ieee80211_channel channels[14];
struct ieee80211_rate rates[12];
struct ieee80211_channel channels[14];
struct ieee80211_rate rates[12];
/* RF preamble: Short, Long or Auto */
u8 radio_preamble;
/* RF preamble: Short, Long or Auto */
u8 radio_preamble;
/* WMM MODE 1 for enabled; 0 for disabled */
bool wmm_mode;
/* WMM MODE 1 for enabled; 0 for disabled */
bool wmm_mode;
-#define MWL8K_RADIO_FORCE 0x2
-#define MWL8K_RADIO_ENABLE 0x1
-#define MWL8K_RADIO_DISABLE 0x0
#define MWL8K_RADIO_AUTO_PREAMBLE 0x0005
#define MWL8K_RADIO_SHORT_PREAMBLE 0x0003
#define MWL8K_RADIO_LONG_PREAMBLE 0x0001
#define MWL8K_RADIO_AUTO_PREAMBLE 0x0005
#define MWL8K_RADIO_SHORT_PREAMBLE 0x0003
#define MWL8K_RADIO_LONG_PREAMBLE 0x0001
count = mwl8k_txq_busy(priv);
if (count) {
priv->tx_wait = &cmd_wait;
count = mwl8k_txq_busy(priv);
if (count) {
priv->tx_wait = &cmd_wait;
mwl8k_tx_start(priv);
}
spin_unlock_bh(&priv->tx_lock);
mwl8k_tx_start(priv);
}
spin_unlock_bh(&priv->tx_lock);
ieee80211_tx_status_irqsafe(hw, skb);
ieee80211_tx_status_irqsafe(hw, skb);
- wake = !priv->inconfig && priv->radio_state;
+ wake = !priv->inconfig && priv->radio_on;
__le16 radio_on;
} __attribute__((packed));
__le16 radio_on;
} __attribute__((packed));
-static int mwl8k_cmd_802_11_radio_control(struct ieee80211_hw *hw, int enable)
+static int
+mwl8k_cmd_802_11_radio_control(struct ieee80211_hw *hw, bool enable, bool force)
{
struct mwl8k_priv *priv = hw->priv;
struct mwl8k_cmd_802_11_radio_control *cmd;
int rc;
{
struct mwl8k_priv *priv = hw->priv;
struct mwl8k_cmd_802_11_radio_control *cmd;
int rc;
- if (((enable & MWL8K_RADIO_ENABLE) == priv->radio_state) &&
- !(enable & MWL8K_RADIO_FORCE))
+ if (enable == priv->radio_on && !force)
- enable &= MWL8K_RADIO_ENABLE;
-
cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
if (cmd == NULL)
return -ENOMEM;
cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
if (cmd == NULL)
return -ENOMEM;
- priv->radio_state = enable;
+ priv->radio_on = enable;
+static int mwl8k_cmd_802_11_radio_disable(struct ieee80211_hw *hw)
+{
+ return mwl8k_cmd_802_11_radio_control(hw, 0, 0);
+}
+
+static int mwl8k_cmd_802_11_radio_enable(struct ieee80211_hw *hw)
+{
+ return mwl8k_cmd_802_11_radio_control(hw, 1, 0);
+}
+
static int
mwl8k_set_radio_preamble(struct ieee80211_hw *hw, bool short_preamble)
{
static int
mwl8k_set_radio_preamble(struct ieee80211_hw *hw, bool short_preamble)
{
MWL8K_RADIO_SHORT_PREAMBLE :
MWL8K_RADIO_LONG_PREAMBLE);
MWL8K_RADIO_SHORT_PREAMBLE :
MWL8K_RADIO_LONG_PREAMBLE);
- return mwl8k_cmd_802_11_radio_control(hw,
- MWL8K_RADIO_ENABLE | MWL8K_RADIO_FORCE);
+ return mwl8k_cmd_802_11_radio_control(hw, 1, 1);
if (status & MWL8K_A2H_INT_QUEUE_EMPTY) {
if (!priv->inconfig &&
if (status & MWL8K_A2H_INT_QUEUE_EMPTY) {
if (!priv->inconfig &&
mwl8k_txq_busy(priv))
mwl8k_tx_start(priv);
}
mwl8k_txq_busy(priv))
mwl8k_tx_start(priv);
}
spin_lock_irq(&priv->tx_lock);
priv->inconfig = false;
spin_lock_irq(&priv->tx_lock);
priv->inconfig = false;
- if (priv->pending_tx_pkts && priv->radio_state)
+ if (priv->pending_tx_pkts && priv->radio_on)
mwl8k_tx_start(priv);
spin_unlock_irq(&priv->tx_lock);
ieee80211_wake_queues(hw);
mwl8k_tx_start(priv);
spin_unlock_irq(&priv->tx_lock);
ieee80211_wake_queues(hw);
- if (mwl8k_cmd_802_11_radio_control(hw, MWL8K_RADIO_ENABLE)) {
+ if (mwl8k_cmd_802_11_radio_enable(hw)) {
rc = -EIO;
goto mwl8k_start_exit;
}
rc = -EIO;
goto mwl8k_start_exit;
}
{
struct mwl8k_stop_worker *worker = (struct mwl8k_stop_worker *)wt;
struct ieee80211_hw *hw = worker->header.hw;
{
struct mwl8k_stop_worker *worker = (struct mwl8k_stop_worker *)wt;
struct ieee80211_hw *hw = worker->header.hw;
- int rc;
-
- rc = mwl8k_cmd_802_11_radio_control(hw, MWL8K_RADIO_DISABLE);
+ return mwl8k_cmd_802_11_radio_disable(hw);
}
static void mwl8k_stop(struct ieee80211_hw *hw)
}
static void mwl8k_stop(struct ieee80211_hw *hw)
struct mwl8k_priv *priv = hw->priv;
int rc = 0;
struct mwl8k_priv *priv = hw->priv;
int rc = 0;
- if (mwl8k_cmd_802_11_radio_control(hw, MWL8K_RADIO_ENABLE)) {
+ if (mwl8k_cmd_802_11_radio_enable(hw)) {
rc = -EINVAL;
goto mwl8k_config_exit;
}
rc = -EINVAL;
goto mwl8k_config_exit;
}
/* Set default radio state and preamble */
priv->radio_preamble = MWL8K_RADIO_DEFAULT_PREAMBLE;
/* Set default radio state and preamble */
priv->radio_preamble = MWL8K_RADIO_DEFAULT_PREAMBLE;
- priv->radio_state = MWL8K_RADIO_DISABLE;
/* Finalize join worker */
INIT_WORK(&priv->finalize_join_worker, mwl8k_finalize_join_worker);
/* Finalize join worker */
INIT_WORK(&priv->finalize_join_worker, mwl8k_finalize_join_worker);
- rc = mwl8k_cmd_802_11_radio_control(hw, MWL8K_RADIO_DISABLE);
+ rc = mwl8k_cmd_802_11_radio_disable(hw);
if (rc) {
printk(KERN_ERR "%s: Cannot disable\n", priv->name);
goto err_stop_firmware;
if (rc) {
printk(KERN_ERR "%s: Cannot disable\n", priv->name);
goto err_stop_firmware;