diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-02-21 00:04:19 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-27 14:52:54 -0500 |
commit | b5850a7a4fd5bcab4f6a2c49e5b4ab9ebb1d5d44 (patch) | |
tree | 0f2d14a5cf0e47c6d2ab647248b06cedd4acf85b /net/wireless/core.c | |
parent | 79f6440c527c61bcd84edfbdeb390841b9fe5095 (diff) |
cfg80211: rename cfg80211_registered_device's idx to wiphy_idx
Makes it clearer to read when comparing to ifidx
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/core.c')
-rw-r--r-- | net/wireless/core.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c index 0668b2bfc1da..2b3e786ec53f 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -37,12 +37,13 @@ DEFINE_MUTEX(cfg80211_drv_mutex); | |||
37 | static struct dentry *ieee80211_debugfs_dir; | 37 | static struct dentry *ieee80211_debugfs_dir; |
38 | 38 | ||
39 | /* requires cfg80211_drv_mutex to be held! */ | 39 | /* requires cfg80211_drv_mutex to be held! */ |
40 | static struct cfg80211_registered_device *cfg80211_drv_by_wiphy(int wiphy) | 40 | static struct cfg80211_registered_device * |
41 | cfg80211_drv_by_wiphy_idx(int wiphy_idx) | ||
41 | { | 42 | { |
42 | struct cfg80211_registered_device *result = NULL, *drv; | 43 | struct cfg80211_registered_device *result = NULL, *drv; |
43 | 44 | ||
44 | list_for_each_entry(drv, &cfg80211_drv_list, list) { | 45 | list_for_each_entry(drv, &cfg80211_drv_list, list) { |
45 | if (drv->idx == wiphy) { | 46 | if (drv->wiphy_idx == wiphy_idx) { |
46 | result = drv; | 47 | result = drv; |
47 | break; | 48 | break; |
48 | } | 49 | } |
@@ -56,12 +57,12 @@ static struct cfg80211_registered_device * | |||
56 | __cfg80211_drv_from_info(struct genl_info *info) | 57 | __cfg80211_drv_from_info(struct genl_info *info) |
57 | { | 58 | { |
58 | int ifindex; | 59 | int ifindex; |
59 | struct cfg80211_registered_device *bywiphy = NULL, *byifidx = NULL; | 60 | struct cfg80211_registered_device *bywiphyidx = NULL, *byifidx = NULL; |
60 | struct net_device *dev; | 61 | struct net_device *dev; |
61 | int err = -EINVAL; | 62 | int err = -EINVAL; |
62 | 63 | ||
63 | if (info->attrs[NL80211_ATTR_WIPHY]) { | 64 | if (info->attrs[NL80211_ATTR_WIPHY]) { |
64 | bywiphy = cfg80211_drv_by_wiphy( | 65 | bywiphyidx = cfg80211_drv_by_wiphy_idx( |
65 | nla_get_u32(info->attrs[NL80211_ATTR_WIPHY])); | 66 | nla_get_u32(info->attrs[NL80211_ATTR_WIPHY])); |
66 | err = -ENODEV; | 67 | err = -ENODEV; |
67 | } | 68 | } |
@@ -78,14 +79,14 @@ __cfg80211_drv_from_info(struct genl_info *info) | |||
78 | err = -ENODEV; | 79 | err = -ENODEV; |
79 | } | 80 | } |
80 | 81 | ||
81 | if (bywiphy && byifidx) { | 82 | if (bywiphyidx && byifidx) { |
82 | if (bywiphy != byifidx) | 83 | if (bywiphyidx != byifidx) |
83 | return ERR_PTR(-EINVAL); | 84 | return ERR_PTR(-EINVAL); |
84 | else | 85 | else |
85 | return bywiphy; /* == byifidx */ | 86 | return bywiphyidx; /* == byifidx */ |
86 | } | 87 | } |
87 | if (bywiphy) | 88 | if (bywiphyidx) |
88 | return bywiphy; | 89 | return bywiphyidx; |
89 | 90 | ||
90 | if (byifidx) | 91 | if (byifidx) |
91 | return byifidx; | 92 | return byifidx; |
@@ -143,16 +144,16 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev, | |||
143 | char *newname) | 144 | char *newname) |
144 | { | 145 | { |
145 | struct cfg80211_registered_device *drv; | 146 | struct cfg80211_registered_device *drv; |
146 | int idx, taken = -1, result, digits; | 147 | int wiphy_idx, taken = -1, result, digits; |
147 | 148 | ||
148 | mutex_lock(&cfg80211_drv_mutex); | 149 | mutex_lock(&cfg80211_drv_mutex); |
149 | 150 | ||
150 | /* prohibit calling the thing phy%d when %d is not its number */ | 151 | /* prohibit calling the thing phy%d when %d is not its number */ |
151 | sscanf(newname, PHY_NAME "%d%n", &idx, &taken); | 152 | sscanf(newname, PHY_NAME "%d%n", &wiphy_idx, &taken); |
152 | if (taken == strlen(newname) && idx != rdev->idx) { | 153 | if (taken == strlen(newname) && wiphy_idx != rdev->wiphy_idx) { |
153 | /* count number of places needed to print idx */ | 154 | /* count number of places needed to print wiphy_idx */ |
154 | digits = 1; | 155 | digits = 1; |
155 | while (idx /= 10) | 156 | while (wiphy_idx /= 10) |
156 | digits++; | 157 | digits++; |
157 | /* | 158 | /* |
158 | * deny the name if it is phy<idx> where <idx> is printed | 159 | * deny the name if it is phy<idx> where <idx> is printed |
@@ -222,9 +223,9 @@ struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv) | |||
222 | 223 | ||
223 | mutex_lock(&cfg80211_drv_mutex); | 224 | mutex_lock(&cfg80211_drv_mutex); |
224 | 225 | ||
225 | drv->idx = wiphy_counter++; | 226 | drv->wiphy_idx = wiphy_counter++; |
226 | 227 | ||
227 | if (unlikely(drv->idx < 0)) { | 228 | if (unlikely(drv->wiphy_idx < 0)) { |
228 | wiphy_counter--; | 229 | wiphy_counter--; |
229 | mutex_unlock(&cfg80211_drv_mutex); | 230 | mutex_unlock(&cfg80211_drv_mutex); |
230 | /* ugh, wrapped! */ | 231 | /* ugh, wrapped! */ |
@@ -235,7 +236,7 @@ struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv) | |||
235 | mutex_unlock(&cfg80211_drv_mutex); | 236 | mutex_unlock(&cfg80211_drv_mutex); |
236 | 237 | ||
237 | /* give it a proper name */ | 238 | /* give it a proper name */ |
238 | dev_set_name(&drv->wiphy.dev, PHY_NAME "%d", drv->idx); | 239 | dev_set_name(&drv->wiphy.dev, PHY_NAME "%d", drv->wiphy_idx); |
239 | 240 | ||
240 | mutex_init(&drv->mtx); | 241 | mutex_init(&drv->mtx); |
241 | mutex_init(&drv->devlist_mtx); | 242 | mutex_init(&drv->devlist_mtx); |