iwl_mvm_ebs_status_str(scan_notif->ebs_status));
  
                mvm->scan_status &= ~IWL_MVM_SCAN_REGULAR;
 -              ieee80211_scan_completed(mvm->hw,
 -                              scan_notif->status == IWL_SCAN_OFFLOAD_ABORTED);
 +              ieee80211_scan_completed(mvm->hw, &info);
                iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN);
-               del_timer(&mvm->scan_timer);
+               cancel_delayed_work(&mvm->scan_timeout_dwork);
        } else {
                IWL_ERR(mvm,
                        "got scan complete notification but no scan is running\n");
  
        /* if the scan is already stopping, we don't need to notify mac80211 */
        if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_REGULAR) {
 -              ieee80211_scan_completed(mvm->hw, aborted);
 +              struct cfg80211_scan_info info = {
 +                      .aborted = aborted,
 +              };
 +
 +              ieee80211_scan_completed(mvm->hw, &info);
                iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN);
-               del_timer(&mvm->scan_timer);
+               cancel_delayed_work(&mvm->scan_timeout_dwork);
        } else if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_SCHED) {
                ieee80211_sched_scan_stopped(mvm->hw);
                mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED;
                 * to release the scan reference here.
                 */
                iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN);
-               del_timer(&mvm->scan_timer);
+               cancel_delayed_work(&mvm->scan_timeout_dwork);
 -              if (notify)
 -                      ieee80211_scan_completed(mvm->hw, true);
 +              if (notify) {
 +                      struct cfg80211_scan_info info = {
 +                              .aborted = true,
 +                      };
 +
 +                      ieee80211_scan_completed(mvm->hw, &info);
 +              }
        } else if (notify) {
                ieee80211_sched_scan_stopped(mvm->hw);
                mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED;
 
                        mwifiex_complete_scan(priv);
  
                if (priv->scan_request) {
 +                      struct cfg80211_scan_info info = {
 +                              .aborted = false,
 +                      };
 +
                        mwifiex_dbg(adapter, INFO,
                                    "info: notifying scan done\n");
 -                      cfg80211_scan_done(priv->scan_request, 0);
 +                      cfg80211_scan_done(priv->scan_request, &info);
                        priv->scan_request = NULL;
+                       priv->scan_aborting = false;
                } else {
                        priv->scan_aborting = false;
                        mwifiex_dbg(adapter, INFO,
  
                if (!adapter->active_scan_triggered) {
                        if (priv->scan_request) {
 +                              struct cfg80211_scan_info info = {
 +                                      .aborted = true,
 +                              };
 +
                                mwifiex_dbg(adapter, INFO,
                                            "info: aborting scan\n");
 -                              cfg80211_scan_done(priv->scan_request, 1);
 +                              cfg80211_scan_done(priv->scan_request, &info);
                                priv->scan_request = NULL;
+                               priv->scan_aborting = false;
                        } else {
                                priv->scan_aborting = false;
                                mwifiex_dbg(adapter, INFO,
        return;
  }
  
 -                              cfg80211_scan_done(priv->scan_request, 1);
+ 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) {
++                              struct cfg80211_scan_info info = {
++                                      .aborted = true,
++                              };
++
+                               mwifiex_dbg(adapter, INFO,
+                                           "info: aborting scan\n");
++                              cfg80211_scan_done(priv->scan_request, &info);
+                               priv->scan_request = NULL;
+                               priv->scan_aborting = false;
+                       }
+               }
+       }
+ }
+ 
  /*
   * This function handles the command response of scan.
   *