linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Revert "wireless: Keep phy name consistent across module reloads."
@ 2010-09-27 16:07 greearb
  2010-09-27 16:07 ` [PATCH 2/2] wireless: Use first phyX name available when registering phy devices greearb
  0 siblings, 1 reply; 4+ messages in thread
From: greearb @ 2010-09-27 16:07 UTC (permalink / raw)
  To: linux-wireless; +Cc: Ben Greear

From: Ben Greear <greearb@candelatech.com>

This reverts commit a6ab8e2903d4416a53e3bcc97ae2d3148a36c5df.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 8226ba7... 9c21ebf... M	net/wireless/core.c
 net/wireless/core.c |   15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)

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;
 	}
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-09-27 16:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-27 16:07 [PATCH 1/2] Revert "wireless: Keep phy name consistent across module reloads." greearb
2010-09-27 16:07 ` [PATCH 2/2] wireless: Use first phyX name available when registering phy devices greearb
2010-09-27 16:17   ` Johannes Berg
2010-09-27 16:39     ` Ben Greear

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).