Skip to content

Commit

Permalink
cfg80211: wrap BSS kref
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johannes Berg committed Feb 4, 2013
1 parent 9537f22 commit 0532d4f
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions net/wireless/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,24 @@ static void bss_release(struct kref *ref)
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,
struct cfg80211_internal_bss *bss)
{
lockdep_assert_held(&dev->bss_lock);

list_del_init(&bss->list);
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,
Expand Down Expand Up @@ -456,7 +466,7 @@ struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
continue;
if (is_bss(&bss->pub, bssid, ssid, ssid_len)) {
res = bss;
kref_get(&res->ref);
bss_ref_get(res);
break;
}
}
Expand Down Expand Up @@ -649,7 +659,7 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
dev->bss_generation++;
spin_unlock_bh(&dev->bss_lock);

kref_get(&found->ref);
bss_ref_get(found);
return found;
}

Expand Down Expand Up @@ -816,7 +826,7 @@ void cfg80211_ref_bss(struct cfg80211_bss *pub)
return;

bss = container_of(pub, struct cfg80211_internal_bss, pub);
kref_get(&bss->ref);
bss_ref_get(bss);
}
EXPORT_SYMBOL(cfg80211_ref_bss);

Expand All @@ -828,7 +838,7 @@ void cfg80211_put_bss(struct cfg80211_bss *pub)
return;

bss = container_of(pub, struct cfg80211_internal_bss, pub);
kref_put(&bss->ref, bss_release);
bss_ref_put(bss);
}
EXPORT_SYMBOL(cfg80211_put_bss);

Expand Down

0 comments on commit 0532d4f

Please sign in to comment.