From: Ben Greear <greearb@xxxxxxxxxxxxxxx> This reverts commit a6ab8e2903d4416a53e3bcc97ae2d3148a36c5df. Signed-off-by: Ben Greear <greearb@xxxxxxxxxxxxxxx> --- :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 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html