提交 1b8ec87a 编写于 作者: Z Zhao, Gang 提交者: Johannes Berg

cfg80211: change registered device pointer name

Name "dev" is too common and ambiguous, let all the pointer name
pointing to struct cfg80211_registered_device be "rdev". This can
improve code readability and consistency(since other places have
already called it rdev).
Signed-off-by: NZhao, Gang <gamerh2o@gmail.com>
Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
上级 308f7fcf
...@@ -251,8 +251,8 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev, ...@@ -251,8 +251,8 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev,
void ieee80211_set_bitrate_flags(struct wiphy *wiphy); void ieee80211_set_bitrate_flags(struct wiphy *wiphy);
void cfg80211_bss_expire(struct cfg80211_registered_device *dev); void cfg80211_bss_expire(struct cfg80211_registered_device *rdev);
void cfg80211_bss_age(struct cfg80211_registered_device *dev, void cfg80211_bss_age(struct cfg80211_registered_device *rdev,
unsigned long age_secs); unsigned long age_secs);
/* IBSS */ /* IBSS */
......
此差异已折叠。
...@@ -81,10 +81,10 @@ static void bss_free(struct cfg80211_internal_bss *bss) ...@@ -81,10 +81,10 @@ static void bss_free(struct cfg80211_internal_bss *bss)
kfree(bss); kfree(bss);
} }
static inline void bss_ref_get(struct cfg80211_registered_device *dev, static inline void bss_ref_get(struct cfg80211_registered_device *rdev,
struct cfg80211_internal_bss *bss) struct cfg80211_internal_bss *bss)
{ {
lockdep_assert_held(&dev->bss_lock); lockdep_assert_held(&rdev->bss_lock);
bss->refcount++; bss->refcount++;
if (bss->pub.hidden_beacon_bss) { if (bss->pub.hidden_beacon_bss) {
...@@ -95,10 +95,10 @@ static inline void bss_ref_get(struct cfg80211_registered_device *dev, ...@@ -95,10 +95,10 @@ static inline void bss_ref_get(struct cfg80211_registered_device *dev,
} }
} }
static inline void bss_ref_put(struct cfg80211_registered_device *dev, static inline void bss_ref_put(struct cfg80211_registered_device *rdev,
struct cfg80211_internal_bss *bss) struct cfg80211_internal_bss *bss)
{ {
lockdep_assert_held(&dev->bss_lock); lockdep_assert_held(&rdev->bss_lock);
if (bss->pub.hidden_beacon_bss) { if (bss->pub.hidden_beacon_bss) {
struct cfg80211_internal_bss *hbss; struct cfg80211_internal_bss *hbss;
...@@ -114,10 +114,10 @@ static inline void bss_ref_put(struct cfg80211_registered_device *dev, ...@@ -114,10 +114,10 @@ static inline void bss_ref_put(struct cfg80211_registered_device *dev,
bss_free(bss); bss_free(bss);
} }
static bool __cfg80211_unlink_bss(struct cfg80211_registered_device *dev, static bool __cfg80211_unlink_bss(struct cfg80211_registered_device *rdev,
struct cfg80211_internal_bss *bss) struct cfg80211_internal_bss *bss)
{ {
lockdep_assert_held(&dev->bss_lock); lockdep_assert_held(&rdev->bss_lock);
if (!list_empty(&bss->hidden_list)) { if (!list_empty(&bss->hidden_list)) {
/* /*
...@@ -134,31 +134,31 @@ static bool __cfg80211_unlink_bss(struct cfg80211_registered_device *dev, ...@@ -134,31 +134,31 @@ static bool __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, &rdev->bss_tree);
bss_ref_put(dev, bss); bss_ref_put(rdev, bss);
return true; return true;
} }
static void __cfg80211_bss_expire(struct cfg80211_registered_device *dev, static void __cfg80211_bss_expire(struct cfg80211_registered_device *rdev,
unsigned long expire_time) unsigned long expire_time)
{ {
struct cfg80211_internal_bss *bss, *tmp; struct cfg80211_internal_bss *bss, *tmp;
bool expired = false; bool expired = false;
lockdep_assert_held(&dev->bss_lock); lockdep_assert_held(&rdev->bss_lock);
list_for_each_entry_safe(bss, tmp, &dev->bss_list, list) { list_for_each_entry_safe(bss, tmp, &rdev->bss_list, list) {
if (atomic_read(&bss->hold)) if (atomic_read(&bss->hold))
continue; continue;
if (!time_after(expire_time, bss->ts)) if (!time_after(expire_time, bss->ts))
continue; continue;
if (__cfg80211_unlink_bss(dev, bss)) if (__cfg80211_unlink_bss(rdev, bss))
expired = true; expired = true;
} }
if (expired) if (expired)
dev->bss_generation++; rdev->bss_generation++;
} }
void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev,
...@@ -322,21 +322,21 @@ int __cfg80211_stop_sched_scan(struct cfg80211_registered_device *rdev, ...@@ -322,21 +322,21 @@ int __cfg80211_stop_sched_scan(struct cfg80211_registered_device *rdev,
return 0; return 0;
} }
void cfg80211_bss_age(struct cfg80211_registered_device *dev, void cfg80211_bss_age(struct cfg80211_registered_device *rdev,
unsigned long age_secs) unsigned long age_secs)
{ {
struct cfg80211_internal_bss *bss; struct cfg80211_internal_bss *bss;
unsigned long age_jiffies = msecs_to_jiffies(age_secs * MSEC_PER_SEC); unsigned long age_jiffies = msecs_to_jiffies(age_secs * MSEC_PER_SEC);
spin_lock_bh(&dev->bss_lock); spin_lock_bh(&rdev->bss_lock);
list_for_each_entry(bss, &dev->bss_list, list) list_for_each_entry(bss, &rdev->bss_list, list)
bss->ts -= age_jiffies; bss->ts -= age_jiffies;
spin_unlock_bh(&dev->bss_lock); spin_unlock_bh(&rdev->bss_lock);
} }
void cfg80211_bss_expire(struct cfg80211_registered_device *dev) void cfg80211_bss_expire(struct cfg80211_registered_device *rdev)
{ {
__cfg80211_bss_expire(dev, jiffies - IEEE80211_SCAN_RESULT_EXPIRE); __cfg80211_bss_expire(rdev, jiffies - IEEE80211_SCAN_RESULT_EXPIRE);
} }
const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len) const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
...@@ -526,16 +526,16 @@ struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, ...@@ -526,16 +526,16 @@ struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
const u8 *ssid, size_t ssid_len, const u8 *ssid, size_t ssid_len,
u16 capa_mask, u16 capa_val) u16 capa_mask, u16 capa_val)
{ {
struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy); struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
struct cfg80211_internal_bss *bss, *res = NULL; struct cfg80211_internal_bss *bss, *res = NULL;
unsigned long now = jiffies; unsigned long now = jiffies;
trace_cfg80211_get_bss(wiphy, channel, bssid, ssid, ssid_len, capa_mask, trace_cfg80211_get_bss(wiphy, channel, bssid, ssid, ssid_len, capa_mask,
capa_val); capa_val);
spin_lock_bh(&dev->bss_lock); spin_lock_bh(&rdev->bss_lock);
list_for_each_entry(bss, &dev->bss_list, list) { list_for_each_entry(bss, &rdev->bss_list, list) {
if ((bss->pub.capability & capa_mask) != capa_val) if ((bss->pub.capability & capa_mask) != capa_val)
continue; continue;
if (channel && bss->pub.channel != channel) if (channel && bss->pub.channel != channel)
...@@ -548,12 +548,12 @@ struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, ...@@ -548,12 +548,12 @@ 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;
bss_ref_get(dev, res); bss_ref_get(rdev, res);
break; break;
} }
} }
spin_unlock_bh(&dev->bss_lock); spin_unlock_bh(&rdev->bss_lock);
if (!res) if (!res)
return NULL; return NULL;
trace_cfg80211_return_bss(&res->pub); trace_cfg80211_return_bss(&res->pub);
...@@ -561,10 +561,10 @@ struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, ...@@ -561,10 +561,10 @@ struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
} }
EXPORT_SYMBOL(cfg80211_get_bss); EXPORT_SYMBOL(cfg80211_get_bss);
static void rb_insert_bss(struct cfg80211_registered_device *dev, static void rb_insert_bss(struct cfg80211_registered_device *rdev,
struct cfg80211_internal_bss *bss) struct cfg80211_internal_bss *bss)
{ {
struct rb_node **p = &dev->bss_tree.rb_node; struct rb_node **p = &rdev->bss_tree.rb_node;
struct rb_node *parent = NULL; struct rb_node *parent = NULL;
struct cfg80211_internal_bss *tbss; struct cfg80211_internal_bss *tbss;
int cmp; int cmp;
...@@ -587,15 +587,15 @@ static void rb_insert_bss(struct cfg80211_registered_device *dev, ...@@ -587,15 +587,15 @@ static void rb_insert_bss(struct cfg80211_registered_device *dev,
} }
rb_link_node(&bss->rbn, parent, p); rb_link_node(&bss->rbn, parent, p);
rb_insert_color(&bss->rbn, &dev->bss_tree); rb_insert_color(&bss->rbn, &rdev->bss_tree);
} }
static struct cfg80211_internal_bss * static struct cfg80211_internal_bss *
rb_find_bss(struct cfg80211_registered_device *dev, rb_find_bss(struct cfg80211_registered_device *rdev,
struct cfg80211_internal_bss *res, struct cfg80211_internal_bss *res,
enum bss_compare_mode mode) enum bss_compare_mode mode)
{ {
struct rb_node *n = dev->bss_tree.rb_node; struct rb_node *n = rdev->bss_tree.rb_node;
struct cfg80211_internal_bss *bss; struct cfg80211_internal_bss *bss;
int r; int r;
...@@ -614,7 +614,7 @@ rb_find_bss(struct cfg80211_registered_device *dev, ...@@ -614,7 +614,7 @@ rb_find_bss(struct cfg80211_registered_device *dev,
return NULL; return NULL;
} }
static bool cfg80211_combine_bsses(struct cfg80211_registered_device *dev, static bool cfg80211_combine_bsses(struct cfg80211_registered_device *rdev,
struct cfg80211_internal_bss *new) struct cfg80211_internal_bss *new)
{ {
const struct cfg80211_bss_ies *ies; const struct cfg80211_bss_ies *ies;
...@@ -644,7 +644,7 @@ static bool cfg80211_combine_bsses(struct cfg80211_registered_device *dev, ...@@ -644,7 +644,7 @@ static bool cfg80211_combine_bsses(struct cfg80211_registered_device *dev,
/* This is the bad part ... */ /* This is the bad part ... */
list_for_each_entry(bss, &dev->bss_list, list) { list_for_each_entry(bss, &rdev->bss_list, list) {
if (!ether_addr_equal(bss->pub.bssid, new->pub.bssid)) if (!ether_addr_equal(bss->pub.bssid, new->pub.bssid))
continue; continue;
if (bss->pub.channel != new->pub.channel) if (bss->pub.channel != new->pub.channel)
...@@ -678,7 +678,7 @@ static bool cfg80211_combine_bsses(struct cfg80211_registered_device *dev, ...@@ -678,7 +678,7 @@ static bool cfg80211_combine_bsses(struct cfg80211_registered_device *dev,
/* Returned bss is reference counted and must be cleaned up appropriately. */ /* Returned bss is reference counted and must be cleaned up appropriately. */
static struct cfg80211_internal_bss * static struct cfg80211_internal_bss *
cfg80211_bss_update(struct cfg80211_registered_device *dev, cfg80211_bss_update(struct cfg80211_registered_device *rdev,
struct cfg80211_internal_bss *tmp, struct cfg80211_internal_bss *tmp,
bool signal_valid) bool signal_valid)
{ {
...@@ -689,14 +689,14 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, ...@@ -689,14 +689,14 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
tmp->ts = jiffies; tmp->ts = jiffies;
spin_lock_bh(&dev->bss_lock); spin_lock_bh(&rdev->bss_lock);
if (WARN_ON(!rcu_access_pointer(tmp->pub.ies))) { if (WARN_ON(!rcu_access_pointer(tmp->pub.ies))) {
spin_unlock_bh(&dev->bss_lock); spin_unlock_bh(&rdev->bss_lock);
return NULL; return NULL;
} }
found = rb_find_bss(dev, tmp, BSS_CMP_REGULAR); found = rb_find_bss(rdev, tmp, BSS_CMP_REGULAR);
if (found) { if (found) {
/* Update IEs */ /* Update IEs */
...@@ -783,7 +783,7 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, ...@@ -783,7 +783,7 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
* is allocated on the stack since it's not needed in the * is allocated on the stack since it's not needed in the
* more common case of an update * more common case of an update
*/ */
new = kzalloc(sizeof(*new) + dev->wiphy.bss_priv_size, new = kzalloc(sizeof(*new) + rdev->wiphy.bss_priv_size,
GFP_ATOMIC); GFP_ATOMIC);
if (!new) { if (!new) {
ies = (void *)rcu_dereference(tmp->pub.beacon_ies); ies = (void *)rcu_dereference(tmp->pub.beacon_ies);
...@@ -799,9 +799,9 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, ...@@ -799,9 +799,9 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
INIT_LIST_HEAD(&new->hidden_list); INIT_LIST_HEAD(&new->hidden_list);
if (rcu_access_pointer(tmp->pub.proberesp_ies)) { if (rcu_access_pointer(tmp->pub.proberesp_ies)) {
hidden = rb_find_bss(dev, tmp, BSS_CMP_HIDE_ZLEN); hidden = rb_find_bss(rdev, tmp, BSS_CMP_HIDE_ZLEN);
if (!hidden) if (!hidden)
hidden = rb_find_bss(dev, tmp, hidden = rb_find_bss(rdev, tmp,
BSS_CMP_HIDE_NUL); BSS_CMP_HIDE_NUL);
if (hidden) { if (hidden) {
new->pub.hidden_beacon_bss = &hidden->pub; new->pub.hidden_beacon_bss = &hidden->pub;
...@@ -818,24 +818,24 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, ...@@ -818,24 +818,24 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
* expensive search for any probe responses that should * expensive search for any probe responses that should
* be grouped with this beacon for updates ... * be grouped with this beacon for updates ...
*/ */
if (!cfg80211_combine_bsses(dev, new)) { if (!cfg80211_combine_bsses(rdev, new)) {
kfree(new); kfree(new);
goto drop; goto drop;
} }
} }
list_add_tail(&new->list, &dev->bss_list); list_add_tail(&new->list, &rdev->bss_list);
rb_insert_bss(dev, new); rb_insert_bss(rdev, new);
found = new; found = new;
} }
dev->bss_generation++; rdev->bss_generation++;
bss_ref_get(dev, found); bss_ref_get(rdev, found);
spin_unlock_bh(&dev->bss_lock); spin_unlock_bh(&rdev->bss_lock);
return found; return found;
drop: drop:
spin_unlock_bh(&dev->bss_lock); spin_unlock_bh(&rdev->bss_lock);
return NULL; return NULL;
} }
...@@ -1007,7 +1007,7 @@ EXPORT_SYMBOL(cfg80211_inform_bss_width_frame); ...@@ -1007,7 +1007,7 @@ EXPORT_SYMBOL(cfg80211_inform_bss_width_frame);
void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *pub)
{ {
struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy); struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
struct cfg80211_internal_bss *bss; struct cfg80211_internal_bss *bss;
if (!pub) if (!pub)
...@@ -1015,15 +1015,15 @@ void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) ...@@ -1015,15 +1015,15 @@ void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *pub)
bss = container_of(pub, struct cfg80211_internal_bss, pub); bss = container_of(pub, struct cfg80211_internal_bss, pub);
spin_lock_bh(&dev->bss_lock); spin_lock_bh(&rdev->bss_lock);
bss_ref_get(dev, bss); bss_ref_get(rdev, bss);
spin_unlock_bh(&dev->bss_lock); spin_unlock_bh(&rdev->bss_lock);
} }
EXPORT_SYMBOL(cfg80211_ref_bss); EXPORT_SYMBOL(cfg80211_ref_bss);
void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *pub)
{ {
struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy); struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
struct cfg80211_internal_bss *bss; struct cfg80211_internal_bss *bss;
if (!pub) if (!pub)
...@@ -1031,15 +1031,15 @@ void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) ...@@ -1031,15 +1031,15 @@ void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *pub)
bss = container_of(pub, struct cfg80211_internal_bss, pub); bss = container_of(pub, struct cfg80211_internal_bss, pub);
spin_lock_bh(&dev->bss_lock); spin_lock_bh(&rdev->bss_lock);
bss_ref_put(dev, bss); bss_ref_put(rdev, bss);
spin_unlock_bh(&dev->bss_lock); spin_unlock_bh(&rdev->bss_lock);
} }
EXPORT_SYMBOL(cfg80211_put_bss); EXPORT_SYMBOL(cfg80211_put_bss);
void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *pub)
{ {
struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy); struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
struct cfg80211_internal_bss *bss; struct cfg80211_internal_bss *bss;
if (WARN_ON(!pub)) if (WARN_ON(!pub))
...@@ -1047,12 +1047,12 @@ void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) ...@@ -1047,12 +1047,12 @@ void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *pub)
bss = container_of(pub, struct cfg80211_internal_bss, pub); bss = container_of(pub, struct cfg80211_internal_bss, pub);
spin_lock_bh(&dev->bss_lock); spin_lock_bh(&rdev->bss_lock);
if (!list_empty(&bss->list)) { if (!list_empty(&bss->list)) {
if (__cfg80211_unlink_bss(dev, bss)) if (__cfg80211_unlink_bss(rdev, bss))
dev->bss_generation++; rdev->bss_generation++;
} }
spin_unlock_bh(&dev->bss_lock); spin_unlock_bh(&rdev->bss_lock);
} }
EXPORT_SYMBOL(cfg80211_unlink_bss); EXPORT_SYMBOL(cfg80211_unlink_bss);
...@@ -1465,7 +1465,7 @@ ieee80211_bss(struct wiphy *wiphy, struct iw_request_info *info, ...@@ -1465,7 +1465,7 @@ ieee80211_bss(struct wiphy *wiphy, struct iw_request_info *info,
} }
static int ieee80211_scan_results(struct cfg80211_registered_device *dev, static int ieee80211_scan_results(struct cfg80211_registered_device *rdev,
struct iw_request_info *info, struct iw_request_info *info,
char *buf, size_t len) char *buf, size_t len)
{ {
...@@ -1473,18 +1473,18 @@ static int ieee80211_scan_results(struct cfg80211_registered_device *dev, ...@@ -1473,18 +1473,18 @@ static int ieee80211_scan_results(struct cfg80211_registered_device *dev,
char *end_buf = buf + len; char *end_buf = buf + len;
struct cfg80211_internal_bss *bss; struct cfg80211_internal_bss *bss;
spin_lock_bh(&dev->bss_lock); spin_lock_bh(&rdev->bss_lock);
cfg80211_bss_expire(dev); cfg80211_bss_expire(rdev);
list_for_each_entry(bss, &dev->bss_list, list) { list_for_each_entry(bss, &rdev->bss_list, list) {
if (buf + len - current_ev <= IW_EV_ADDR_LEN) { if (buf + len - current_ev <= IW_EV_ADDR_LEN) {
spin_unlock_bh(&dev->bss_lock); spin_unlock_bh(&rdev->bss_lock);
return -E2BIG; return -E2BIG;
} }
current_ev = ieee80211_bss(&dev->wiphy, info, bss, current_ev = ieee80211_bss(&rdev->wiphy, info, bss,
current_ev, end_buf); current_ev, end_buf);
} }
spin_unlock_bh(&dev->bss_lock); spin_unlock_bh(&rdev->bss_lock);
return current_ev - buf; return current_ev - buf;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册