Skip to content

Commit

Permalink
mac80211_hwsim: assign index from separate counter
Browse files Browse the repository at this point in the history
To later allow dynamic registration, assign the index for the
struct device and MAC address from a new free-running counter.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Johannes Berg committed Jan 10, 2014
1 parent 8133841 commit 2d68992
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/net/wireless/mac80211_hwsim.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ static const struct ieee80211_rate hwsim_rates[] = {

static spinlock_t hwsim_radio_lock;
static struct list_head hwsim_radios;
static int hwsim_radio_idx;

struct mac80211_hwsim_data {
struct list_head list;
Expand Down Expand Up @@ -2126,14 +2127,19 @@ static const struct ieee80211_iface_combination hwsim_if_comb[] = {
}
};

static int __init mac80211_hwsim_create_radio(int idx)
static int __init mac80211_hwsim_create_radio(void)
{
int err;
u8 addr[ETH_ALEN];
struct mac80211_hwsim_data *data;
struct ieee80211_hw *hw;
enum ieee80211_band band;
const struct ieee80211_ops *ops = &mac80211_hwsim_ops;
int idx;

spin_lock_bh(&hwsim_radio_lock);
idx = hwsim_radio_idx++;
spin_unlock_bh(&hwsim_radio_lock);

if (channels > 1)
ops = &mac80211_hwsim_mchan_ops;
Expand Down Expand Up @@ -2375,7 +2381,7 @@ static int __init init_mac80211_hwsim(void)
}

for (i = 0; i < radios; i++) {
err = mac80211_hwsim_create_radio(i);
err = mac80211_hwsim_create_radio();
if (err)
goto out_free_radios;
}
Expand Down

0 comments on commit 2d68992

Please sign in to comment.