Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 111956
b: refs/heads/master
c: 638af07
h: refs/heads/master
v: v3
  • Loading branch information
Denis ChengRq authored and John W. Linville committed Sep 24, 2008
1 parent f9c1645 commit eead9b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: acaf908d408ccd49f13aeb46cbd4428a4db174d1
refs/heads/master: 638af07386972861272ed9d0cff01cad528fdceb
16 changes: 7 additions & 9 deletions trunk/net/wireless/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ MODULE_DESCRIPTION("wireless configuration support");
* often because we need to do it for each command */
LIST_HEAD(cfg80211_drv_list);
DEFINE_MUTEX(cfg80211_drv_mutex);
static int wiphy_counter;

/* for debugfs */
static struct dentry *ieee80211_debugfs_dir;
Expand Down Expand Up @@ -206,6 +205,8 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev,

struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv)
{
static int wiphy_counter;

struct cfg80211_registered_device *drv;
int alloc_size;

Expand All @@ -222,21 +223,18 @@ struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv)

mutex_lock(&cfg80211_drv_mutex);

drv->idx = wiphy_counter;

/* now increase counter for the next device unless
* it has wrapped previously */
if (wiphy_counter >= 0)
wiphy_counter++;

mutex_unlock(&cfg80211_drv_mutex);
drv->idx = wiphy_counter++;

if (unlikely(drv->idx < 0)) {
wiphy_counter--;
mutex_unlock(&cfg80211_drv_mutex);
/* ugh, wrapped! */
kfree(drv);
return NULL;
}

mutex_unlock(&cfg80211_drv_mutex);

/* give it a proper name */
snprintf(drv->wiphy.dev.bus_id, BUS_ID_SIZE,
PHY_NAME "%d", drv->idx);
Expand Down

0 comments on commit eead9b1

Please sign in to comment.