diff mbox

[1/2] Revert "wireless: Keep phy name consistent across module reloads."

Message ID 1285603646-7710-1-git-send-email-greearb@candelatech.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

greearb@gmail.com Sept. 27, 2010, 4:07 p.m. UTC
None
diff mbox

Patch

diff --git a/net/wireless/core.c b/net/wireless/core.c
index 8226ba7..9c21ebf 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -319,7 +319,8 @@  static void cfg80211_event_work(struct work_struct *work)
 
 struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv)
 {
-	int i;
+	static int wiphy_counter;
+
 	struct cfg80211_registered_device *rdev;
 	int alloc_size;
 
@@ -341,18 +342,12 @@  struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv)
 
 	mutex_lock(&cfg80211_mutex);
 
-	/* 64k wiphy devices is enough for anyone! */
-	for (i = 0; i < 0xFFFF; i++) {
-		if (!cfg80211_rdev_by_wiphy_idx(i))
-			break;
-	}
-	if (i == 0xFFFF)
-		i = -1; /* invalid */
-	rdev->wiphy_idx = i;
+	rdev->wiphy_idx = wiphy_counter++;
 
 	if (unlikely(!wiphy_idx_valid(rdev->wiphy_idx))) {
+		wiphy_counter--;
 		mutex_unlock(&cfg80211_mutex);
-		/* ugh, too many devices already! */
+		/* ugh, wrapped! */
 		kfree(rdev);
 		return NULL;
 	}