diff options
author | Amitkumar Karwar <akarwar@marvell.com> | 2014-02-27 22:35:15 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2014-02-28 14:33:41 -0500 |
commit | 4af2bd49e6777d39db9bafc868860f0cfdd04652 (patch) | |
tree | 1aba93358be2baa1881d597b63eef6252634aaf6 /drivers/net/wireless/mwifiex/cmdevt.c | |
parent | 828cf2222f05a22e51cdde4fb959d256bf31613b (diff) |
mwifiex: abort scan while cancelling pending command
mwifiex_cancel_pending_ioctl() and
mwifiex_cancel_all_pending_cmd() are called in command timeout
and driver unload paths respectively.
If scan operation is in progress, we should abort it smoothly.
Reported-by: Tim Shepard <shep@alum.mit.edu>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex/cmdevt.c')
-rw-r--r-- | drivers/net/wireless/mwifiex/cmdevt.c | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c index 64e708b79f0e..58cf3a98f1f7 100644 --- a/drivers/net/wireless/mwifiex/cmdevt.c +++ b/drivers/net/wireless/mwifiex/cmdevt.c | |||
@@ -966,7 +966,9 @@ void | |||
966 | mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter) | 966 | mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter) |
967 | { | 967 | { |
968 | struct cmd_ctrl_node *cmd_node = NULL, *tmp_node; | 968 | struct cmd_ctrl_node *cmd_node = NULL, *tmp_node; |
969 | unsigned long flags; | 969 | unsigned long flags, cmd_flags; |
970 | struct mwifiex_private *priv; | ||
971 | int i; | ||
970 | 972 | ||
971 | /* Cancel current cmd */ | 973 | /* Cancel current cmd */ |
972 | if ((adapter->curr_cmd) && (adapter->curr_cmd->wait_q_enabled)) { | 974 | if ((adapter->curr_cmd) && (adapter->curr_cmd->wait_q_enabled)) { |
@@ -1006,9 +1008,21 @@ mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter) | |||
1006 | } | 1008 | } |
1007 | spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags); | 1009 | spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags); |
1008 | 1010 | ||
1009 | spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); | 1011 | if (adapter->scan_processing) { |
1010 | adapter->scan_processing = false; | 1012 | spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags); |
1011 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); | 1013 | adapter->scan_processing = false; |
1014 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); | ||
1015 | for (i = 0; i < adapter->priv_num; i++) { | ||
1016 | priv = adapter->priv[i]; | ||
1017 | if (!priv) | ||
1018 | continue; | ||
1019 | if (priv->scan_request) { | ||
1020 | dev_dbg(adapter->dev, "info: aborting scan\n"); | ||
1021 | cfg80211_scan_done(priv->scan_request, 1); | ||
1022 | priv->scan_request = NULL; | ||
1023 | } | ||
1024 | } | ||
1025 | } | ||
1012 | } | 1026 | } |
1013 | 1027 | ||
1014 | /* | 1028 | /* |
@@ -1027,7 +1041,8 @@ mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter) | |||
1027 | struct cmd_ctrl_node *cmd_node = NULL, *tmp_node = NULL; | 1041 | struct cmd_ctrl_node *cmd_node = NULL, *tmp_node = NULL; |
1028 | unsigned long cmd_flags; | 1042 | unsigned long cmd_flags; |
1029 | unsigned long scan_pending_q_flags; | 1043 | unsigned long scan_pending_q_flags; |
1030 | bool cancel_scan_cmd = false; | 1044 | struct mwifiex_private *priv; |
1045 | int i; | ||
1031 | 1046 | ||
1032 | if ((adapter->curr_cmd) && | 1047 | if ((adapter->curr_cmd) && |
1033 | (adapter->curr_cmd->wait_q_enabled)) { | 1048 | (adapter->curr_cmd->wait_q_enabled)) { |
@@ -1053,15 +1068,24 @@ mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter) | |||
1053 | mwifiex_insert_cmd_to_free_q(adapter, cmd_node); | 1068 | mwifiex_insert_cmd_to_free_q(adapter, cmd_node); |
1054 | spin_lock_irqsave(&adapter->scan_pending_q_lock, | 1069 | spin_lock_irqsave(&adapter->scan_pending_q_lock, |
1055 | scan_pending_q_flags); | 1070 | scan_pending_q_flags); |
1056 | cancel_scan_cmd = true; | ||
1057 | } | 1071 | } |
1058 | spin_unlock_irqrestore(&adapter->scan_pending_q_lock, | 1072 | spin_unlock_irqrestore(&adapter->scan_pending_q_lock, |
1059 | scan_pending_q_flags); | 1073 | scan_pending_q_flags); |
1060 | 1074 | ||
1061 | if (cancel_scan_cmd) { | 1075 | if (adapter->scan_processing) { |
1062 | spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags); | 1076 | spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags); |
1063 | adapter->scan_processing = false; | 1077 | adapter->scan_processing = false; |
1064 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); | 1078 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); |
1079 | for (i = 0; i < adapter->priv_num; i++) { | ||
1080 | priv = adapter->priv[i]; | ||
1081 | if (!priv) | ||
1082 | continue; | ||
1083 | if (priv->scan_request) { | ||
1084 | dev_dbg(adapter->dev, "info: aborting scan\n"); | ||
1085 | cfg80211_scan_done(priv->scan_request, 1); | ||
1086 | priv->scan_request = NULL; | ||
1087 | } | ||
1088 | } | ||
1065 | } | 1089 | } |
1066 | adapter->cmd_wait_q.status = -1; | 1090 | adapter->cmd_wait_q.status = -1; |
1067 | } | 1091 | } |