aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2009-02-21 00:04:19 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-27 14:52:54 -0500
commitb5850a7a4fd5bcab4f6a2c49e5b4ab9ebb1d5d44 (patch)
tree0f2d14a5cf0e47c6d2ab647248b06cedd4acf85b
parent79f6440c527c61bcd84edfbdeb390841b9fe5095 (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>
-rw-r--r--net/wireless/core.c35
-rw-r--r--net/wireless/core.h2
-rw-r--r--net/wireless/nl80211.c4
-rw-r--r--net/wireless/sysfs.c2
4 files changed, 22 insertions, 21 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);
37static struct dentry *ieee80211_debugfs_dir; 37static struct dentry *ieee80211_debugfs_dir;
38 38
39/* requires cfg80211_drv_mutex to be held! */ 39/* requires cfg80211_drv_mutex to be held! */
40static struct cfg80211_registered_device *cfg80211_drv_by_wiphy(int wiphy) 40static struct cfg80211_registered_device *
41cfg80211_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);
diff --git a/net/wireless/core.h b/net/wireless/core.h
index 5d0c682d737a..178378124800 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -37,7 +37,7 @@ struct cfg80211_registered_device {
37 enum environment_cap env; 37 enum environment_cap env;
38 38
39 /* wiphy index, internal only */ 39 /* wiphy index, internal only */
40 int idx; 40 int wiphy_idx;
41 41
42 /* associate netdev list */ 42 /* associate netdev list */
43 struct mutex devlist_mtx; 43 struct mutex devlist_mtx;
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index a7e751edc739..b176bb800100 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -142,7 +142,7 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
142 if (!hdr) 142 if (!hdr)
143 return -1; 143 return -1;
144 144
145 NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, dev->idx); 145 NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, dev->wiphy_idx);
146 NLA_PUT_STRING(msg, NL80211_ATTR_WIPHY_NAME, wiphy_name(&dev->wiphy)); 146 NLA_PUT_STRING(msg, NL80211_ATTR_WIPHY_NAME, wiphy_name(&dev->wiphy));
147 NLA_PUT_U8(msg, NL80211_ATTR_MAX_NUM_SCAN_SSIDS, 147 NLA_PUT_U8(msg, NL80211_ATTR_MAX_NUM_SCAN_SSIDS,
148 dev->wiphy.max_scan_ssids); 148 dev->wiphy.max_scan_ssids);
@@ -2763,7 +2763,7 @@ static int nl80211_send_scan_donemsg(struct sk_buff *msg,
2763 if (!hdr) 2763 if (!hdr)
2764 return -1; 2764 return -1;
2765 2765
2766 NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->idx); 2766 NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx);
2767 NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); 2767 NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex);
2768 2768
2769 /* XXX: we should probably bounce back the request? */ 2769 /* XXX: we should probably bounce back the request? */
diff --git a/net/wireless/sysfs.c b/net/wireless/sysfs.c
index 15feaeb5ced5..efe3c5c92b2d 100644
--- a/net/wireless/sysfs.c
+++ b/net/wireless/sysfs.c
@@ -31,7 +31,7 @@ static ssize_t name ## _show(struct device *dev, \
31 return sprintf(buf, fmt "\n", dev_to_rdev(dev)->member); \ 31 return sprintf(buf, fmt "\n", dev_to_rdev(dev)->member); \
32} 32}
33 33
34SHOW_FMT(index, "%d", idx); 34SHOW_FMT(index, "%d", wiphy_idx);
35SHOW_FMT(macaddress, "%pM", wiphy.perm_addr); 35SHOW_FMT(macaddress, "%pM", wiphy.perm_addr);
36 36
37static struct device_attribute ieee80211_dev_attrs[] = { 37static struct device_attribute ieee80211_dev_attrs[] = {