cfg80211: move locking into cfg80211_bss_age
authorJohannes Berg <johannes.berg@intel.com>
Fri, 1 Feb 2013 00:04:14 +0000 (01:04 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 4 Feb 2013 17:57:43 +0000 (18:57 +0100)
There's no reason for it to require external
locking, move it into the function.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/scan.c
net/wireless/sysfs.c

index 34b47b30be88b13f101929e55a00f8edbac58406..1494d947e8ddf98d1eaf7a27ba3a28845f5e8d62 100644 (file)
@@ -231,15 +231,16 @@ int __cfg80211_stop_sched_scan(struct cfg80211_registered_device *rdev,
        return 0;
 }
 
-/* must hold dev->bss_lock! */
 void cfg80211_bss_age(struct cfg80211_registered_device *dev,
                       unsigned long age_secs)
 {
        struct cfg80211_internal_bss *bss;
        unsigned long age_jiffies = msecs_to_jiffies(age_secs * MSEC_PER_SEC);
 
+       spin_lock_bh(&dev->bss_lock);
        list_for_each_entry(bss, &dev->bss_list, list)
                bss->ts -= age_jiffies;
+       spin_unlock_bh(&dev->bss_lock);
 }
 
 void cfg80211_bss_expire(struct cfg80211_registered_device *dev)
index 9bf6d5e32166c47f315c0c8819a84128b857bc1c..73bf39f113146ca160f0f6b67d539001f4c3067b 100644 (file)
@@ -108,9 +108,7 @@ static int wiphy_resume(struct device *dev)
        int ret = 0;
 
        /* Age scan results with time spent in suspend */
-       spin_lock_bh(&rdev->bss_lock);
        cfg80211_bss_age(rdev, get_seconds() - rdev->suspend_at);
-       spin_unlock_bh(&rdev->bss_lock);
 
        if (rdev->ops->resume) {
                rtnl_lock();