Skip to content

Commit b5850a7

Browse files
Luis R. Rodriguezlinvjw
authored andcommitted
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>
1 parent 79f6440 commit b5850a7

4 files changed

Lines changed: 22 additions & 21 deletions

File tree

‎net/wireless/core.c‎

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@ DEFINE_MUTEX(cfg80211_drv_mutex);
3737
static struct dentry *ieee80211_debugfs_dir;
3838

3939
/* 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)
4142
{
4243
struct cfg80211_registered_device *result = NULL, *drv;
4344

4445
list_for_each_entry(drv, &cfg80211_drv_list, list) {
45-
if (drv->idx == wiphy) {
46+
if (drv->wiphy_idx == wiphy_idx) {
4647
result = drv;
4748
break;
4849
}
@@ -56,12 +57,12 @@ static struct cfg80211_registered_device *
5657
__cfg80211_drv_from_info(struct genl_info *info)
5758
{
5859
int ifindex;
59-
struct cfg80211_registered_device *bywiphy = NULL, *byifidx = NULL;
60+
struct cfg80211_registered_device *bywiphyidx = NULL, *byifidx = NULL;
6061
struct net_device *dev;
6162
int err = -EINVAL;
6263

6364
if (info->attrs[NL80211_ATTR_WIPHY]) {
64-
bywiphy = cfg80211_drv_by_wiphy(
65+
bywiphyidx = cfg80211_drv_by_wiphy_idx(
6566
nla_get_u32(info->attrs[NL80211_ATTR_WIPHY]));
6667
err = -ENODEV;
6768
}
@@ -78,14 +79,14 @@ __cfg80211_drv_from_info(struct genl_info *info)
7879
err = -ENODEV;
7980
}
8081

81-
if (bywiphy && byifidx) {
82-
if (bywiphy != byifidx)
82+
if (bywiphyidx && byifidx) {
83+
if (bywiphyidx != byifidx)
8384
return ERR_PTR(-EINVAL);
8485
else
85-
return bywiphy; /* == byifidx */
86+
return bywiphyidx; /* == byifidx */
8687
}
87-
if (bywiphy)
88-
return bywiphy;
88+
if (bywiphyidx)
89+
return bywiphyidx;
8990

9091
if (byifidx)
9192
return byifidx;
@@ -143,16 +144,16 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev,
143144
char *newname)
144145
{
145146
struct cfg80211_registered_device *drv;
146-
int idx, taken = -1, result, digits;
147+
int wiphy_idx, taken = -1, result, digits;
147148

148149
mutex_lock(&cfg80211_drv_mutex);
149150

150151
/* prohibit calling the thing phy%d when %d is not its number */
151-
sscanf(newname, PHY_NAME "%d%n", &idx, &taken);
152-
if (taken == strlen(newname) && idx != rdev->idx) {
153-
/* count number of places needed to print idx */
152+
sscanf(newname, PHY_NAME "%d%n", &wiphy_idx, &taken);
153+
if (taken == strlen(newname) && wiphy_idx != rdev->wiphy_idx) {
154+
/* count number of places needed to print wiphy_idx */
154155
digits = 1;
155-
while (idx /= 10)
156+
while (wiphy_idx /= 10)
156157
digits++;
157158
/*
158159
* 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)
222223

223224
mutex_lock(&cfg80211_drv_mutex);
224225

225-
drv->idx = wiphy_counter++;
226+
drv->wiphy_idx = wiphy_counter++;
226227

227-
if (unlikely(drv->idx < 0)) {
228+
if (unlikely(drv->wiphy_idx < 0)) {
228229
wiphy_counter--;
229230
mutex_unlock(&cfg80211_drv_mutex);
230231
/* ugh, wrapped! */
@@ -235,7 +236,7 @@ struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv)
235236
mutex_unlock(&cfg80211_drv_mutex);
236237

237238
/* 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);
239240

240241
mutex_init(&drv->mtx);
241242
mutex_init(&drv->devlist_mtx);

‎net/wireless/core.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct cfg80211_registered_device {
3737
enum environment_cap env;
3838

3939
/* wiphy index, internal only */
40-
int idx;
40+
int wiphy_idx;
4141

4242
/* associate netdev list */
4343
struct mutex devlist_mtx;

‎net/wireless/nl80211.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
142142
if (!hdr)
143143
return -1;
144144

145-
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, dev->idx);
145+
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, dev->wiphy_idx);
146146
NLA_PUT_STRING(msg, NL80211_ATTR_WIPHY_NAME, wiphy_name(&dev->wiphy));
147147
NLA_PUT_U8(msg, NL80211_ATTR_MAX_NUM_SCAN_SSIDS,
148148
dev->wiphy.max_scan_ssids);
@@ -2763,7 +2763,7 @@ static int nl80211_send_scan_donemsg(struct sk_buff *msg,
27632763
if (!hdr)
27642764
return -1;
27652765

2766-
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->idx);
2766+
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx);
27672767
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex);
27682768

27692769
/* XXX: we should probably bounce back the request? */

‎net/wireless/sysfs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static ssize_t name ## _show(struct device *dev, \
3131
return sprintf(buf, fmt "\n", dev_to_rdev(dev)->member); \
3232
}
3333

34-
SHOW_FMT(index, "%d", idx);
34+
SHOW_FMT(index, "%d", wiphy_idx);
3535
SHOW_FMT(macaddress, "%pM", wiphy.perm_addr);
3636

3737
static struct device_attribute ieee80211_dev_attrs[] = {

0 commit comments

Comments
 (0)