]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mwifiex: factor out mwifiex_cancel_scan
authorXinming Hu <huxm@marvell.com>
Thu, 16 Jun 2016 13:22:22 +0000 (18:52 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 29 Jun 2016 15:54:00 +0000 (18:54 +0300)
This patch creates common function mwifiex_cancel_scan to remove
duplication of code.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/marvell/mwifiex/cmdevt.c
drivers/net/wireless/marvell/mwifiex/main.h
drivers/net/wireless/marvell/mwifiex/scan.c

index 6bc2011d8609532c276b234aff9ba60f6360a665..c29f26d8baf2a7d057a7a95f962bc653f9409d20 100644 (file)
@@ -1020,8 +1020,6 @@ mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter)
 {
        struct cmd_ctrl_node *cmd_node = NULL, *tmp_node;
        unsigned long flags, cmd_flags;
-       struct mwifiex_private *priv;
-       int i;
 
        spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags);
        /* Cancel current cmd */
@@ -1046,23 +1044,7 @@ mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter)
        spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, flags);
        spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags);
 
-       mwifiex_cancel_pending_scan_cmd(adapter);
-
-       if (adapter->scan_processing) {
-               spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags);
-               adapter->scan_processing = false;
-               spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags);
-               for (i = 0; i < adapter->priv_num; i++) {
-                       priv = adapter->priv[i];
-                       if (!priv)
-                               continue;
-                       if (priv->scan_request) {
-                               mwifiex_dbg(adapter, WARN, "info: aborting scan\n");
-                               cfg80211_scan_done(priv->scan_request, 1);
-                               priv->scan_request = NULL;
-                       }
-               }
-       }
+       mwifiex_cancel_scan(adapter);
 }
 
 /*
@@ -1080,8 +1062,6 @@ mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter)
 {
        struct cmd_ctrl_node *cmd_node = NULL;
        unsigned long cmd_flags;
-       struct mwifiex_private *priv;
-       int i;
 
        if ((adapter->curr_cmd) &&
            (adapter->curr_cmd->wait_q_enabled)) {
@@ -1101,23 +1081,7 @@ mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter)
                mwifiex_recycle_cmd_node(adapter, cmd_node);
        }
 
-       mwifiex_cancel_pending_scan_cmd(adapter);
-
-       if (adapter->scan_processing) {
-               spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags);
-               adapter->scan_processing = false;
-               spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags);
-               for (i = 0; i < adapter->priv_num; i++) {
-                       priv = adapter->priv[i];
-                       if (!priv)
-                               continue;
-                       if (priv->scan_request) {
-                               mwifiex_dbg(adapter, WARN, "info: aborting scan\n");
-                               cfg80211_scan_done(priv->scan_request, 1);
-                               priv->scan_request = NULL;
-                       }
-               }
-       }
+       mwifiex_cancel_scan(adapter);
 }
 
 /*
index f0cd055c0b2c0da0da29026fcdfad225b0731ead..0d38a72249992d318cfcc43d258bb3a4f825417c 100644 (file)
@@ -1054,6 +1054,7 @@ int mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter);
 void mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter);
 void mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter);
 void mwifiex_cancel_pending_scan_cmd(struct mwifiex_adapter *adapter);
+void mwifiex_cancel_scan(struct mwifiex_adapter *adapter);
 
 void mwifiex_recycle_cmd_node(struct mwifiex_adapter *adapter,
                              struct cmd_ctrl_node *cmd_node);
index bc5e52cebce13ef4c8ec2383f6a24f964197ff68..e33112298fec2ff80b1988c40d116e5de1eb4a76 100644 (file)
@@ -2001,6 +2001,32 @@ static void mwifiex_check_next_scan_command(struct mwifiex_private *priv)
        return;
 }
 
+void mwifiex_cancel_scan(struct mwifiex_adapter *adapter)
+{
+       struct mwifiex_private *priv;
+       unsigned long cmd_flags;
+       int i;
+
+       mwifiex_cancel_pending_scan_cmd(adapter);
+
+       if (adapter->scan_processing) {
+               spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags);
+               adapter->scan_processing = false;
+               spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags);
+               for (i = 0; i < adapter->priv_num; i++) {
+                       priv = adapter->priv[i];
+                       if (!priv)
+                               continue;
+                       if (priv->scan_request) {
+                               mwifiex_dbg(adapter, INFO,
+                                           "info: aborting scan\n");
+                               cfg80211_scan_done(priv->scan_request, 1);
+                               priv->scan_request = NULL;
+                       }
+               }
+       }
+}
+
 /*
  * This function handles the command response of scan.
  *