Commit 0532d4f1 authored by Johannes Berg's avatar Johannes Berg

cfg80211: wrap BSS kref

Add inline wrappers for the BSS struct krefs
to be able to extend them easily later.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 9537f227
...@@ -41,6 +41,16 @@ static void bss_release(struct kref *ref) ...@@ -41,6 +41,16 @@ static void bss_release(struct kref *ref)
kfree(bss); kfree(bss);
} }
static inline void bss_ref_get(struct cfg80211_internal_bss *bss)
{
kref_get(&bss->ref);
}
static inline void bss_ref_put(struct cfg80211_internal_bss *bss)
{
kref_put(&bss->ref, bss_release);
}
static void __cfg80211_unlink_bss(struct cfg80211_registered_device *dev, static void __cfg80211_unlink_bss(struct cfg80211_registered_device *dev,
struct cfg80211_internal_bss *bss) struct cfg80211_internal_bss *bss)
{ {
...@@ -48,7 +58,7 @@ static void __cfg80211_unlink_bss(struct cfg80211_registered_device *dev, ...@@ -48,7 +58,7 @@ static void __cfg80211_unlink_bss(struct cfg80211_registered_device *dev,
list_del_init(&bss->list); list_del_init(&bss->list);
rb_erase(&bss->rbn, &dev->bss_tree); rb_erase(&bss->rbn, &dev->bss_tree);
kref_put(&bss->ref, bss_release); bss_ref_put(bss);
} }
static void __cfg80211_bss_expire(struct cfg80211_registered_device *dev, static void __cfg80211_bss_expire(struct cfg80211_registered_device *dev,
...@@ -456,7 +466,7 @@ struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, ...@@ -456,7 +466,7 @@ struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
continue; continue;
if (is_bss(&bss->pub, bssid, ssid, ssid_len)) { if (is_bss(&bss->pub, bssid, ssid, ssid_len)) {
res = bss; res = bss;
kref_get(&res->ref); bss_ref_get(res);
break; break;
} }
} }
...@@ -649,7 +659,7 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, ...@@ -649,7 +659,7 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
dev->bss_generation++; dev->bss_generation++;
spin_unlock_bh(&dev->bss_lock); spin_unlock_bh(&dev->bss_lock);
kref_get(&found->ref); bss_ref_get(found);
return found; return found;
} }
...@@ -816,7 +826,7 @@ void cfg80211_ref_bss(struct cfg80211_bss *pub) ...@@ -816,7 +826,7 @@ void cfg80211_ref_bss(struct cfg80211_bss *pub)
return; return;
bss = container_of(pub, struct cfg80211_internal_bss, pub); bss = container_of(pub, struct cfg80211_internal_bss, pub);
kref_get(&bss->ref); bss_ref_get(bss);
} }
EXPORT_SYMBOL(cfg80211_ref_bss); EXPORT_SYMBOL(cfg80211_ref_bss);
...@@ -828,7 +838,7 @@ void cfg80211_put_bss(struct cfg80211_bss *pub) ...@@ -828,7 +838,7 @@ void cfg80211_put_bss(struct cfg80211_bss *pub)
return; return;
bss = container_of(pub, struct cfg80211_internal_bss, pub); bss = container_of(pub, struct cfg80211_internal_bss, pub);
kref_put(&bss->ref, bss_release); bss_ref_put(bss);
} }
EXPORT_SYMBOL(cfg80211_put_bss); EXPORT_SYMBOL(cfg80211_put_bss);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment