scan.c (2fe5de9ce7d57498abc14b375cad2fcf8c3ee6cc) scan.c (f6837ba8c98afcf28ec25f6863a8597274aeefd6)
1/*
2 * Scanning implementation
3 *
4 * Copyright 2003, Jouni Malinen <jkmaline@cc.hut.fi>
5 * Copyright 2004, Instant802 Networks, Inc.
6 * Copyright 2005, Devicescape Software, Inc.
7 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
8 * Copyright 2007, Michael Wu <flamingice@sourmilk.net>

--- 295 unchanged lines hidden (view full) ---

304 }
305
306 kfree(local->hw_scan_req);
307 local->hw_scan_req = NULL;
308
309 if (local->scan_req != local->int_scan_req)
310 cfg80211_scan_done(local->scan_req, aborted);
311 local->scan_req = NULL;
1/*
2 * Scanning implementation
3 *
4 * Copyright 2003, Jouni Malinen <jkmaline@cc.hut.fi>
5 * Copyright 2004, Instant802 Networks, Inc.
6 * Copyright 2005, Devicescape Software, Inc.
7 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
8 * Copyright 2007, Michael Wu <flamingice@sourmilk.net>

--- 295 unchanged lines hidden (view full) ---

304 }
305
306 kfree(local->hw_scan_req);
307 local->hw_scan_req = NULL;
308
309 if (local->scan_req != local->int_scan_req)
310 cfg80211_scan_done(local->scan_req, aborted);
311 local->scan_req = NULL;
312 rcu_assign_pointer(local->scan_sdata, NULL);
312 RCU_INIT_POINTER(local->scan_sdata, NULL);
313
314 local->scanning = 0;
315 local->scan_chandef.chan = NULL;
316
317 /* Set power back to normal operating levels. */
318 ieee80211_hw_config(local, 0);
319
320 if (!hw_scan) {

--- 233 unchanged lines hidden (view full) ---

554 if (rc) {
555 kfree(local->hw_scan_req);
556 local->hw_scan_req = NULL;
557 local->scanning = 0;
558
559 ieee80211_recalc_idle(local);
560
561 local->scan_req = NULL;
313
314 local->scanning = 0;
315 local->scan_chandef.chan = NULL;
316
317 /* Set power back to normal operating levels. */
318 ieee80211_hw_config(local, 0);
319
320 if (!hw_scan) {

--- 233 unchanged lines hidden (view full) ---

554 if (rc) {
555 kfree(local->hw_scan_req);
556 local->hw_scan_req = NULL;
557 local->scanning = 0;
558
559 ieee80211_recalc_idle(local);
560
561 local->scan_req = NULL;
562 rcu_assign_pointer(local->scan_sdata, NULL);
562 RCU_INIT_POINTER(local->scan_sdata, NULL);
563 }
564
565 return rc;
566}
567
568static unsigned long
569ieee80211_scan_get_channel_time(struct ieee80211_channel *chan)
570{

--- 197 unchanged lines hidden (view full) ---

768 if (!sdata || !local->scan_req)
769 goto out;
770
771 if (local->scan_req && !local->scanning) {
772 struct cfg80211_scan_request *req = local->scan_req;
773 int rc;
774
775 local->scan_req = NULL;
563 }
564
565 return rc;
566}
567
568static unsigned long
569ieee80211_scan_get_channel_time(struct ieee80211_channel *chan)
570{

--- 197 unchanged lines hidden (view full) ---

768 if (!sdata || !local->scan_req)
769 goto out;
770
771 if (local->scan_req && !local->scanning) {
772 struct cfg80211_scan_request *req = local->scan_req;
773 int rc;
774
775 local->scan_req = NULL;
776 rcu_assign_pointer(local->scan_sdata, NULL);
776 RCU_INIT_POINTER(local->scan_sdata, NULL);
777
778 rc = __ieee80211_start_scan(sdata, req);
779 if (rc) {
780 /* need to complete scan in cfg80211 */
781 local->scan_req = req;
782 aborted = true;
783 goto out_complete;
784 } else

--- 224 unchanged lines hidden (view full) ---

1009 }
1010
1011out_free:
1012 while (i > 0)
1013 kfree(sched_scan_ies.ie[--i]);
1014
1015 if (ret) {
1016 /* Clean in case of failure after HW restart or upon resume. */
777
778 rc = __ieee80211_start_scan(sdata, req);
779 if (rc) {
780 /* need to complete scan in cfg80211 */
781 local->scan_req = req;
782 aborted = true;
783 goto out_complete;
784 } else

--- 224 unchanged lines hidden (view full) ---

1009 }
1010
1011out_free:
1012 while (i > 0)
1013 kfree(sched_scan_ies.ie[--i]);
1014
1015 if (ret) {
1016 /* Clean in case of failure after HW restart or upon resume. */
1017 rcu_assign_pointer(local->sched_scan_sdata, NULL);
1017 RCU_INIT_POINTER(local->sched_scan_sdata, NULL);
1018 local->sched_scan_req = NULL;
1019 }
1020
1021 return ret;
1022}
1023
1024int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
1025 struct cfg80211_sched_scan_request *req)

--- 45 unchanged lines hidden (view full) ---

1071 struct ieee80211_local *local = hw_to_local(hw);
1072
1073 trace_api_sched_scan_results(local);
1074
1075 cfg80211_sched_scan_results(hw->wiphy);
1076}
1077EXPORT_SYMBOL(ieee80211_sched_scan_results);
1078
1018 local->sched_scan_req = NULL;
1019 }
1020
1021 return ret;
1022}
1023
1024int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
1025 struct cfg80211_sched_scan_request *req)

