mwifiex: add support for Marvell sd8797 device
[deliverable/linux.git] / drivers / net / wireless / mwifiex / sta_ioctl.c
index a9dfeb1b4ace591c6f13545edc34e2c21f1f409f..4b6f5539657d6cd250c07939cda005c02e66fba0 100644 (file)
@@ -55,7 +55,9 @@ int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter)
 {
        bool cancel_flag = false;
        int status = adapter->cmd_wait_q.status;
+       struct cmd_ctrl_node *cmd_queued = adapter->cmd_queued;
 
+       adapter->cmd_queued = NULL;
        dev_dbg(adapter->dev, "cmd pending\n");
        atomic_inc(&adapter->cmd_pending);
 
@@ -64,8 +66,8 @@ int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter)
 
        /* Wait for completion */
        wait_event_interruptible(adapter->cmd_wait_q.wait,
-                                       adapter->cmd_wait_q.condition);
-       if (!adapter->cmd_wait_q.condition)
+                                       *(cmd_queued->condition));
+       if (!*(cmd_queued->condition))
                cancel_flag = true;
 
        if (cancel_flag) {
@@ -291,8 +293,8 @@ done:
  * This function prepares the correct firmware command and
  * issues it.
  */
-int mwifiex_set_hs_params(struct mwifiex_private *priv, u16 action,
-                         int cmd_type, struct mwifiex_ds_hs_cfg *hs_cfg)
+static int mwifiex_set_hs_params(struct mwifiex_private *priv, u16 action,
+                                int cmd_type, struct mwifiex_ds_hs_cfg *hs_cfg)
 
 {
        struct mwifiex_adapter *adapter = priv->adapter;
@@ -720,51 +722,9 @@ done:
 static int mwifiex_rate_ioctl_get_rate_value(struct mwifiex_private *priv,
                                             struct mwifiex_rate_cfg *rate_cfg)
 {
-       struct mwifiex_adapter *adapter = priv->adapter;
-
        rate_cfg->is_rate_auto = priv->is_data_rate_auto;
-       if (!priv->media_connected) {
-               switch (adapter->config_bands) {
-               case BAND_B:
-                       /* Return the lowest supported rate for B band */
-                       rate_cfg->rate = supported_rates_b[0] & 0x7f;
-                       break;
-               case BAND_G:
-               case BAND_G | BAND_GN:
-                       /* Return the lowest supported rate for G band */
-                       rate_cfg->rate = supported_rates_g[0] & 0x7f;
-                       break;
-               case BAND_B | BAND_G:
-               case BAND_A | BAND_B | BAND_G:
-               case BAND_A | BAND_B:
-               case BAND_A | BAND_B | BAND_G | BAND_AN | BAND_GN:
-               case BAND_B | BAND_G | BAND_GN:
-                       /* Return the lowest supported rate for BG band */
-                       rate_cfg->rate = supported_rates_bg[0] & 0x7f;
-                       break;
-               case BAND_A:
-               case BAND_A | BAND_G:
-               case BAND_A | BAND_G | BAND_AN | BAND_GN:
-               case BAND_A | BAND_AN:
-                       /* Return the lowest supported rate for A band */
-                       rate_cfg->rate = supported_rates_a[0] & 0x7f;
-                       break;
-               case BAND_GN:
-                       /* Return the lowest supported rate for N band */
-                       rate_cfg->rate = supported_rates_n[0] & 0x7f;
-                       break;
-               default:
-                       dev_warn(adapter->dev, "invalid band %#x\n",
-                              adapter->config_bands);
-                       break;
-               }
-       } else {
-               return mwifiex_send_cmd_sync(priv,
-                                           HostCmd_CMD_802_11_TX_RATE_QUERY,
-                                           HostCmd_ACT_GEN_GET, 0, NULL);
-       }
-
-       return 0;
+       return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_TX_RATE_QUERY,
+                                    HostCmd_ACT_GEN_GET, 0, NULL);
 }
 
 /*
@@ -805,7 +765,7 @@ static int mwifiex_rate_ioctl_set_rate_value(struct mwifiex_private *priv,
                        if ((rate[i] & 0x7f) == (rate_cfg->rate & 0x7f))
                                break;
                }
-               if (!rate[i] || (i == MWIFIEX_SUPPORTED_RATES)) {
+               if ((i == MWIFIEX_SUPPORTED_RATES) || !rate[i]) {
                        dev_err(adapter->dev, "fixed data rate %#x is out "
                               "of range\n", rate_cfg->rate);
                        return -1;
@@ -872,8 +832,8 @@ int mwifiex_drv_get_data_rate(struct mwifiex_private *priv,
 
        if (!ret) {
                if (rate->is_rate_auto)
-                       rate->rate = mwifiex_index_to_data_rate(priv->tx_rate,
-                                                       priv->tx_htinfo);
+                       rate->rate = mwifiex_index_to_data_rate(priv,
+                                       priv->tx_rate, priv->tx_htinfo);
                else
                        rate->rate = priv->data_rate;
        } else {
This page took 0.032663 seconds and 5 git commands to generate.