aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/scan.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-01-31 19:34:36 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-02-04 12:57:46 -0500
commit0532d4f154b87da6361ab90d12f35142d5119dc1 (patch)
tree839e9ba5ab322e5d863b526f547614b297da9e52 /net/wireless/scan.c
parent9537f227b44762591a5598b79522789c573d34b3 (diff)
cfg80211: wrap BSS kref
Add inline wrappers for the BSS struct krefs to be able to extend them easily later. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/scan.c')
-rw-r--r--net/wireless/scan.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 23b7e59c6506..36daacb31788 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -41,6 +41,16 @@ static void bss_release(struct kref *ref)
41 kfree(bss); 41 kfree(bss);
42} 42}
43 43
44static inline void bss_ref_get(struct cfg80211_internal_bss *bss)
45{
46 kref_get(&bss->ref);
47}
48
49static inline void bss_ref_put(struct cfg80211_internal_bss *bss)
50{
51 kref_put(&bss->ref, bss_release);
52}
53
44static void __cfg80211_unlink_bss(struct cfg80211_registered_device *dev, 54static void __cfg80211_unlink_bss(struct cfg80211_registered_device *dev,
45 struct cfg80211_internal_bss *bss) 55 struct cfg80211_internal_bss *bss)
46{ 56{
@@ -48,7 +58,7 @@ static void __cfg80211_unlink_bss(struct cfg80211_registered_device *dev,
48 58
49 list_del_init(&bss->list); 59 list_del_init(&bss->list);
50 rb_erase(&bss->rbn, &dev->bss_tree); 60 rb_erase(&bss->rbn, &dev->bss_tree);
51 kref_put(&bss->ref, bss_release); 61 bss_ref_put(bss);
52} 62}
53 63
54static void __cfg80211_bss_expire(struct cfg80211_registered_device *dev, 64static void __cfg80211_bss_expire(struct cfg80211_registered_device *dev,
@@ -456,7 +466,7 @@ struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
456 continue; 466 continue;
457 if (is_bss(&bss->pub, bssid, ssid, ssid_len)) { 467 if (is_bss(&bss->pub, bssid, ssid, ssid_len)) {
458 res = bss; 468 res = bss;
459 kref_get(&res->ref); 469 bss_ref_get(res);
460 break; 470 break;
461 } 471 }
462 } 472 }
@@ -649,7 +659,7 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
649 dev->bss_generation++; 659 dev->bss_generation++;
650 spin_unlock_bh(&dev->bss_lock); 660 spin_unlock_bh(&dev->bss_lock);
651 661
652 kref_get(&found->ref); 662 bss_ref_get(found);
653 return found; 663 return found;
654} 664}
655 665
@@ -816,7 +826,7 @@ void cfg80211_ref_bss(struct cfg80211_bss *pub)
816 return; 826 return;
817 827
818 bss = container_of(pub, struct cfg80211_internal_bss, pub); 828 bss = container_of(pub, struct cfg80211_internal_bss, pub);
819 kref_get(&bss->ref); 829 bss_ref_get(bss);
820} 830}
821EXPORT_SYMBOL(cfg80211_ref_bss); 831EXPORT_SYMBOL(cfg80211_ref_bss);
822 832
@@ -828,7 +838,7 @@ void cfg80211_put_bss(struct cfg80211_bss *pub)
828 return; 838 return;
829 839
830 bss = container_of(pub, struct cfg80211_internal_bss, pub); 840 bss = container_of(pub, struct cfg80211_internal_bss, pub);
831 kref_put(&bss->ref, bss_release); 841 bss_ref_put(bss);
832} 842}
833EXPORT_SYMBOL(cfg80211_put_bss); 843EXPORT_SYMBOL(cfg80211_put_bss);
834 844