--- 45 unchanged lines hidden (view full) ---

1071 struct ieee80211_local *local = hw_to_local(hw);
1072
1073 trace_api_sched_scan_results(local);
1074
1075 cfg80211_sched_scan_results(hw->wiphy);
1076}
1077EXPORT_SYMBOL(ieee80211_sched_scan_results);
1078
1079void ieee80211_sched_scan_stopped_work(struct work_struct *work)
1079void ieee80211_sched_scan_end(struct ieee80211_local *local)
1080{
1080{
1081 struct ieee80211_local *local =
1082 container_of(work, struct ieee80211_local,
1083 sched_scan_stopped_work);
1084
1085 mutex_lock(&local->mtx);
1086
1087 if (!rcu_access_pointer(local->sched_scan_sdata)) {
1088 mutex_unlock(&local->mtx);
1089 return;
1090 }
1091
1081 mutex_lock(&local->mtx);
1082
1083 if (!rcu_access_pointer(local->sched_scan_sdata)) {
1084 mutex_unlock(&local->mtx);
1085 return;
1086 }
1087
1092 rcu_assign_pointer(local->sched_scan_sdata, NULL);
1088 RCU_INIT_POINTER(local->sched_scan_sdata, NULL);
1093
1094 /* If sched scan was aborted by the driver. */
1095 local->sched_scan_req = NULL;
1096
1097 mutex_unlock(&local->mtx);
1098
1099 cfg80211_sched_scan_stopped(local->hw.wiphy);
1100}
1101
1089
1090 /* If sched scan was aborted by the driver. */
1091 local->sched_scan_req = NULL;
1092
1093 mutex_unlock(&local->mtx);
1094
1095 cfg80211_sched_scan_stopped(local->hw.wiphy);
1096}
1097
1098void ieee80211_sched_scan_stopped_work(struct work_struct *work)
1099{
1100 struct ieee80211_local *local =
1101 container_of(work, struct ieee80211_local,
1102 sched_scan_stopped_work);
1103
1104 ieee80211_sched_scan_end(local);
1105}
1106
1102void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw)
1103{
1104 struct ieee80211_local *local = hw_to_local(hw);
1105
1106 trace_api_sched_scan_stopped(local);
1107
1108 schedule_work(&local->sched_scan_stopped_work);
1109}
1110EXPORT_SYMBOL(ieee80211_sched_scan_stopped);
1107void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw)
1108{
1109 struct ieee80211_local *local = hw_to_local(hw);
1110
1111 trace_api_sched_scan_stopped(local);
1112
1113 schedule_work(&local->sched_scan_stopped_work);
1114}
1115EXPORT_SYMBOL(ieee80211_sched_scan_stopped);