aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/scan.c
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2010-10-06 05:22:08 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-10-06 16:30:41 -0400
commit259b62e35bf44a97983f275de569929a7d2bd5dd (patch)
treef638b177af19d45b18fbe02c17807ff82daa6b04 /net/mac80211/scan.c
parent78159788e1d0909ffa6beb714dcca7f3aa4574a2 (diff)
mac80211: reduce number of __ieee80211_scan_completed calls
Use goto instruction to call __ieee80211_scan_completed only ones in ieee80211_scan_work. This is prepare for the next patch. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Acked-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/scan.c')
-rw-r--r--net/mac80211/scan.c51
1 files changed, 29 insertions, 22 deletions
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 5171a9581631..830c02bc398a 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -651,27 +651,25 @@ void ieee80211_scan_work(struct work_struct *work)
651 container_of(work, struct ieee80211_local, scan_work.work); 651 container_of(work, struct ieee80211_local, scan_work.work);
652 struct ieee80211_sub_if_data *sdata = local->scan_sdata; 652 struct ieee80211_sub_if_data *sdata = local->scan_sdata;
653 unsigned long next_delay = 0; 653 unsigned long next_delay = 0;
654 bool aborted;
654 655
655 if (test_and_clear_bit(SCAN_COMPLETED, &local->scanning)) { 656 mutex_lock(&local->mtx);
656 bool aborted;
657 657
658 if (test_and_clear_bit(SCAN_COMPLETED, &local->scanning)) {
658 aborted = test_and_clear_bit(SCAN_ABORTED, &local->scanning); 659 aborted = test_and_clear_bit(SCAN_ABORTED, &local->scanning);
659 __ieee80211_scan_completed(&local->hw, aborted); 660 goto out_complete;
660 return;
661 } 661 }
662 662
663 mutex_lock(&local->mtx); 663 if (!sdata || !local->scan_req)
664 if (!sdata || !local->scan_req) { 664 goto out;
665 mutex_unlock(&local->mtx);
666 return;
667 }
668 665
669 if (local->hw_scan_req) { 666 if (local->hw_scan_req) {
670 int rc = drv_hw_scan(local, sdata, local->hw_scan_req); 667 int rc = drv_hw_scan(local, sdata, local->hw_scan_req);
671 mutex_unlock(&local->mtx); 668 if (rc) {
672 if (rc) 669 aborted = true;
673 __ieee80211_scan_completed(&local->hw, true); 670 goto out_complete;
674 return; 671 } else
672 goto out;
675 } 673 }
676 674
677 if (local->scan_req && !local->scanning) { 675 if (local->scan_req && !local->scanning) {
@@ -682,23 +680,23 @@ void ieee80211_scan_work(struct work_struct *work)
682 local->scan_sdata = NULL; 680 local->scan_sdata = NULL;
683 681
684 rc = __ieee80211_start_scan(sdata, req); 682 rc = __ieee80211_start_scan(sdata, req);
685 mutex_unlock(&local->mtx); 683 if (rc) {
686 684 aborted = true;
687 if (rc) 685 goto out_complete;
688 __ieee80211_scan_completed(&local->hw, true); 686 } else
689 return; 687 goto out;
690 } 688 }
691 689
692 mutex_unlock(&local->mtx);
693
694 /* 690 /*
695 * Avoid re-scheduling when the sdata is going away. 691 * Avoid re-scheduling when the sdata is going away.
696 */ 692 */
697 if (!ieee80211_sdata_running(sdata)) { 693 if (!ieee80211_sdata_running(sdata)) {
698 __ieee80211_scan_completed(&local->hw, true); 694 aborted = true;
699 return; 695 goto out_complete;
700 } 696 }
701 697
698 mutex_unlock(&local->mtx);
699
702 /* 700 /*
703 * as long as no delay is required advance immediately 701 * as long as no delay is required advance immediately
704 * without scheduling a new work 702 * without scheduling a new work
@@ -725,6 +723,15 @@ void ieee80211_scan_work(struct work_struct *work)
725 } while (next_delay == 0); 723 } while (next_delay == 0);
726 724
727 ieee80211_queue_delayed_work(&local->hw, &local->scan_work, next_delay); 725 ieee80211_queue_delayed_work(&local->hw, &local->scan_work, next_delay);
726 return;
727
728out_complete:
729 mutex_unlock(&local->mtx);
730 __ieee80211_scan_completed(&local->hw, aborted);
731 return;
732
733out:
734 mutex_unlock(&local->mtx);
728} 735}
729 736
730int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata, 737int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,